]> Git Repo - qemu.git/log
qemu.git
4 years agohw/vfio: Add VMD Passthrough Quirk
Jon Derrick [Thu, 11 Jun 2020 17:36:39 +0000 (11:36 -0600)]
hw/vfio: Add VMD Passthrough Quirk

The VMD endpoint provides a real PCIe domain to the guest, including
bridges and endpoints. Because the VMD domain is enumerated by the guest
kernel, the guest kernel will assign Guest Physical Addresses to the
downstream endpoint BARs and bridge windows.

When the guest kernel performs MMIO to VMD sub-devices, MMU will
translate from the guest address space to the physical address space.
Because the bridges have been programmed with guest addresses, the
bridges will reject the transaction containing physical addresses.

VMD device 28C0 natively assists passthrough by providing the Host
Physical Address in shadow registers accessible to the guest for bridge
window assignment. The shadow registers are valid if bit 1 is set in VMD
VMLOCK config register 0x70.

In order to support existing VMDs, this quirk provides the shadow
registers in a vendor-specific PCI capability to the vfio-passthrough
device for all VMD device ids which don't natively assist with
passthrough. The Linux VMD driver is updated to check for this new
vendor-specific capability.

Signed-off-by: Jon Derrick <[email protected]>
Signed-off-by: Alex Williamson <[email protected]>
4 years agoMerge remote-tracking branch 'remotes/ericb/tags/pull-bitmaps-2020-06-09' into staging
Peter Maydell [Thu, 11 Jun 2020 14:35:44 +0000 (15:35 +0100)]
Merge remote-tracking branch 'remotes/ericb/tags/pull-bitmaps-2020-06-09' into staging

bitmaps patches for 2020-06-09

- documenation fix
- various improvements to qcow2.py program used in iotests

# gpg: Signature made Tue 09 Jun 2020 21:50:35 BST
# gpg:                using RSA key 71C2CC22B1C4602927D2F3AAA7A16B4A2527436A
# gpg: Good signature from "Eric Blake <[email protected]>" [full]
# gpg:                 aka "Eric Blake (Free Software Programmer) <[email protected]>" [full]
# gpg:                 aka "[jpeg image of size 6874]" [full]
# Primary key fingerprint: 71C2 CC22 B1C4 6029 27D2  F3AA A7A1 6B4A 2527 436A

* remotes/ericb/tags/pull-bitmaps-2020-06-09:
  iotests: Fix 291 across more file systems
  qcow2_format.py: dump bitmaps header extension
  qcow2: QcowHeaderExtension print names for extension magics
  qcow2_format: refactor QcowHeaderExtension as a subclass of Qcow2Struct
  qcow2_format.py: QcowHeaderExtension: add dump method
  qcow2_format.py: add field-formatting class
  qcow2_format.py: separate generic functionality of structure classes
  qcow2_format.py: use strings to specify c-type of struct fields
  qcow2_format.py: use modern string formatting
  qcow2_format.py: use tuples instead of lists for fields
  qcow2_format.py: drop new line printing at end of dump()
  qcow2.py: move qcow2 format classes to separate module
  qcow2.py: add licensing blurb
  qcow2.py: python style fixes
  qemu-img: Fix doc typo for 'bitmap' subcommand

Signed-off-by: Peter Maydell <[email protected]>
4 years agoMerge remote-tracking branch 'remotes/amarkovic/tags/mips-queue-jun-09-2020' into...
Peter Maydell [Thu, 11 Jun 2020 12:07:34 +0000 (13:07 +0100)]
Merge remote-tracking branch 'remotes/amarkovic/tags/mips-queue-jun-09-2020' into staging

MIPS queue for June 9th, 2020

# gpg: Signature made Tue 09 Jun 2020 17:18:59 BST
# gpg:                using RSA key D4972A8967F75A65
# gpg: Good signature from "Aleksandar Markovic <[email protected]>" [full]
# Primary key fingerprint: 8526 FBF1 5DA3 811F 4A01  DD75 D497 2A89 67F7 5A65

* remotes/amarkovic/tags/mips-queue-jun-09-2020:
  target/mips: Enable hardware page table walker and CMGCR features for P5600
  target/mips: Add Loongson-3 CPU definition
  target/mips: fpu: Refactor conversion from ieee to mips exception flags
  target/mips: fpu: Name better paired-single variables
  target/mips: fpu: Remove now unused FLOAT_RINT macro
  target/mips: fpu: Demacro RINT.<D|S>
  target/mips: fpu: Remove now unused FLOAT_CLASS macro
  target/mips: fpu: Demacro CLASS.<D|S>
  target/mips: fpu: Remove now unused UNFUSED_FMA and FLOAT_FMA macros
  target/mips: fpu: Demacro NMSUB.<D|S|PS>
  target/mips: fpu: Demacro NMADD.<D|S|PS>
  target/mips: fpu: Demacro MSUB.<D|S|PS>
  target/mips: fpu: Demacro MADD.<D|S|PS>
  target/mips: fpu: Remove now unused macro FLOAT_BINOP
  target/mips: fpu: Demacro DIV.<D|S|PS>
  target/mips: fpu: Demacro MUL.<D|S|PS>
  target/mips: fpu: Demacro SUB.<D|S|PS>
  target/mips: fpu: Demacro ADD.<D|S|PS>
  mailmap: Change email address of Stefan Brankovic
  mailmap: Change email address of Filip Bozuta

Signed-off-by: Peter Maydell <[email protected]>
4 years agoMerge remote-tracking branch 'remotes/rth/tags/pull-dt-20200609' into staging
Peter Maydell [Thu, 11 Jun 2020 10:20:39 +0000 (11:20 +0100)]
Merge remote-tracking branch 'remotes/rth/tags/pull-dt-20200609' into staging

Add non-overlapping groups

# gpg: Signature made Tue 09 Jun 2020 17:22:17 BST
# gpg:                using RSA key 7A481E78868B4DB6A85A05C064DF38E8AF7E215F
# gpg:                issuer "[email protected]"
# gpg: Good signature from "Richard Henderson <[email protected]>" [full]
# Primary key fingerprint: 7A48 1E78 868B 4DB6 A85A  05C0 64DF 38E8 AF7E 215F

* remotes/rth/tags/pull-dt-20200609:
  target/arm: Use a non-overlapping group for misc control
  decodetree: Drop check for less than 2 patterns in a group
  tests/decode: Test non-overlapping groups
  decodetree: Implement non-overlapping groups
  decodetree: Move semantic propagation into classes
  decodetree: Allow group covering the entire insn space
  decodetree: Split out MultiPattern from IncMultiPattern
  decodetree: Rename MultiPattern to IncMultiPattern
  decodetree: Tidy error_with_file

Signed-off-by: Peter Maydell <[email protected]>
4 years agoiotests: Fix 291 across more file systems
Eric Blake [Mon, 8 Jun 2020 19:56:29 +0000 (14:56 -0500)]
iotests: Fix 291 across more file systems

Depending on the granularity of holes and amount of metadata consumed
by a file, the 'disk size:' number of 'qemu-img info' is not reliable.
Adjust our test to use a different set of filters to avoid spurious
failures.

Reported-by: Kevin Wolf <[email protected]>
Fixes: cf2d1203dc
Signed-off-by: Eric Blake <[email protected]>
Message-Id: <20200608195629.3299649[email protected]>
Acked-by: Kevin Wolf <[email protected]>
[eblake: fix merge conflict]
Signed-off-by: Eric Blake <[email protected]>
4 years agoqcow2_format.py: dump bitmaps header extension
Vladimir Sementsov-Ogievskiy [Sat, 6 Jun 2020 08:18:06 +0000 (11:18 +0300)]
qcow2_format.py: dump bitmaps header extension

Add class for bitmap extension and dump its fields. Further work is to
dump bitmap directory.

Test new functionality inside 291 iotest.

Signed-off-by: Vladimir Sementsov-Ogievskiy <[email protected]>
Reviewed-by: Andrey Shinkevich <[email protected]>
Message-Id: <20200606081806[email protected]>
[eblake: fix iotest output]
Signed-off-by: Eric Blake <[email protected]>
4 years agoqcow2: QcowHeaderExtension print names for extension magics
Vladimir Sementsov-Ogievskiy [Sat, 6 Jun 2020 08:18:05 +0000 (11:18 +0300)]
qcow2: QcowHeaderExtension print names for extension magics

Suggested-by: Andrey Shinkevich <[email protected]>
Signed-off-by: Vladimir Sementsov-Ogievskiy <[email protected]>
Message-Id: <20200606081806[email protected]>
Reviewed-by: Eric Blake <[email protected]>
Signed-off-by: Eric Blake <[email protected]>
4 years agoqcow2_format: refactor QcowHeaderExtension as a subclass of Qcow2Struct
Vladimir Sementsov-Ogievskiy [Sat, 6 Jun 2020 08:18:04 +0000 (11:18 +0300)]
qcow2_format: refactor QcowHeaderExtension as a subclass of Qcow2Struct

Only two fields we can parse by generic code, but that is better than
nothing. Keep further refactoring of variable-length fields for another
day.

Signed-off-by: Vladimir Sementsov-Ogievskiy <[email protected]>
Reviewed-by: Andrey Shinkevich <[email protected]>
Message-Id: <20200606081806[email protected]>
Signed-off-by: Eric Blake <[email protected]>
4 years agoqcow2_format.py: QcowHeaderExtension: add dump method
Vladimir Sementsov-Ogievskiy [Sat, 6 Jun 2020 08:18:03 +0000 (11:18 +0300)]
qcow2_format.py: QcowHeaderExtension: add dump method

Obviously, for-loop body in dump_extensions should be the dump method
of extension.

Signed-off-by: Vladimir Sementsov-Ogievskiy <[email protected]>
Reviewed-by: Andrey Shinkevich <[email protected]>
Message-Id: <20200606081806[email protected]>
Signed-off-by: Eric Blake <[email protected]>
4 years agoqcow2_format.py: add field-formatting class
Vladimir Sementsov-Ogievskiy [Sat, 6 Jun 2020 08:18:02 +0000 (11:18 +0300)]
qcow2_format.py: add field-formatting class

Allow formatter class in structure definition instead of hacking with
'mask'. This will simplify further introduction of new formatters.

Signed-off-by: Vladimir Sementsov-Ogievskiy <[email protected]>
Reviewed-by: Andrey Shinkevich <[email protected]>
Message-Id: <20200606081806[email protected]>
Signed-off-by: Eric Blake <[email protected]>
4 years agoqcow2_format.py: separate generic functionality of structure classes
Vladimir Sementsov-Ogievskiy [Sat, 6 Jun 2020 08:18:01 +0000 (11:18 +0300)]
qcow2_format.py: separate generic functionality of structure classes

We are going to introduce more Qcow2 structure types, defined like
QcowHeader. Move generic functionality into base class to be reused for
further structure classes.

Signed-off-by: Vladimir Sementsov-Ogievskiy <[email protected]>
Reviewed-by: Andrey Shinkevich <[email protected]>
Message-Id: <20200606081806[email protected]>
Signed-off-by: Eric Blake <[email protected]>
4 years agoqcow2_format.py: use strings to specify c-type of struct fields
Vladimir Sementsov-Ogievskiy [Sat, 6 Jun 2020 08:18:00 +0000 (11:18 +0300)]
qcow2_format.py: use strings to specify c-type of struct fields

We are going to move field-parsing to super-class, this will be simpler
with simple string specifiers instead of variables.

For some reason, python doesn't allow the definition of ctypes variable
in the class alongside fields: it would not be available then for use
by the 'for' operator. Don't worry: ctypes will be moved to metaclass
soon.

Signed-off-by: Vladimir Sementsov-Ogievskiy <[email protected]>
Reviewed-by: Andrey Shinkevich <[email protected]>
Message-Id: <20200606081806[email protected]>
Signed-off-by: Eric Blake <[email protected]>
4 years agoqcow2_format.py: use modern string formatting
Vladimir Sementsov-Ogievskiy [Sat, 6 Jun 2020 08:17:59 +0000 (11:17 +0300)]
qcow2_format.py: use modern string formatting

Use .format and f-strings instead of old %style. Also, the file uses
both '' and "" quotes, for consistency let's use '', except for cases
when we need '' inside the string (use "" to avoid extra escaping).

Signed-off-by: Vladimir Sementsov-Ogievskiy <[email protected]>
Reviewed-by: Andrey Shinkevich <[email protected]>
Message-Id: <20200606081806[email protected]>
Signed-off-by: Eric Blake <[email protected]>
4 years agoqcow2_format.py: use tuples instead of lists for fields
Vladimir Sementsov-Ogievskiy [Sat, 6 Jun 2020 08:17:58 +0000 (11:17 +0300)]
qcow2_format.py: use tuples instead of lists for fields

No need in lists: it's a constant variable.

Signed-off-by: Vladimir Sementsov-Ogievskiy <[email protected]>
Reviewed-by: Andrey Shinkevich <[email protected]>
Message-Id: <20200606081806[email protected]>
Signed-off-by: Eric Blake <[email protected]>
4 years agoqcow2_format.py: drop new line printing at end of dump()
Vladimir Sementsov-Ogievskiy [Sat, 6 Jun 2020 08:17:57 +0000 (11:17 +0300)]
qcow2_format.py: drop new line printing at end of dump()

This will simplify further conversion. To compensate, print this empty
line directly in cmd_dump_header().

Signed-off-by: Vladimir Sementsov-Ogievskiy <[email protected]>
Reviewed-by: Andrey Shinkevich <[email protected]>
Message-Id: <20200606081806[email protected]>
Signed-off-by: Eric Blake <[email protected]>
4 years agoqcow2.py: move qcow2 format classes to separate module
Vladimir Sementsov-Ogievskiy [Sat, 6 Jun 2020 08:17:56 +0000 (11:17 +0300)]
qcow2.py: move qcow2 format classes to separate module

We are going to enhance qcow2 format parsing by adding more structure
classes. Let's split format parsing from utility code.

Signed-off-by: Vladimir Sementsov-Ogievskiy <[email protected]>
Message-Id: <20200606081806[email protected]>
Reviewed-by: Eric Blake <[email protected]>
Signed-off-by: Eric Blake <[email protected]>
4 years agoqcow2.py: add licensing blurb
Vladimir Sementsov-Ogievskiy [Sat, 6 Jun 2020 08:17:55 +0000 (11:17 +0300)]
qcow2.py: add licensing blurb

Add classic heading, which is missing here. Keep copyright place empty,
prior authors may add a line later.

Signed-off-by: Vladimir Sementsov-Ogievskiy <[email protected]>
Message-Id: <20200606081806[email protected]>
Reviewed-by: Eric Blake <[email protected]>
[eblake: tweak commit message]
Signed-off-by: Eric Blake <[email protected]>
4 years agoqcow2.py: python style fixes
Vladimir Sementsov-Ogievskiy [Sat, 6 Jun 2020 08:17:54 +0000 (11:17 +0300)]
qcow2.py: python style fixes

Fix flake8 complaints.

Signed-off-by: Vladimir Sementsov-Ogievskiy <[email protected]>
Message-Id: <20200606081806[email protected]>
Tested-by: Eric Blake <[email protected]>
Reviewed-by: Eric Blake <[email protected]>
[eblake: commit message improved]
Signed-off-by: Eric Blake <[email protected]>
4 years agoqemu-img: Fix doc typo for 'bitmap' subcommand
Eric Blake [Fri, 29 May 2020 14:45:27 +0000 (09:45 -0500)]
qemu-img: Fix doc typo for 'bitmap' subcommand

Prefer a consistent naming for the --merge argument.

Fixes: 3b51ab4bf
Signed-off-by: Eric Blake <[email protected]>
Message-Id: <20200529144527.1943527[email protected]>
Reviewed-by: Vladimir Sementsov-Ogievskiy <[email protected]>
4 years agoMerge remote-tracking branch 'remotes/stsquad/tags/pull-testing-and-misc-080620-1...
Peter Maydell [Tue, 9 Jun 2020 20:30:00 +0000 (21:30 +0100)]
Merge remote-tracking branch 'remotes/stsquad/tags/pull-testing-and-misc-080620-1' into staging

Various testing and misc fixes:

  - header cleanups for plugins
  - support wider watchpoints
  - tweaks for unreliable and broken CI
  - docker image fixes and verion bumps
  - linux-user guest_base fixes
  - remove flex/bison from various test images

# gpg: Signature made Mon 08 Jun 2020 17:16:19 BST
# gpg:                using RSA key 6685AE99E75167BCAFC8DF35FBD0DB095A9E2A44
# gpg: Good signature from "Alex Bennée (Master Work Key) <[email protected]>" [full]
# Primary key fingerprint: 6685 AE99 E751 67BC AFC8  DF35 FBD0 DB09 5A9E 2A44

* remotes/stsquad/tags/pull-testing-and-misc-080620-1:
  scripts/coverity-scan: Remove flex/bison packages
  cirrus-ci: Remove flex/bison packages
  tests/vm: Remove flex/bison packages
  tests/docker: Remove flex/bison packages
  linux-user: detect overflow of MAP_FIXED mmap
  tests/tcg: add simple commpage test case
  linux-user: deal with address wrap for ARM_COMMPAGE on 32 bit
  linux-user: provide fallback pgd_find_hole for bare chroots
  hw/virtio/vhost: re-factor vhost-section and allow DIRTY_MEMORY_CODE
  docker: update Ubuntu to 20.04
  tests/docker: fix pre-requisite for debian-tricore-cross
  .shippable: temporaily disable some cross builds
  .travis.yml: allow failure for unreliable hosts
  exec: flush the whole TLB if a watchpoint crosses a page boundary
  tests/plugin: correctly honour io_count
  scripts/clean-includes: Mark 'qemu/qemu-plugin.h' as special header
  qemu-plugin.h: add missing include <stddef.h> to define size_t

Signed-off-by: Peter Maydell <[email protected]>
4 years agoMerge remote-tracking branch 'remotes/philmd-gitlab/tags/sparc-next-20200609' into...
Peter Maydell [Tue, 9 Jun 2020 16:29:47 +0000 (17:29 +0100)]
Merge remote-tracking branch 'remotes/philmd-gitlab/tags/sparc-next-20200609' into staging

SPARC patches

HW:
- Use UNIMP device instead of EMPTY_SLOT
- Make EMPTY_SLOT similar to UNIMP device
- Map UART devices unconditionally
- Pair of fixes for AHB PnP
- Add trace events to AHB PnP

TCG:
- Improve exception logging

CI:
- https://gitlab.com/philmd/qemu/-/pipelines/154231191
- https://travis-ci.org/github/philmd/qemu/builds/696321130

# gpg: Signature made Tue 09 Jun 2020 08:24:09 BST
# gpg:                using RSA key FAABE75E12917221DCFD6BB2E3E32C2CDEADC0DE
# gpg: Good signature from "Philippe Mathieu-Daudé (F4BUG) <[email protected]>" [full]
# Primary key fingerprint: FAAB E75E 1291 7221 DCFD  6BB2 E3E3 2C2C DEAD C0DE

* remotes/philmd-gitlab/tags/sparc-next-20200609:
  target/sparc/int32_helper: Extract and use excp_name_str()
  target/sparc/int32_helper: Remove DEBUG_PCALL definition
  hw/timer/grlib_gptimer: Display frequency in decimal
  hw/misc/grlib_ahb_apb_pnp: Add trace events on read accesses
  hw/misc/grlib_ahb_apb_pnp: Fix AHB PnP 8-bit accesses
  hw/misc/grlib_ahb_apb_pnp: Avoid crash when writing to AHB PnP registers
  hw/sparc64/niagara: Remove duplicated NIAGARA_UART_BASE definition
  hw/sparc64/niagara: Map the UART device unconditionally
  hw/sparc/leon3: Map the UART device unconditionally
  hw/misc/empty_slot: Name the slots when created
  hw/misc/empty_slot: Move the 'hw/misc' and cover in MAINTAINERS
  hw/misc/empty_slot: Convert debug printf() to trace event
  hw/misc/empty_slot: Add a 'name' qdev property
  hw/misc/empty_slot: Convert 'size' field as qdev property
  hw/misc/empty_slot: Lower address space priority
  hw/sparc/sun4m: Use UnimplementedDevice for I/O devices

Signed-off-by: Peter Maydell <[email protected]>
4 years agotarget/arm: Use a non-overlapping group for misc control
Richard Henderson [Mon, 18 May 2020 16:25:10 +0000 (09:25 -0700)]
target/arm: Use a non-overlapping group for misc control

The miscellaneous control instructions are mutually exclusive
within the t32 decode sub-group.

Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: Richard Henderson <[email protected]>
4 years agodecodetree: Drop check for less than 2 patterns in a group
Richard Henderson [Mon, 8 Jun 2020 17:41:49 +0000 (10:41 -0700)]
decodetree: Drop check for less than 2 patterns in a group

While it makes little sense for the end product to have a group
containing only a single pattern, avoiding this case within an
incremental patch set is troublesome.

Because this is expected to be a transient condition, do not
bother "optimizing" this case, e.g. by folding away the group.

Reviewed-by: Peter Maydell <[email protected]>
Signed-off-by: Richard Henderson <[email protected]>
4 years agotarget/mips: Enable hardware page table walker and CMGCR features for P5600
Andrea Oliveri [Sat, 25 Apr 2020 18:20:04 +0000 (20:20 +0200)]
target/mips: Enable hardware page table walker and CMGCR features for P5600

Enable hardware page table walker and CMGCR features for P5600 that
supports both.

Signed-off-by: Andrea Oliveri <[email protected]>
Reviewed-by: Aleksandar Markovic <[email protected]>
Signed-off-by: Aleksandar Markovic <[email protected]>
Message-Id: <de5adcb9fd0dd607b98026f4bfb34205432b6002[email protected]>

4 years agotarget/mips: Add Loongson-3 CPU definition
Huacai Chen [Tue, 2 Jun 2020 02:39:15 +0000 (10:39 +0800)]
target/mips: Add Loongson-3 CPU definition

Loongson-3 CPU family include Loongson-3A R1/R2/R3/R4 and Loongson-3B
R1/R2. Loongson-3A R1 is the oldest and its ISA is the smallest, while
Loongson-3A R4 is the newest and its ISA is almost the superset of all
others. To reduce complexity, we just define two CPU types:

1) "Loongson-3A1000" CPU which is corresponding to Loongson-3A R1. It is
   suitable for TCG because Loongson-3A R1 has fewest ASE.
2) "Loongson-3A4000" CPU which is corresponding to Loongson-3A R4. It is
   suitable for KVM because Loongson-3A R4 has the VZ ASE.

Loongson-3A has CONFIG6 and CONFIG7, so add their bit-fields as well.

[AM: Rearranged insn_flags, added comments, renamed lmi_helper.c,
improved commit message, fixed checkpatch warnings]

Signed-off-by: Huacai Chen <[email protected]>
Co-developed-by: Jiaxun Yang <[email protected]>
Reviewed-by: Aleksandar Markovic <[email protected]>
Signed-off-by: Aleksandar Markovic <[email protected]>
Message-Id: <1591065557[email protected]>

4 years agotarget/mips: fpu: Refactor conversion from ieee to mips exception flags
Aleksandar Markovic [Mon, 18 May 2020 20:09:15 +0000 (22:09 +0200)]
target/mips: fpu: Refactor conversion from ieee to mips exception flags

The original coversion function is used for regular and MSA floating
point instructions handling. Since there are some nuanced differences
between regular and MSA floating point exception handling, provide two
instances of the conversion function, rather than just a single common
one. Inline both instances of this function instances for the sake of
performance. Improve variable naming in surrounding code for clarity.

Reviewed-by: Aleksandar Rikalo <[email protected]>
Signed-off-by: Aleksandar Markovic <[email protected]>
Message-Id: <20200518200920[email protected]>

4 years agotarget/mips: fpu: Name better paired-single variables
Aleksandar Markovic [Mon, 18 May 2020 20:09:14 +0000 (22:09 +0200)]
target/mips: fpu: Name better paired-single variables

Use consistently 'l' and 'h' for low and high halves.

Reviewed-by: Aleksandar Rikalo <[email protected]>
Signed-off-by: Aleksandar Markovic <[email protected]>
Message-Id: <20200518200920[email protected]>

4 years agotarget/mips: fpu: Remove now unused FLOAT_RINT macro
Aleksandar Markovic [Mon, 18 May 2020 20:09:13 +0000 (22:09 +0200)]
target/mips: fpu: Remove now unused FLOAT_RINT macro

After demacroing RINT.<D|S>, this macro is not needed anymore.

Reviewed-by: Aleksandar Rikalo <[email protected]>
Signed-off-by: Aleksandar Markovic <[email protected]>
Message-Id: <20200518200920[email protected]>

4 years agotarget/mips: fpu: Demacro RINT.<D|S>
Aleksandar Markovic [Mon, 18 May 2020 20:09:12 +0000 (22:09 +0200)]
target/mips: fpu: Demacro RINT.<D|S>

This is just a cosmetic change to enable tools like gcov, gdb,
callgrind, etc. to better display involved source code.

Reviewed-by: Aleksandar Rikalo <[email protected]>
Signed-off-by: Aleksandar Markovic <[email protected]>
Message-Id: <20200518200920[email protected]>

4 years agotarget/mips: fpu: Remove now unused FLOAT_CLASS macro
Aleksandar Markovic [Mon, 18 May 2020 20:09:11 +0000 (22:09 +0200)]
target/mips: fpu: Remove now unused FLOAT_CLASS macro

After demacroing CLASS.<D|S>, this macro is not needed anymore.

Reviewed-by: Aleksandar Rikalo <[email protected]>
Signed-off-by: Aleksandar Markovic <[email protected]>
Message-Id: <20200518200920[email protected]>

4 years agotarget/mips: fpu: Demacro CLASS.<D|S>
Aleksandar Markovic [Mon, 18 May 2020 20:09:10 +0000 (22:09 +0200)]
target/mips: fpu: Demacro CLASS.<D|S>

This is just a cosmetic change to enable tools like gcov, gdb,
callgrind, etc. to better display involved source code.

Reviewed-by: Aleksandar Rikalo <[email protected]>
Signed-off-by: Aleksandar Markovic <[email protected]>
Message-Id: <20200518200920[email protected]>

4 years agotarget/mips: fpu: Remove now unused UNFUSED_FMA and FLOAT_FMA macros
Aleksandar Markovic [Mon, 18 May 2020 20:09:09 +0000 (22:09 +0200)]
target/mips: fpu: Remove now unused UNFUSED_FMA and FLOAT_FMA macros

After demacroing <MADD|MSUB|NMADD|NMSUB>.<D|S|PS>, these macros
are not needed anymore.

Reviewed-by: Aleksandar Rikalo <[email protected]>
Signed-off-by: Aleksandar Markovic <[email protected]>
Message-Id: <20200518200920[email protected]>

4 years agotarget/mips: fpu: Demacro NMSUB.<D|S|PS>
Aleksandar Markovic [Mon, 18 May 2020 20:09:08 +0000 (22:09 +0200)]
target/mips: fpu: Demacro NMSUB.<D|S|PS>

This is just a cosmetic change to enable tools like gcov, gdb,
callgrind, etc. to better display involved source code.

Reviewed-by: Aleksandar Rikalo <[email protected]>
Signed-off-by: Aleksandar Markovic <[email protected]>
Message-Id: <20200518200920[email protected]>

4 years agotarget/mips: fpu: Demacro NMADD.<D|S|PS>
Aleksandar Markovic [Mon, 18 May 2020 20:09:07 +0000 (22:09 +0200)]
target/mips: fpu: Demacro NMADD.<D|S|PS>

This is just a cosmetic change to enable tools like gcov, gdb,
callgrind, etc. to better display involved source code.

Reviewed-by: Aleksandar Rikalo <[email protected]>
Signed-off-by: Aleksandar Markovic <[email protected]>
Message-Id: <20200518200920[email protected]>

4 years agotarget/mips: fpu: Demacro MSUB.<D|S|PS>
Aleksandar Markovic [Mon, 18 May 2020 20:09:06 +0000 (22:09 +0200)]
target/mips: fpu: Demacro MSUB.<D|S|PS>

This is just a cosmetic change to enable tools like gcov, gdb,
callgrind, etc. to better display involved source code.

Reviewed-by: Aleksandar Rikalo <[email protected]>
Signed-off-by: Aleksandar Markovic <[email protected]>
Message-Id: <20200518200920[email protected]>

4 years agotarget/mips: fpu: Demacro MADD.<D|S|PS>
Aleksandar Markovic [Mon, 18 May 2020 20:09:05 +0000 (22:09 +0200)]
target/mips: fpu: Demacro MADD.<D|S|PS>

This is just a cosmetic change to enable tools like gcov, gdb,
callgrind, etc. to better display involved source code.

Reviewed-by: Aleksandar Rikalo <[email protected]>
Signed-off-by: Aleksandar Markovic <[email protected]>
Message-Id: <20200518200920[email protected]>

4 years agotarget/mips: fpu: Remove now unused macro FLOAT_BINOP
Aleksandar Markovic [Mon, 18 May 2020 20:09:04 +0000 (22:09 +0200)]
target/mips: fpu: Remove now unused macro FLOAT_BINOP

After demacroing <ADD|SUB|MUL|DIV>.<D|S|PS>, this macro is not
needed anymore.

Reviewed-by: Aleksandar Rikalo <[email protected]>
Signed-off-by: Aleksandar Markovic <[email protected]>
Message-Id: <20200518200920[email protected]>

4 years agotarget/mips: fpu: Demacro DIV.<D|S|PS>
Aleksandar Markovic [Mon, 18 May 2020 20:09:03 +0000 (22:09 +0200)]
target/mips: fpu: Demacro DIV.<D|S|PS>

This is just a cosmetic change to enable tools like gcov, gdb,
callgrind, etc. to better display involved source code.

Reviewed-by: Aleksandar Rikalo <[email protected]>
Signed-off-by: Aleksandar Markovic <[email protected]>
Message-Id: <20200518200920[email protected]>

4 years agotarget/mips: fpu: Demacro MUL.<D|S|PS>
Aleksandar Markovic [Mon, 18 May 2020 20:09:02 +0000 (22:09 +0200)]
target/mips: fpu: Demacro MUL.<D|S|PS>

This is just a cosmetic change to enable tools like gcov, gdb,
callgrind, etc. to better display involved source code.

Reviewed-by: Aleksandar Rikalo <[email protected]>
Signed-off-by: Aleksandar Markovic <[email protected]>
Message-Id: <20200518200920[email protected]>

4 years agotarget/mips: fpu: Demacro SUB.<D|S|PS>
Aleksandar Markovic [Mon, 18 May 2020 20:09:01 +0000 (22:09 +0200)]
target/mips: fpu: Demacro SUB.<D|S|PS>

This is just a cosmetic change to enable tools like gcov, gdb,
callgrind, etc. to better display involved source code.

Reviewed-by: Aleksandar Rikalo <[email protected]>
Signed-off-by: Aleksandar Markovic <[email protected]>
Message-Id: <20200518200920[email protected]>

4 years agotarget/mips: fpu: Demacro ADD.<D|S|PS>
Aleksandar Markovic [Mon, 18 May 2020 20:09:00 +0000 (22:09 +0200)]
target/mips: fpu: Demacro ADD.<D|S|PS>

This is just a cosmetic change to enable tools like gcov, gdb,
callgrind, etc. to better display involved source code.

Reviewed-by: Aleksandar Rikalo <[email protected]>
Signed-off-by: Aleksandar Markovic <[email protected]>
Message-Id: <20200518200920[email protected]>

4 years agomailmap: Change email address of Stefan Brankovic
Aleksandar Markovic [Tue, 2 Jun 2020 08:52:15 +0000 (10:52 +0200)]
mailmap: Change email address of Stefan Brankovic

Stefan Brankovic wants to use his new email address for his future
work in QEMU.

CC: Stefan Brankovic <[email protected]>
Signed-off-by: Aleksandar Markovic <[email protected]>
Reviewed-by: Stefan Brankovic <[email protected]>
Message-Id: <20200602085215[email protected]>

4 years agomailmap: Change email address of Filip Bozuta
Aleksandar Markovic [Tue, 2 Jun 2020 08:52:14 +0000 (10:52 +0200)]
mailmap: Change email address of Filip Bozuta

Filip Bozuta wants to use his new email address for his future
work in QEMU.

CC: Filip Bozuta <[email protected]>
Signed-off-by: Aleksandar Markovic <[email protected]>
Reviewed-by: Filip Bozuta <[email protected]>
Message-Id: <20200602085215[email protected]>

4 years agotarget/sparc/int32_helper: Extract and use excp_name_str()
Philippe Mathieu-Daudé [Tue, 31 Mar 2020 09:49:11 +0000 (11:49 +0200)]
target/sparc/int32_helper: Extract and use excp_name_str()

Improve exception error report:

Before:

  qemu: fatal: Trap 0x06 while interrupts disabled, Error state

After:

  qemu: fatal: Trap 0x06 (Window Underflow) while interrupts disabled, Error state

Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: KONRAD Frederic <[email protected]>
Message-Id: <20200331105048[email protected]>

4 years agotarget/sparc/int32_helper: Remove DEBUG_PCALL definition
Philippe Mathieu-Daudé [Tue, 31 Mar 2020 09:38:15 +0000 (11:38 +0200)]
target/sparc/int32_helper: Remove DEBUG_PCALL definition

We define DEBUG_PCALL since b884fc5e (2012-10-06).
7.5 years later it is safe to assume we can remove it :)

Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: KONRAD Frederic <[email protected]>
Message-Id: <20200331105048[email protected]>

4 years agohw/timer/grlib_gptimer: Display frequency in decimal
Philippe Mathieu-Daudé [Tue, 31 Mar 2020 09:38:01 +0000 (11:38 +0200)]
hw/timer/grlib_gptimer: Display frequency in decimal

Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: KONRAD Frederic <[email protected]>
Message-Id: <20200331105048[email protected]>

4 years agohw/misc/grlib_ahb_apb_pnp: Add trace events on read accesses
Philippe Mathieu-Daudé [Tue, 31 Mar 2020 10:02:47 +0000 (12:02 +0200)]
hw/misc/grlib_ahb_apb_pnp: Add trace events on read accesses

Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: KONRAD Frederic <[email protected]>
Message-Id: <20200331105048[email protected]>

4 years agohw/misc/grlib_ahb_apb_pnp: Fix AHB PnP 8-bit accesses
Philippe Mathieu-Daudé [Tue, 31 Mar 2020 09:59:49 +0000 (11:59 +0200)]
hw/misc/grlib_ahb_apb_pnp: Fix AHB PnP 8-bit accesses

The Plug & Play region of the AHB/APB bridge can be accessed
by various word size, however the implementation is clearly
restricted to 32-bit:

  static uint64_t grlib_ahb_pnp_read(void *opaque, hwaddr offset, unsigned size)
  {
      AHBPnp *ahb_pnp = GRLIB_AHB_PNP(opaque);

      return ahb_pnp->regs[offset >> 2];
  }

Similarly to commit 0fbe394a64 with the APB PnP registers,
set the MemoryRegionOps::impl min/max fields to 32-bit, so
memory.c::access_with_adjusted_size() can adjust when the
access is not 32-bit.

Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: KONRAD Frederic <[email protected]>
Message-Id: <20200331105048[email protected]>

4 years agohw/misc/grlib_ahb_apb_pnp: Avoid crash when writing to AHB PnP registers
Philippe Mathieu-Daudé [Tue, 31 Mar 2020 09:56:22 +0000 (11:56 +0200)]
hw/misc/grlib_ahb_apb_pnp: Avoid crash when writing to AHB PnP registers

Similarly to commit 158b659451 with the APB PnP registers, guests
can crash QEMU when writting to the AHB PnP registers:

  $ echo 'writeb 0xfffff042 69' | qemu-system-sparc -M leon3_generic -S -bios /etc/magic -qtest stdio
  [I 1571938309.932255] OPENED
  [R +0.063474] writeb 0xfffff042 69
  Segmentation fault (core dumped)

  (gdb) bt
  #0  0x0000000000000000 in  ()
  #1  0x0000562999110df4 in memory_region_write_with_attrs_accessor
      (mr=mr@entry=0x56299aa28ea0, addr=66, value=value@entry=0x7fff6abe13b8, size=size@entry=1, shift=<optimized out>, mask=mask@entry=255, attrs=...) at memory.c:503
  #2  0x000056299911095e in access_with_adjusted_size
      (addr=addr@entry=66, value=value@entry=0x7fff6abe13b8, size=size@entry=1, access_size_min=<optimized out>, access_size_max=<optimized out>, access_fn=access_fn@entry=
      0x562999110d70 <memory_region_write_with_attrs_accessor>, mr=0x56299aa28ea0, attrs=...) at memory.c:539
  #3  0x0000562999114fba in memory_region_dispatch_write (mr=mr@entry=0x56299aa28ea0, addr=66, data=<optimized out>, op=<optimized out>, attrs=attrs@entry=...) at memory.c:1482
  #4  0x00005629990c0860 in flatview_write_continue
      (fv=fv@entry=0x56299aa7d8a0, addr=addr@entry=4294963266, attrs=..., ptr=ptr@entry=0x7fff6abe1540, len=len@entry=1, addr1=<optimized out>, l=<optimized out>, mr=0x56299aa28ea0)
      at include/qemu/host-utils.h:164
  #5  0x00005629990c0a76 in flatview_write (fv=0x56299aa7d8a0, addr=4294963266, attrs=..., buf=0x7fff6abe1540, len=1) at exec.c:3165
  #6  0x00005629990c4c1b in address_space_write (as=<optimized out>, addr=<optimized out>, attrs=..., attrs@entry=..., buf=buf@entry=0x7fff6abe1540, len=len@entry=1) at exec.c:3256
  #7  0x000056299910f807 in qtest_process_command (chr=chr@entry=0x5629995ee920 <qtest_chr>, words=words@entry=0x56299acfcfa0) at qtest.c:437

Instead of crashing, log the access as unimplemented.

Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: KONRAD Frederic <[email protected]>
Message-Id: <20200331105048[email protected]>

4 years agohw/sparc64/niagara: Remove duplicated NIAGARA_UART_BASE definition
Philippe Mathieu-Daudé [Mon, 8 Jun 2020 17:14:37 +0000 (19:14 +0200)]
hw/sparc64/niagara: Remove duplicated NIAGARA_UART_BASE definition

NIAGARA_UART_BASE is already defined few lines earlier.

Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Artyom Tarasenko <[email protected]>
Message-Id: <20200608172144[email protected]>

4 years agohw/sparc64/niagara: Map the UART device unconditionally
Philippe Mathieu-Daudé [Sun, 1 Dec 2019 20:35:24 +0000 (21:35 +0100)]
hw/sparc64/niagara: Map the UART device unconditionally

The UART is present on the machine regardless there is a
character device connected to it. Map it unconditionally.

Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Artyom Tarasenko <[email protected]>
Message-Id: <20200608172144[email protected]>

4 years agohw/sparc/leon3: Map the UART device unconditionally
Philippe Mathieu-Daudé [Sun, 1 Dec 2019 20:35:24 +0000 (21:35 +0100)]
hw/sparc/leon3: Map the UART device unconditionally

The UART is present on the chipset regardless there is a
character device connected to it. Map it unconditionally.

Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
Acked-by: Artyom Tarasenko <[email protected]>
Reviewed-by: KONRAD Frederic <[email protected]>
Message-Id: <20200608172144[email protected]>

4 years agohw/misc/empty_slot: Name the slots when created
Philippe Mathieu-Daudé [Mon, 24 Jun 2019 16:55:47 +0000 (18:55 +0200)]
hw/misc/empty_slot: Name the slots when created

Directly set the slot name when creating the device,
to display the device name in trace events.

Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
Acked-by: Artyom Tarasenko <[email protected]>
Message-Id: <20200510152840[email protected]>

4 years agohw/misc/empty_slot: Move the 'hw/misc' and cover in MAINTAINERS
Philippe Mathieu-Daudé [Mon, 24 Jun 2019 15:17:32 +0000 (17:17 +0200)]
hw/misc/empty_slot: Move the 'hw/misc' and cover in MAINTAINERS

Add an entry for the 'empty_slot' device.

Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
Acked-by: Artyom Tarasenko <[email protected]>
Message-Id: <20200510152840[email protected]>

4 years agohw/misc/empty_slot: Convert debug printf() to trace event
Philippe Mathieu-Daudé [Mon, 24 Jun 2019 15:23:48 +0000 (17:23 +0200)]
hw/misc/empty_slot: Convert debug printf() to trace event

Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
Acked-by: Artyom Tarasenko <[email protected]>
Message-Id: <20200510152840[email protected]>

4 years agohw/misc/empty_slot: Add a 'name' qdev property
Philippe Mathieu-Daudé [Mon, 24 Jun 2019 15:23:31 +0000 (17:23 +0200)]
hw/misc/empty_slot: Add a 'name' qdev property

Add a 'name' qdev property so when multiple slots are
accessed, we can notice which one is accessed.

Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
Acked-by: Artyom Tarasenko <[email protected]>
Message-Id: <20200510152840[email protected]>

4 years agohw/misc/empty_slot: Convert 'size' field as qdev property
Philippe Mathieu-Daudé [Mon, 24 Jun 2019 15:19:22 +0000 (17:19 +0200)]
hw/misc/empty_slot: Convert 'size' field as qdev property

Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
Acked-by: Artyom Tarasenko <[email protected]>
Message-Id: <20200510152840[email protected]>

4 years agohw/misc/empty_slot: Lower address space priority
Philippe Mathieu-Daudé [Mon, 24 Jun 2019 15:20:37 +0000 (17:20 +0200)]
hw/misc/empty_slot: Lower address space priority

Empty slots model RAZ/WI access on a bus. Since we can still
(hot) plug devices on the bus, lower the slot priority, so
device added later is accessed first.

Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
Acked-by: Artyom Tarasenko <[email protected]>
Message-Id: <20200510152840[email protected]>

4 years agohw/sparc/sun4m: Use UnimplementedDevice for I/O devices
Philippe Mathieu-Daudé [Mon, 1 Oct 2018 20:27:22 +0000 (22:27 +0200)]
hw/sparc/sun4m: Use UnimplementedDevice for I/O devices

These devices are not slots on a bus, but real I/O devices
that we do not implement. As the ISDN ROM would be a ROMD
device, also model it as UnimplementedDevice.

Reviewed-by: Artyom Tarasenko <[email protected]>
Message-Id: <20200510152840[email protected]>
Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
4 years agotests/decode: Test non-overlapping groups
Richard Henderson [Tue, 2 Jun 2020 23:13:28 +0000 (16:13 -0700)]
tests/decode: Test non-overlapping groups

Reviewed-by: Peter Maydell <[email protected]>
Signed-off-by: Richard Henderson <[email protected]>
4 years agodecodetree: Implement non-overlapping groups
Richard Henderson [Mon, 18 May 2020 15:45:32 +0000 (08:45 -0700)]
decodetree: Implement non-overlapping groups

Intended to be nested within overlapping groups.

Reviewed-by: Peter Maydell <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Suggested-by: Peter Maydell <[email protected]>
Signed-off-by: Richard Henderson <[email protected]>
4 years agodecodetree: Move semantic propagation into classes
Richard Henderson [Sun, 17 May 2020 17:14:11 +0000 (10:14 -0700)]
decodetree: Move semantic propagation into classes

Create ExcMultiPattern to hold an set of non-overlapping patterns.
The body of build_tree, prop_format become member functions on this
class.  Add minimal member functions to Pattern and MultiPattern
to allow recusion through the tree.

Move the bulk of build_incmulti_pattern to prop_masks and prop_width
in MultiPattern, since we will need this for both kinds of containers.
Only perform prop_width for variablewidth.

Remove global patterns variable, and pass down container object into
parse_file from main.

No functional change in all of this.

Reviewed-by: Peter Maydell <[email protected]>
Signed-off-by: Richard Henderson <[email protected]>
4 years agodecodetree: Allow group covering the entire insn space
Richard Henderson [Sat, 16 May 2020 20:15:02 +0000 (13:15 -0700)]
decodetree: Allow group covering the entire insn space

This is an edge case for sure, but the logic that disallowed
this case was faulty.  Further, a few fixes scattered about
can allow this to work.

Reviewed-by: Peter Maydell <[email protected]>
Signed-off-by: Richard Henderson <[email protected]>
4 years agodecodetree: Split out MultiPattern from IncMultiPattern
Richard Henderson [Sat, 16 May 2020 18:19:45 +0000 (11:19 -0700)]
decodetree: Split out MultiPattern from IncMultiPattern

Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: Richard Henderson <[email protected]>
4 years agodecodetree: Rename MultiPattern to IncMultiPattern
Richard Henderson [Sat, 16 May 2020 17:50:43 +0000 (10:50 -0700)]
decodetree: Rename MultiPattern to IncMultiPattern

Name the current node for "inclusive" multi-pattern, in
preparation for adding a node for "exclusive" multi-pattern.

Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: Richard Henderson <[email protected]>
4 years agodecodetree: Tidy error_with_file
Richard Henderson [Fri, 15 May 2020 21:48:54 +0000 (14:48 -0700)]
decodetree: Tidy error_with_file

Use proper varargs to print the arguments.

Reviewed-by: Peter Maydell <[email protected]>
Signed-off-by: Richard Henderson <[email protected]>
4 years agoscripts/coverity-scan: Remove flex/bison packages
Philippe Mathieu-Daudé [Fri, 15 May 2020 16:30:29 +0000 (18:30 +0200)]
scripts/coverity-scan: Remove flex/bison packages

QEMU does not use flex/bison packages.

Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Claudio Fontana <[email protected]>
Signed-off-by: Alex Bennée <[email protected]>
Message-Id: <20200515163029[email protected]>

4 years agocirrus-ci: Remove flex/bison packages
Philippe Mathieu-Daudé [Fri, 15 May 2020 16:30:28 +0000 (18:30 +0200)]
cirrus-ci: Remove flex/bison packages

QEMU does not use flex/bison packages.

Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Li-Wen Hsu <[email protected]>
Signed-off-by: Alex Bennée <[email protected]>
Message-Id: <20200515163029[email protected]>

4 years agotests/vm: Remove flex/bison packages
Philippe Mathieu-Daudé [Fri, 15 May 2020 16:30:26 +0000 (18:30 +0200)]
tests/vm: Remove flex/bison packages

QEMU does not use flex/bison packages.

Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Claudio Fontana <[email protected]>
Signed-off-by: Alex Bennée <[email protected]>
Message-Id: <20200515163029[email protected]>

4 years agotests/docker: Remove flex/bison packages
Philippe Mathieu-Daudé [Fri, 15 May 2020 16:30:25 +0000 (18:30 +0200)]
tests/docker: Remove flex/bison packages

QEMU does not use flex/bison packages.

Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Claudio Fontana <[email protected]>
Signed-off-by: Alex Bennée <[email protected]>
Message-Id: <20200515163029[email protected]>

4 years agolinux-user: detect overflow of MAP_FIXED mmap
Alex Bennée [Fri, 5 Jun 2020 15:49:29 +0000 (16:49 +0100)]
linux-user: detect overflow of MAP_FIXED mmap

Relaxing the restrictions on 64 bit guests leads to the user being
able to attempt to map right at the edge of addressable memory. This
in turn lead to address overflow tripping the assert in page_set_flags
when the end address wrapped around.

Detect the wrap earlier and correctly -ENOMEM the guest (in the
reported case LTP mmap15).

Fixes: 7d8cbbabcb
Signed-off-by: Alex Bennée <[email protected]>
Reported-by: Laurent Vivier <[email protected]>
Message-Id: <20200605154929[email protected]>

4 years agotests/tcg: add simple commpage test case
Alex Bennée [Fri, 5 Jun 2020 15:49:28 +0000 (16:49 +0100)]
tests/tcg: add simple commpage test case

The COMMPAGE are a number of kernel provided user-space routines for
32 bit ARM systems. Add a basic series of smoke tests to ensure it is
working as it should.

Signed-off-by: Alex Bennée <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Message-Id: <20200605154929[email protected]>

4 years agolinux-user: deal with address wrap for ARM_COMMPAGE on 32 bit
Alex Bennée [Fri, 5 Jun 2020 15:49:27 +0000 (16:49 +0100)]
linux-user: deal with address wrap for ARM_COMMPAGE on 32 bit

We rely on the pointer to wrap when accessing the high address of the
COMMPAGE so it lands somewhere reasonable. However on 32 bit hosts we
cannot afford just to map the entire 4gb address range. The old mmap
trial and error code handled this by just checking we could map both
the guest_base and the computed COMMPAGE address.

We can't just manipulate loadaddr to get what we want so we introduce
an offset which pgb_find_hole can apply when looking for a gap for
guest_base that ensures there is space left to map the COMMPAGE
afterwards.

This is arguably a little inefficient for the one 32 bit
value (kuser_helper_version) we need to keep there given all the
actual code entries are picked up during the translation phase.

Fixes: ee94743034b
Bug: https://bugs.launchpad.net/qemu/+bug/1880225
Cc: Bug 1880225 <[email protected]>
Signed-off-by: Alex Bennée <[email protected]>
Tested-by: Aleksandar Markovic <[email protected]>
Cc: Richard Henderson <[email protected]>
Cc: Peter Maydell <[email protected]>
Message-Id: <20200605154929[email protected]>

4 years agolinux-user: provide fallback pgd_find_hole for bare chroots
Alex Bennée [Fri, 5 Jun 2020 15:49:26 +0000 (16:49 +0100)]
linux-user: provide fallback pgd_find_hole for bare chroots

When running QEMU out of a chroot environment we may not have access
to /proc/self/maps. As there is no other "official" way to introspect
our memory map we need to fall back to the original technique of
repeatedly trying to mmap an address range until we find one that
works.

Fortunately it's not quite as ugly as the original code given we
already re-factored the complications of dealing with the
ARM_COMMPAGE. We do make an attempt to skip over brk() which is about
the only concrete piece of information we have about the address map
at this moment.

Fixes: ee9474303
Reported-by: Peter Maydell <[email protected]>
Signed-off-by: Alex Bennée <[email protected]>
Message-Id: <20200605154929[email protected]>

4 years agohw/virtio/vhost: re-factor vhost-section and allow DIRTY_MEMORY_CODE
Alex Bennée [Fri, 5 Jun 2020 15:49:25 +0000 (16:49 +0100)]
hw/virtio/vhost: re-factor vhost-section and allow DIRTY_MEMORY_CODE

The purpose of vhost_section is to identify RAM regions that need to
be made available to a vhost client. However when running under TCG
all RAM sections have DIRTY_MEMORY_CODE set which leads to problems
down the line.

Re-factor the code so:

  - steps are clearer to follow
  - reason for rejection is recorded in the trace point
  - we allow DIRTY_MEMORY_CODE

We expand the comment to explain that kernel based vhost has specific
support for migration tracking.

Signed-off-by: Alex Bennée <[email protected]>
Tested-by: Fabiano Rosas <[email protected]>
Cc: Michael S. Tsirkin <[email protected]>
Cc: Dr. David Alan Gilbert <[email protected]>
Cc: Stefan Hajnoczi <[email protected]>
Message-Id: <20200605154929[email protected]>

4 years agodocker: update Ubuntu to 20.04
Paolo Bonzini [Fri, 5 Jun 2020 15:49:24 +0000 (16:49 +0100)]
docker: update Ubuntu to 20.04

Signed-off-by: Paolo Bonzini <[email protected]>
Tested-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: Alex Bennée <[email protected]>
Message-Id: <20200604231716[email protected]>
Message-Id: <20200605154929[email protected]>

4 years agotests/docker: fix pre-requisite for debian-tricore-cross
Alex Bennée [Fri, 5 Jun 2020 15:49:23 +0000 (16:49 +0100)]
tests/docker: fix pre-requisite for debian-tricore-cross

Reported-by: Bastian Koppelmann <[email protected]>
Signed-off-by: Alex Bennée <[email protected]>
Message-Id: <20200605154929[email protected]>

4 years ago.shippable: temporaily disable some cross builds
Alex Bennée [Fri, 5 Jun 2020 15:49:21 +0000 (16:49 +0100)]
.shippable: temporaily disable some cross builds

These currently fail due to Debian bug #960271 as the
linux-libc-library has a user-space build breaking symbol in it.

Signed-off-by: Alex Bennée <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Tested-by: Philippe Mathieu-Daudé <[email protected]>
Message-Id: <20200605154929[email protected]>

4 years ago.travis.yml: allow failure for unreliable hosts
Alex Bennée [Fri, 5 Jun 2020 15:49:20 +0000 (16:49 +0100)]
.travis.yml: allow failure for unreliable hosts

They will still run but they won't get in the way of the result.

Signed-off-by: Alex Bennée <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Tested-by: Philippe Mathieu-Daudé <[email protected]>
Message-Id: <20200605154929[email protected]>

4 years agoexec: flush the whole TLB if a watchpoint crosses a page boundary
Alex Bennée [Fri, 5 Jun 2020 15:49:19 +0000 (16:49 +0100)]
exec: flush the whole TLB if a watchpoint crosses a page boundary

There is no particular reason why you can't have a watchpoint in TCG
that covers a large chunk of the address space. We could be clever
about it but these cases are pretty rare and we can assume the user
will expect a little performance degradation.

NB: In my testing gdb will silently squash a watchpoint like:

  watch (char[0x7fffffffff]) *0x0

to a 4 byte watchpoint. Practically it will limit the maximum size
based on max-value-size. However given enough of a tweak the sky is
the limit.

Reported-by: Alexander Bulekov <[email protected]>
Signed-off-by: Alex Bennée <[email protected]>
Reviewed-by: Richard Henderson <[email protected]>
Message-Id: <20200605154929[email protected]>

4 years agotests/plugin: correctly honour io_count
Alex Bennée [Fri, 5 Jun 2020 15:49:18 +0000 (16:49 +0100)]
tests/plugin: correctly honour io_count

Signed-off-by: Alex Bennée <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Message-Id: <20200605154929[email protected]>

4 years agoscripts/clean-includes: Mark 'qemu/qemu-plugin.h' as special header
Philippe Mathieu-Daudé [Fri, 5 Jun 2020 15:49:17 +0000 (16:49 +0100)]
scripts/clean-includes: Mark 'qemu/qemu-plugin.h' as special header

"qemu/qemu-plugin.h" isn't meant to be include by QEMU codebase,
but by 3rd party plugins that QEMU can use. These plugins can be
built out of QEMU and don't include "qemu/osdep.h".
Mark "qemu/qemu-plugin.h" as a special header that doesn't need
to be cleaned for "qemu/osdep.h".

Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Emilio G. Cota <[email protected]>
Signed-off-by: Alex Bennée <[email protected]>
Message-Id: <20200524215654[email protected]>
Message-Id: <20200605154929[email protected]>

4 years agoqemu-plugin.h: add missing include <stddef.h> to define size_t
Emilio G. Cota [Fri, 5 Jun 2020 15:49:16 +0000 (16:49 +0100)]
qemu-plugin.h: add missing include <stddef.h> to define size_t

Signed-off-by: Emilio G. Cota <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Signed-off-by: Alex Bennée <[email protected]>
Message-Id: <20200524202427[email protected]>
Message-Id: <20200605154929[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]>
This page took 0.093619 seconds and 4 git commands to generate.