OSDN Git Service

qmiga/qemu.git
2 years agopnv_phb4.c: add unique chassis and slot for pnv_phb4_root_port
Daniel Henrique Barboza [Wed, 12 Jan 2022 10:28:27 +0000 (11:28 +0100)]
pnv_phb4.c: add unique chassis and slot for pnv_phb4_root_port

A similar situation as described previously with pnv_phb3_root_port
devices also happens with pnv_phb4_root_ports.

The solution is the same: assign an unique chassis/slot combo for them.

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Message-Id: <20220105212338.49899-3-danielhb413@gmail.com>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
2 years agopnv_phb3.c: add unique chassis and slot for pnv_phb3_root_port
Daniel Henrique Barboza [Wed, 12 Jan 2022 10:28:27 +0000 (11:28 +0100)]
pnv_phb3.c: add unique chassis and slot for pnv_phb3_root_port

When creating a pnv_phb3_root_port using the command line, the first
root port is created successfully, but the second fails with the
following error:

qemu-system-ppc64: -device pnv-phb3-root-port,bus=phb3-root.0,id=pcie.3:
Can't add chassis slot, error -16

This error comes from the realize() function of its parent type,
rp_realize() from TYPE_PCIE_ROOT_PORT. pcie_chassis_add_slot() fails
with -EBUSY if there's an existing PCIESlot that has the same
chassis/slot value, regardless of being in a different bus.

One way to prevent this error is simply set chassis and slot values in
the command line. However, since phb3 root buses only supports a single
root port, we can just get an unique chassis/slot value by checking
which root bus the pnv_phb3_root_port is going to be attached, get the
equivalent phb3 device and use its chip-id and index values, which are
guaranteed to be unique.

Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Message-Id: <20220105212338.49899-2-danielhb413@gmail.com>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
2 years agotarget/ppc: Set the correct endianness for powernv memory dumps
Fabiano Rosas [Wed, 12 Jan 2022 10:28:27 +0000 (11:28 +0100)]
target/ppc: Set the correct endianness for powernv memory dumps

We use the endianness of interrupts to determine which endianness to
use for the guest kernel memory dump. For machines that support HILE
(powernv8 and up) we have been always generating big endian dump
files.

This patch uses the HILE support recently added to
ppc_interrupts_little_endian to fix the endianness of the dumps for
powernv machines.

Here are two dumps created at different moments:

$ file skiboot.dump
skiboot.dump: ELF 64-bit MSB core file, 64-bit PowerPC ...

$ file kernel.dump
kernel.dump: ELF 64-bit LSB core file, 64-bit PowerPC ...

Suggested-by: David Gibson <david@gibson.dropbear.id.au>
Signed-off-by: Fabiano Rosas <farosas@linux.ibm.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Message-Id: <20220107222601.4101511-9-farosas@linux.ibm.com>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
2 years agotarget/ppc: Introduce a wrapper for powerpc_excp
Fabiano Rosas [Wed, 12 Jan 2022 10:28:27 +0000 (11:28 +0100)]
target/ppc: Introduce a wrapper for powerpc_excp

Next patches will split powerpc_excp in multiple family specific
handlers. This patch adds a wrapper to make the transition clearer.

Signed-off-by: Fabiano Rosas <farosas@linux.ibm.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Message-Id: <20220107222601.4101511-8-farosas@linux.ibm.com>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
2 years agotarget/ppc: Use ppc_interrupts_little_endian in powerpc_excp
Fabiano Rosas [Wed, 12 Jan 2022 10:28:27 +0000 (11:28 +0100)]
target/ppc: Use ppc_interrupts_little_endian in powerpc_excp

The ppc_interrupts_little_endian function is now suitable for
determining the endianness of interrupts for all CPUs.

Signed-off-by: Fabiano Rosas <farosas@linux.ibm.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Message-Id: <20220107222601.4101511-7-farosas@linux.ibm.com>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
2 years agotarget/ppc: Add MSR_ILE support to ppc_interrupts_little_endian
Fabiano Rosas [Wed, 12 Jan 2022 10:28:27 +0000 (11:28 +0100)]
target/ppc: Add MSR_ILE support to ppc_interrupts_little_endian

Some CPUs set ILE via an MSR bit. We can make
ppc_interrupts_little_endian handle that case as well. Now we have a
centralized way of determining the endianness of interrupts.

This change has no functional impact.

Signed-off-by: Fabiano Rosas <farosas@linux.ibm.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Message-Id: <20220107222601.4101511-6-farosas@linux.ibm.com>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
2 years agotarget/ppc: Add HV support to ppc_interrupts_little_endian
Fabiano Rosas [Wed, 12 Jan 2022 10:28:27 +0000 (11:28 +0100)]
target/ppc: Add HV support to ppc_interrupts_little_endian

The ppc_interrupts_little_endian function could be used for interrupts
delivered in Hypervisor mode, so add support for powernv8 and powernv9
to it.

Also drop the comment because it is inaccurate, all CPUs that can run
little endian can have interrupts in little endian. The point is
whether they can take interrupts in an endianness different from
MSR_LE.

This change has no functional impact.

Signed-off-by: Fabiano Rosas <farosas@linux.ibm.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Message-Id: <20220107222601.4101511-5-farosas@linux.ibm.com>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
2 years agotarget/ppc: powerpc_excp: Group unimplemented exceptions
Fabiano Rosas [Wed, 12 Jan 2022 10:28:27 +0000 (11:28 +0100)]
target/ppc: powerpc_excp: Group unimplemented exceptions

Signed-off-by: Fabiano Rosas <farosas@linux.ibm.com>
Reviewed-by: Cédric Le Goater <clg@kaod.org>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20220107222601.4101511-4-farosas@linux.ibm.com>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
2 years agotarget/ppc: powerpc_excp: Keep 60x/7x5 soft MMU logs active
Fabiano Rosas [Wed, 12 Jan 2022 10:28:26 +0000 (11:28 +0100)]
target/ppc: powerpc_excp: Keep 60x/7x5 soft MMU logs active

Remove the compile time definition and make the logging be controlled
by the `-d mmu` option in the cmdline.

Signed-off-by: Fabiano Rosas <farosas@linux.ibm.com>
Reviewed-by: Cédric Le Goater <clg@kaod.org>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Message-Id: <20220107222601.4101511-3-farosas@linux.ibm.com>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
2 years agotarget/ppc: powerpc_excp: Extract software TLB logging into a function
Fabiano Rosas [Wed, 12 Jan 2022 10:28:26 +0000 (11:28 +0100)]
target/ppc: powerpc_excp: Extract software TLB logging into a function

Signed-off-by: Fabiano Rosas <farosas@linux.ibm.com>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20220107222601.4101511-2-farosas@linux.ibm.com>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
2 years agodocs: Clarifications and formatting changes in ppc docs.
Leonardo Garcia [Wed, 12 Jan 2022 10:28:26 +0000 (11:28 +0100)]
docs: Clarifications and formatting changes in ppc docs.

Signed-off-by: Leonardo Garcia <lagarcia@br.ibm.com>
Reviewed-by: Cédric Le Goater <clg@kaod.org>
Message-Id: <3b228af4785241c7fb4a2c70f0c495d2a9adea83.1641405872.git.lagarcia@br.ibm.com>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
2 years agoMAINTAINERS: Improve the PowerPC machines section
Thomas Huth [Wed, 12 Jan 2022 10:28:26 +0000 (11:28 +0100)]
MAINTAINERS: Improve the PowerPC machines section

Add some documentation files to the corresponding machine sections
and mention the machine names in the section titles where it is
not so obvious (e.g. that "taihu" is a 405 machine).

Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Message-Id: <20220105104800.407570-1-thuth@redhat.com>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
2 years agodocs/system/ppc: Merge the PEF information into the pseries page
Thomas Huth [Wed, 12 Jan 2022 10:28:26 +0000 (11:28 +0100)]
docs/system/ppc: Merge the PEF information into the pseries page

The Protected Execution Facility is only available with the pseries
machine, so let's merge the old ASCII text into the new RST file now.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Message-Id: <20220105103232.405204-1-thuth@redhat.com>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
2 years agotarget/ppc: Add extra float instructions to POWER5P processors
Cédric Le Goater [Wed, 12 Jan 2022 10:28:26 +0000 (11:28 +0100)]
target/ppc: Add extra float instructions to POWER5P processors

ISA v2.03 introduced Floating Round to Integer instructions : frin,
friz, frip, and frim. Add them to POWER5+.

The PPC_FLOAT_EXT flag also includes the fre (Floating Reciprocal
Estimate) instruction which was introduced in ISA v2.0x. The
architecture document says its optional and that might be the reason
why it has been kept under the PPC_FLOAT_EXT flag. This means 970 CPUs
can not use it under QEMU, which doesn't seem to be a problem.

Signed-off-by: Cédric Le Goater <clg@kaod.org>
2 years agospapr: Fix support of POWER5+ processors
Cédric Le Goater [Wed, 12 Jan 2022 10:28:26 +0000 (11:28 +0100)]
spapr: Fix support of POWER5+ processors

POWER5+ (ISA v2.03) processors are supported by the pseries machine
but they do not have Altivec instructions. Do not advertise support
for it in the DT.

To be noted that this test is in contradiction with the assert in
cap_vsx_apply().

Signed-off-by: Cédric Le Goater <clg@kaod.org>
Tested-by: Fabiano Rosas <farosas@linux.ibm.com>
Message-Id: <20220105095142.3990430-3-clg@kaod.org>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
2 years agotarget/ppc: Add popcntb instruction to POWER5+ processors
Cédric Le Goater [Wed, 12 Jan 2022 10:28:26 +0000 (11:28 +0100)]
target/ppc: Add popcntb instruction to POWER5+ processors

popcntb instruction was added in ISA v2.02. Add support for POWER5+
processors since they implement ISA v2.03.

PPC970 CPUs implement v2.01 and do not support popcntb.

Signed-off-by: Cédric Le Goater <clg@kaod.org>
Reviewed-by: Fabiano Rosas <farosas@linux.ibm.com>
Message-Id: <20220105095142.3990430-2-clg@kaod.org>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
2 years agoMerge tag 'qemu-slof-20220110' of github.com:aik/qemu into ppc-7.0
Cédric Le Goater [Wed, 12 Jan 2022 10:27:16 +0000 (11:27 +0100)]
Merge tag 'qemu-slof-20220110' of github.com:aik/qemu into ppc-7.0

* tag 'qemu-slof-20220110' of github.com:aik/qemu:
  pseries: Update SLOF firmware image

Signed-off-by: Cédric Le Goater <clg@kaod.org>
2 years agoMerge remote-tracking branch 'remotes/jsnow-gitlab/tags/python-pull-request' into...
Peter Maydell [Tue, 11 Jan 2022 14:20:42 +0000 (14:20 +0000)]
Merge remote-tracking branch 'remotes/jsnow-gitlab/tags/python-pull-request' into staging

Python pull request

Fixes for the tests that broke during vacation, plus a simple syntax fix
for a python script.

# gpg: Signature made Mon 10 Jan 2022 23:24:47 GMT
# gpg:                using RSA key F9B7ABDBBCACDF95BE76CBD07DEF8106AAFC390E
# gpg: Good signature from "John Snow (John Huston) <jsnow@redhat.com>" [full]
# Primary key fingerprint: FAEB 9711 A12C F475 812F  18F2 88A9 064D 1835 61EB
#      Subkey fingerprint: F9B7 ABDB BCAC DF95 BE76  CBD0 7DEF 8106 AAFC 390E

* remotes/jsnow-gitlab/tags/python-pull-request:
  simplebench: Fix Python syntax error (reported by LGTM)
  python: update type hints for mypy 0.930
  Python/aqmp: fix type definitions for mypy 0.920
  python/aqmp: use absolute import statement

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2 years agoMerge remote-tracking branch 'remotes/philmd/tags/sdmmc-20220108' into staging
Peter Maydell [Tue, 11 Jan 2022 11:39:31 +0000 (11:39 +0000)]
Merge remote-tracking branch 'remotes/philmd/tags/sdmmc-20220108' into staging

SD/MMC patches queue

- Add SDHC support for SD card SPI-mode (Frank Chang)

# gpg: Signature made Sat 08 Jan 2022 21:56:02 GMT
# gpg:                using RSA key FAABE75E12917221DCFD6BB2E3E32C2CDEADC0DE
# gpg: Good signature from "Philippe Mathieu-Daudé (F4BUG) <f4bug@amsat.org>" [unknown]
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: FAAB E75E 1291 7221 DCFD  6BB2 E3E3 2C2C DEAD C0DE

* remotes/philmd/tags/sdmmc-20220108:
  hw/sd: Add SDHC support for SD card SPI-mode
  hw/sd/sdcard: Rename Write Protect Group variables

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2 years agoMerge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging
Peter Maydell [Tue, 11 Jan 2022 10:12:29 +0000 (10:12 +0000)]
Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging

virtio: revert config interrupt changes

Lots of fallout from config interrupt changes. Author wants to rework
the patches. Let's revert quickly so others don't suffer meanwhile.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
# gpg: Signature made Mon 10 Jan 2022 21:03:44 GMT
# gpg:                using RSA key 5D09FD0871C8F85B94CA8A0D281F0DB8D28D5469
# gpg:                issuer "mst@redhat.com"
# gpg: Good signature from "Michael S. Tsirkin <mst@kernel.org>" [full]
# gpg:                 aka "Michael S. Tsirkin <mst@redhat.com>" [full]
# Primary key fingerprint: 0270 606B 6F3C DF3D 0B17  0970 C350 3912 AFBE 8E67
#      Subkey fingerprint: 5D09 FD08 71C8 F85B 94CA  8A0D 281F 0DB8 D28D 5469

* remotes/mst/tags/for_upstream:
  Revert "virtio: introduce macro IRTIO_CONFIG_IRQ_IDX"
  Revert "virtio-pci: decouple notifier from interrupt process"
  Revert "virtio-pci: decouple the single vector from the interrupt process"
  Revert "vhost: introduce new VhostOps vhost_set_config_call"
  Revert "vhost-vdpa: add support for config interrupt"
  Revert "virtio: add support for configure interrupt"
  Revert "vhost: add support for configure interrupt"
  Revert "virtio-net: add support for configure interrupt"
  Revert "virtio-mmio: add support for configure interrupt"
  Revert "virtio-pci: add support for configure interrupt"

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2 years agosimplebench: Fix Python syntax error (reported by LGTM)
Stefan Weil [Fri, 7 Jan 2022 15:30:19 +0000 (16:30 +0100)]
simplebench: Fix Python syntax error (reported by LGTM)

Fixes: b2fcb0c5754c2554b8406376e99a75e9e0a6b7bd
Signed-off-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: John Snow <jsnow@redhat.com>
Message-id: 20220107153019.504124-1-sw@weilnetz.de
Signed-off-by: John Snow <jsnow@redhat.com>
2 years agopython: update type hints for mypy 0.930
John Snow [Mon, 10 Jan 2022 19:13:49 +0000 (14:13 -0500)]
python: update type hints for mypy 0.930

Mypy 0.930, released Dec 22, changes the way argparse objects are
considered. Crafting a definition that works under Python 3.6 and an
older mypy alongside newer versions simultaneously is ... difficult,
so... eh. Stub it out with an 'Any' definition to get the CI moving
again.

Oh well.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Beraldo Leal <bleal@redhat.com>
Message-id: 20220110191349.1841027-4-jsnow@redhat.com
Signed-off-by: John Snow <jsnow@redhat.com>
2 years agoPython/aqmp: fix type definitions for mypy 0.920
John Snow [Mon, 10 Jan 2022 19:13:48 +0000 (14:13 -0500)]
Python/aqmp: fix type definitions for mypy 0.920

0.920 (Released 2021-12-15) is not entirely happy with the
way that I was defining _FutureT:

qemu/aqmp/protocol.py:601: error: Item "object" of the upper bound
"Optional[Future[Any]]" of type variable "_FutureT" has no attribute
"done"

Update it with something a little mechanically simpler that works better
across a wider array of mypy versions.

Signed-off-by: John Snow <jsnow@redhat.com>
Message-id: 20220110191349.1841027-3-jsnow@redhat.com
Signed-off-by: John Snow <jsnow@redhat.com>
2 years agopython/aqmp: use absolute import statement
John Snow [Mon, 10 Jan 2022 19:13:47 +0000 (14:13 -0500)]
python/aqmp: use absolute import statement

pylint's dependency astroid appears to have bugs in 2.9.1 and 2.9.2 (Dec
31 and Jan 3) that appear to erroneously expect the qemu namespace to
have an __init__.py file. astroid 2.9.3 (Jan 9) avoids that problem, but
appears to not understand a relative import within a namespace package.

Update the relative import - it was worth changing anyway, because these
packages will eventually be packaged and distributed separately.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Beraldo Leal <bleal@redhat.com>
Message-id: 20220110191349.1841027-2-jsnow@redhat.com
Signed-off-by: John Snow <jsnow@redhat.com>
2 years agoRevert "virtio: introduce macro IRTIO_CONFIG_IRQ_IDX"
Michael S. Tsirkin [Mon, 10 Jan 2022 05:47:56 +0000 (00:47 -0500)]
Revert "virtio: introduce macro IRTIO_CONFIG_IRQ_IDX"

This reverts commit bf1d85c166c19af95dbd27b1faba1d2909732323.

Fixes: bf1d85c166 ("virtio: introduce macro IRTIO_CONFIG_IRQ_IDX")
Cc: "Cindy Lu" <lulu@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2 years agoRevert "virtio-pci: decouple notifier from interrupt process"
Michael S. Tsirkin [Mon, 10 Jan 2022 05:47:54 +0000 (00:47 -0500)]
Revert "virtio-pci: decouple notifier from interrupt process"

This reverts commit e3480ef81f6fb61cc9c04e3b5be8b7e84484fc05.

Fixes: e3480ef81f ("virtio-pci: decouple notifier from interrupt process")
Cc: "Cindy Lu" <lulu@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2 years agoRevert "virtio-pci: decouple the single vector from the interrupt process"
Michael S. Tsirkin [Mon, 10 Jan 2022 05:47:53 +0000 (00:47 -0500)]
Revert "virtio-pci: decouple the single vector from the interrupt process"

This reverts commit 316011b8a74e777eb3ba03171cd701a291c28867.

Fixes: 316011b8a7 ("virtio-pci: decouple the single vector from the interrupt process")
Cc: "Cindy Lu" <lulu@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2 years agoRevert "vhost: introduce new VhostOps vhost_set_config_call"
Michael S. Tsirkin [Mon, 10 Jan 2022 05:47:52 +0000 (00:47 -0500)]
Revert "vhost: introduce new VhostOps vhost_set_config_call"

This reverts commit 88062372340d33090b7f089ed3b1a00f530a8914.

Fixes: 8806237234 ("vhost: introduce new VhostOps vhost_set_config_call")
Cc: "Cindy Lu" <lulu@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2 years agoRevert "vhost-vdpa: add support for config interrupt"
Michael S. Tsirkin [Mon, 10 Jan 2022 05:47:51 +0000 (00:47 -0500)]
Revert "vhost-vdpa: add support for config interrupt"

This reverts commit 634f7c89fbd78f57d00d5d6b39c0ade9df1fe27f.

Fixes: 634f7c89fb ("vhost-vdpa: add support for config interrupt")
Cc: "Cindy Lu" <lulu@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2 years agoRevert "virtio: add support for configure interrupt"
Michael S. Tsirkin [Mon, 10 Jan 2022 05:47:50 +0000 (00:47 -0500)]
Revert "virtio: add support for configure interrupt"

This reverts commit 081f864f56307551f59c5e934e3f30a7290d0faa.

Fixes: 081f864f56 ("virtio: add support for configure interrupt")
Cc: "Cindy Lu" <lulu@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2 years agoRevert "vhost: add support for configure interrupt"
Michael S. Tsirkin [Mon, 10 Jan 2022 05:47:49 +0000 (00:47 -0500)]
Revert "vhost: add support for configure interrupt"

This reverts commit f7220a7ce21604a4bc6260ccca4dc9068c1f27f2.

Fixes: f7220a7ce2 ("vhost: add support for configure interrupt")
Cc: "Cindy Lu" <lulu@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2 years agoRevert "virtio-net: add support for configure interrupt"
Michael S. Tsirkin [Mon, 10 Jan 2022 05:46:16 +0000 (00:46 -0500)]
Revert "virtio-net: add support for configure interrupt"

This reverts commit 497679d51087090d5a22fd265d1b96cf92d49d9d.

Fixes: 497679d510 ("virtio-net: add support for configure interrupt")
Cc: "Cindy Lu" <lulu@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2 years agoRevert "virtio-mmio: add support for configure interrupt"
Michael S. Tsirkin [Mon, 10 Jan 2022 05:46:15 +0000 (00:46 -0500)]
Revert "virtio-mmio: add support for configure interrupt"

This reverts commit d48185f1a40d4e4ed2fa2873a42b2a5eb8748256.

Fixes: d48185f1a4 ("virtio-mmio: add support for configure interrupt")
Cc: "Cindy Lu" <lulu@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2 years agoRevert "virtio-pci: add support for configure interrupt"
Michael S. Tsirkin [Mon, 10 Jan 2022 05:46:10 +0000 (00:46 -0500)]
Revert "virtio-pci: add support for configure interrupt"

This reverts commit d5d24d859c3957ea1674d0e102f96439cdbfe93a.

Fixes: d5d24d859c ("virtio-pci: add support for configure interrupt")
Cc: "Cindy Lu" <lulu@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2 years agoMerge remote-tracking branch 'remotes/vivier/tags/m68k-for-7.0-pull-request' into...
Peter Maydell [Mon, 10 Jan 2022 14:43:03 +0000 (14:43 +0000)]
Merge remote-tracking branch 'remotes/vivier/tags/m68k-for-7.0-pull-request' into staging

M68k pull request 20220109

Add virt compat machine type for 7.0
fix q800 -bios parameter
fix VRAM refresh
fix M68K_FEATURE_UNALIGNED_DATA feature

# gpg: Signature made Sun 09 Jan 2022 11:41:19 GMT
# gpg:                using RSA key CD2F75DDC8E3A4DC2E4F5173F30C38BD3F2FBE3C
# gpg:                issuer "laurent@vivier.eu"
# gpg: Good signature from "Laurent Vivier <lvivier@redhat.com>" [full]
# gpg:                 aka "Laurent Vivier <laurent@vivier.eu>" [full]
# gpg:                 aka "Laurent Vivier (Red Hat) <lvivier@redhat.com>" [full]
# Primary key fingerprint: CD2F 75DD C8E3 A4DC 2E4F  5173 F30C 38BD 3F2F BE3C

* remotes/vivier/tags/m68k-for-7.0-pull-request:
  target/m68k: don't word align SP in stack frame if M68K_FEATURE_UNALIGNED_DATA feature enabled
  macfb: fix VRAM dirty memory region logging
  q800: fix segfault with invalid MacROM
  hw: m68k: Add virt compat machine type for 7.0

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2 years agopseries: Update SLOF firmware image
Alexey Kardashevskiy [Mon, 10 Jan 2022 04:27:45 +0000 (15:27 +1100)]
pseries: Update SLOF firmware image

The only change is that SLOF is compiled with -mcpu=power5
to make it work on PPC970 too.

Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru>
2 years agotarget/m68k: don't word align SP in stack frame if M68K_FEATURE_UNALIGNED_DATA featur...
Mark Cave-Ayland [Sat, 8 Jan 2022 18:04:53 +0000 (18:04 +0000)]
target/m68k: don't word align SP in stack frame if M68K_FEATURE_UNALIGNED_DATA feature enabled

Commit a9431a03f7 ("target/m68k: add M68K_FEATURE_UNALIGNED_DATA feature") added
a new feature for processors from the 68020 onwards which do not require data
accesses to be word aligned.

Unfortunately the original commit missed an additional case whereby the SP is
still word aligned when setting up an additional format 1 stack frame so add the
necessary M68K_FEATURE_UNALIGNED_DATA feature guard.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Fixes: a9431a03f7 ("target/m68k: add M68K_FEATURE_UNALIGNED_DATA feature")
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20220108180453.18680-1-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2 years agomacfb: fix VRAM dirty memory region logging
Mark Cave-Ayland [Sat, 8 Jan 2022 16:41:47 +0000 (16:41 +0000)]
macfb: fix VRAM dirty memory region logging

The macfb VRAM memory region was configured with coalescing rather than dirty
memory logging enabled, causing some areas of the screen not to redraw after
a full screen update.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Fixes: 8ac919a065 ("hw/m68k: add Nubus macfb video card")
Reviewed-by: Laurent Vivier <laurent@vivier.eu>
Message-Id: <20220108164147.30813-1-mark.cave-ayland@ilande.co.uk>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2 years agoq800: fix segfault with invalid MacROM
Laurent Vivier [Fri, 7 Jan 2022 10:50:49 +0000 (11:50 +0100)]
q800: fix segfault with invalid MacROM

"qemu-system-m68k -M q800 -bios /dev/null" crashes with a segfault
in q800_init().
This happens because the code doesn't check that rom_ptr() returned
a non-NULL pointer .

To avoid NULL pointer, don't allow 0 sized file and use bios_size with
rom_ptr().

Resolves: https://gitlab.com/qemu-project/qemu/-/issues/756
Reported-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Message-Id: <20220107105049.961489-1-laurent@vivier.eu>
Signed-off-by: Laurent Vivier <laurent@vivier.eu>
2 years agohw: m68k: Add virt compat machine type for 7.0
Laurent Vivier [Sat, 18 Dec 2021 11:43:40 +0000 (12:43 +0100)]
hw: m68k: Add virt compat machine type for 7.0

Signed-off-by: Laurent Vivier <laurent@vivier.eu>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Message-Id: <20211218114340.1856757-1-laurent@vivier.eu>

2 years agoMerge tag 'bsd-user-arm-pull-request' of gitlab.com:bsdimp/qemu into staging
Richard Henderson [Sat, 8 Jan 2022 17:37:59 +0000 (09:37 -0800)]
Merge tag 'bsd-user-arm-pull-request' of gitlab.com:bsdimp/qemu into staging

bsd-user: arm (32-bit) support

This series of patches brings in 32-bit arm support for bsd-user.  It implements
all the bits needed to do image activation, signal handling, stack management
and threading. This allows us to get to the "Hello World" level. The arm and x86
code are now the same as in the bsd-user fork. For full context, the fork is at
https://github.com/qemu-bsd-user/qemu-bsd-user/tree/blitz (though the the recent
sig{bus,segv} needed updates are incomplete).

v5 changes:
   o Moved to using the CPUArchState typedef and move
     set_sigtramp_args, get_mcontext, set_mcontext, and
     get_ucontext_sigreturn prototypes to
     bsd-user/freebsd/target_os_ucontext.h
   o Fix issues with arm's set_mcontext related to masking
     and remove an unnecessary check.

We're down to only one hunk needing review:
    bsd-user/arm/target_arch_signal.c: arm set_mcontext

Warnings that should be ignored:
   o make checkpatch has a couple of complaints about the comments for the
     signal trampoline, since it's a false positive IMHO.
WARNING: Block comments use a leading /* on a separate line
+    /* 8 */ sys_sigreturn,
WARNING: Block comments use a leading /* on a separate line
+    /* 9 */ sys_exit

# gpg: Signature made Fri 07 Jan 2022 11:36:37 PM PST
# gpg:                using RSA key 2035F894B00AA3CF7CCDE1B76C1CD1287DB01100
# gpg: Good signature from "Warner Losh <wlosh@netflix.com>" [unknown]
# gpg:                 aka "Warner Losh <imp@bsdimp.com>" [unknown]
# gpg:                 aka "Warner Losh <imp@freebsd.org>" [unknown]
# gpg:                 aka "Warner Losh <imp@village.org>" [unknown]
# gpg:                 aka "Warner Losh <wlosh@bsdimp.com>" [unknown]
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: 2035 F894 B00A A3CF 7CCD  E1B7 6C1C D128 7DB0 1100

* tag 'bsd-user-arm-pull-request' of gitlab.com:bsdimp/qemu: (37 commits)
  bsd-user: add arm target build
  bsd-user/freebsd/target_os_ucontext.h: Require TARGET_*CONTEXT_SIZE
  bsd-user/arm/signal.c: arm get_ucontext_sigreturn
  bsd-user/arm/signal.c: arm set_mcontext
  bsd-user/arm/signal.c: arm get_mcontext
  bsd-user/arm/signal.c: arm set_sigtramp_args
  bsd-user/arm/target_arch_signal.h: Define size of *context_t
  bsd-user/arm/target_arch_signal.h: arm machine context and trapframe for signals
  bsd-user/arm/target_arch_signal.h: arm specific signal registers and stack
  bsd-user/arm/target_arch_elf.h: arm get_hwcap2 impl
  bsd-user/arm/target_arch_elf.h: arm get hwcap
  bsd-user/arm/target_arch_elf.h: arm defines for ELF
  bsd-user/arm/target_arch_thread.h: Routines to create and switch to a thread
  bsd-user/arm/target_arch_sigtramp.h: Signal Trampoline for arm
  bsd-user/arm/target_arch_vmparam.h: Parameters for arm address space
  bsd-user/arm/target_arch_reg.h: Implement core dump register copying
  bsd-user/arm/target_arch_cpu.h: Implement system call dispatch
  bsd-user/arm/target_arch_cpu.h: Implement data abort exceptions
  bsd-user/arm/target_arch_cpu.h: Implement trivial EXCP exceptions
  bsd-user/arm/target_arch_cpu.h: Dummy target_cpu_loop implementation
  ...

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2 years agoMerge tag 'pull-riscv-to-apply-20220108' of github.com:alistair23/qemu into staging
Richard Henderson [Sat, 8 Jan 2022 06:09:24 +0000 (22:09 -0800)]
Merge tag 'pull-riscv-to-apply-20220108' of github.com:alistair23/qemu into staging

Second RISC-V PR for QEMU 7.0

 - Fix illegal instruction when PMP is disabled
 - SiFive PDMA 64-bit support
 - SiFive PLIC cleanups
 - Mark Hypervisor extension as non experimental
 - Enable Hypervisor extension by default
 - Support 32 cores on the virt machine
 - Corrections for the Vector extension
 - Experimental support for 128-bit CPUs
 - stval and mtval support for illegal instructions

# gpg: Signature made Fri 07 Jan 2022 09:50:11 PM PST
# gpg:                using RSA key F6C4AC46D4934868D3B8CE8F21E10D29DF977054
# gpg: Good signature from "Alistair Francis <alistair@alistair23.me>" [undefined]
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: F6C4 AC46 D493 4868 D3B8  CE8F 21E1 0D29 DF97 7054

* tag 'pull-riscv-to-apply-20220108' of github.com:alistair23/qemu: (37 commits)
  target/riscv: Implement the stval/mtval illegal instruction
  target/riscv: Fixup setting GVA
  target/riscv: Set the opcode in DisasContext
  target/riscv: actual functions to realize crs 128-bit insns
  target/riscv: modification of the trans_csrxx for 128-bit support
  target/riscv: helper functions to wrap calls to 128-bit csr insns
  target/riscv: adding high part of some csrs
  target/riscv: support for 128-bit M extension
  target/riscv: support for 128-bit arithmetic instructions
  target/riscv: support for 128-bit shift instructions
  target/riscv: support for 128-bit U-type instructions
  target/riscv: support for 128-bit bitwise instructions
  target/riscv: accessors to registers upper part and 128-bit load/store
  target/riscv: moving some insns close to similar insns
  target/riscv: setup everything for rv64 to support rv128 execution
  target/riscv: array for the 64 upper bits of 128-bit registers
  target/riscv: separation of bitwise logic and arithmetic helpers
  target/riscv: additional macros to check instruction support
  qemu/int128: addition of div/rem 128-bit operations
  exec/memop: Adding signed quad and octo defines
  ...

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
2 years agobsd-user: add arm target build
Warner Losh [Thu, 23 Sep 2021 21:30:45 +0000 (15:30 -0600)]
bsd-user: add arm target build

CC: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Warner Losh <imp@bsdimp.com>
Acked-by: Kyle Evans <kevans@FreeBSD.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
2 years agobsd-user/freebsd/target_os_ucontext.h: Require TARGET_*CONTEXT_SIZE
Warner Losh [Thu, 4 Nov 2021 23:21:48 +0000 (17:21 -0600)]
bsd-user/freebsd/target_os_ucontext.h: Require TARGET_*CONTEXT_SIZE

Now that all architecutres define TARGET_[MU]CONTEXT_SIZE, enforce
requiring them and always check the sizeof target_{u,m}context_t
sizes.

Signed-off-by: Warner Losh <imp@bsdimp.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
2 years agobsd-user/arm/signal.c: arm get_ucontext_sigreturn
Warner Losh [Thu, 23 Sep 2021 21:24:19 +0000 (15:24 -0600)]
bsd-user/arm/signal.c: arm get_ucontext_sigreturn

Update ucontext to implement sigreturn.

Signed-off-by: Stacey Son <sson@FreeBSD.org>
Signed-off-by: Warner Losh <imp@bsdimp.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
2 years agobsd-user/arm/signal.c: arm set_mcontext
Warner Losh [Thu, 23 Sep 2021 21:23:13 +0000 (15:23 -0600)]
bsd-user/arm/signal.c: arm set_mcontext

Move the machine context to the CPU state.

Signed-off-by: Stacey Son <sson@FreeBSD.org>
Signed-off-by: Kyle Evans <kevans@FreeBSD.org>
Signed-off-by: Warner Losh <imp@bsdimp.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
2 years agobsd-user/arm/signal.c: arm get_mcontext
Warner Losh [Thu, 23 Sep 2021 21:22:12 +0000 (15:22 -0600)]
bsd-user/arm/signal.c: arm get_mcontext

Get the machine context from the CPU state.

Signed-off-by: Stacey Son <sson@FreeBSD.org>
Signed-off-by: Kyle Evans <kevans@FreeBSD.org>
Signed-off-by: Warner Losh <imp@bsdimp.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
2 years agobsd-user/arm/signal.c: arm set_sigtramp_args
Warner Losh [Thu, 23 Sep 2021 21:19:33 +0000 (15:19 -0600)]
bsd-user/arm/signal.c: arm set_sigtramp_args

Implement set_sigtramp_args to setup the arguments to the sigtramp
calls.

Signed-off-by: Stacey Son <sson@FreeBSD.org>
Signed-off-by: Warner Losh <imp@bsdimp.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
2 years agobsd-user/arm/target_arch_signal.h: Define size of *context_t
Warner Losh [Thu, 4 Nov 2021 23:08:04 +0000 (17:08 -0600)]
bsd-user/arm/target_arch_signal.h: Define size of *context_t

Define the native sizes of mcontext_t and ucontext_t so that the tests
in target_os_ucontext.h ensure the size of arm's version of these
structures is correct.

Signed-off-by: Warner Losh <imp@bsdimp.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
2 years agobsd-user/arm/target_arch_signal.h: arm machine context and trapframe for signals
Warner Losh [Thu, 23 Sep 2021 21:17:03 +0000 (15:17 -0600)]
bsd-user/arm/target_arch_signal.h: arm machine context and trapframe for signals

Signed-off-by: Stacey Son <sson@FreeBSD.org>
Signed-off-by: Kyle Evans <kevans@FreeBSD.org>
Signed-off-by: Warner Losh <imp@bsdimp.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
2 years agobsd-user/arm/target_arch_signal.h: arm specific signal registers and stack
Warner Losh [Thu, 23 Sep 2021 21:15:08 +0000 (15:15 -0600)]
bsd-user/arm/target_arch_signal.h: arm specific signal registers and stack

Defines for registers and stack layout related to signals.

Signed-off-by: Stacey Son <sson@FreeBSD.org>
Signed-off-by: Warner Losh <imp@bsdimp.com>
Reviewed-by: Kyle Evans <kevans@FreeBSD.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
2 years agobsd-user/arm/target_arch_elf.h: arm get_hwcap2 impl
Warner Losh [Thu, 23 Sep 2021 20:48:18 +0000 (14:48 -0600)]
bsd-user/arm/target_arch_elf.h: arm get_hwcap2 impl

Implement the extended HW capabilities for HWCAP2.

Signed-off-by: Kyle Evans <kevans@FreeBSD.org>
Signed-off-by: Warner Losh <imp@bsdimp.com>
Reviewed-by: Kyle Evans <kevans@FreeBSD.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
2 years agobsd-user/arm/target_arch_elf.h: arm get hwcap
Warner Losh [Thu, 23 Sep 2021 20:42:42 +0000 (14:42 -0600)]
bsd-user/arm/target_arch_elf.h: arm get hwcap

Implement get_elf_hwcap to get the first word of hardware capabilities.

Signed-off-by: Kyle Evans <kevans@FreeBSD.org>
Signed-off-by: Stacey Son <sson@FreeBSD.org>
Signed-off-by: Warner Losh <imp@bsdimp.com>
Reviewed-by: Kyle Evans <kevans@FreeBSD.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
2 years agobsd-user/arm/target_arch_elf.h: arm defines for ELF
Warner Losh [Thu, 23 Sep 2021 20:34:56 +0000 (14:34 -0600)]
bsd-user/arm/target_arch_elf.h: arm defines for ELF

Basic set of defines needed for arm ELF file activation.

Signed-off-by: Stacey Son <sson@FreeBSD.org>
Signed-off-by: Warner Losh <imp@bsdimp.com>
Reviewed-by: Kyle Evans <kevans@FreeBSD.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
2 years agobsd-user/arm/target_arch_thread.h: Routines to create and switch to a thread
Warner Losh [Thu, 23 Sep 2021 15:16:15 +0000 (09:16 -0600)]
bsd-user/arm/target_arch_thread.h: Routines to create and switch to a thread

Implement target_thread_init (to create a thread) and target_set_upcall
(to switch to a thread) for arm.

Signed-off-by: Stacey Son <sson@FreeBSD.org>
Signed-off-by: Kyle Evans <kevans@FreeBSD.org>
Signed-off-by: Warner Losh <imp@bsdimp.com>
Reviewed-by: Kyle Evans <kevans@FreeBSD.org>
2 years agobsd-user/arm/target_arch_sigtramp.h: Signal Trampoline for arm
Warner Losh [Thu, 23 Sep 2021 15:14:08 +0000 (09:14 -0600)]
bsd-user/arm/target_arch_sigtramp.h: Signal Trampoline for arm

Copy of the signal trampoline code for arm, as well as setup_sigtramp to
write it to the stack.

Signed-off-by: Stacey Son <sson@FreeBSD.org>
Signed-off-by: Warner Losh <imp@bsdimp.com>
Reviewed-by: Kyle Evans <kevans@FreeBSD.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
2 years agobsd-user/arm/target_arch_vmparam.h: Parameters for arm address space
Warner Losh [Thu, 23 Sep 2021 15:12:12 +0000 (09:12 -0600)]
bsd-user/arm/target_arch_vmparam.h: Parameters for arm address space

Various parameters describing the layout of the ARM address space. In
addition, define routines to get the stack pointer and to set the second
return value.

Signed-off-by: Stacey Son <sson@FreeBSD.org>
Signed-off-by: Kyle Evans <kevans@FreeBSD.org>
Signed-off-by: Warner Losh <imp@bsdimp.com>
Reviewed-by: Kyle Evans <kevans@FreeBSD.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
2 years agobsd-user/arm/target_arch_reg.h: Implement core dump register copying
Warner Losh [Thu, 23 Sep 2021 15:10:27 +0000 (09:10 -0600)]
bsd-user/arm/target_arch_reg.h: Implement core dump register copying

Implement the register copying routines to extract registers from the
cpu for core dump generation.

Signed-off-by: Stacey Son <sson@FreeBSD.org>
Signed-off-by: Warner Losh <imp@bsdimp.com>
Reviewed-by: Kyle Evans <kevans@FreeBSD.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
2 years agobsd-user/arm/target_arch_cpu.h: Implement system call dispatch
Warner Losh [Thu, 23 Sep 2021 15:08:21 +0000 (09:08 -0600)]
bsd-user/arm/target_arch_cpu.h: Implement system call dispatch

Implement the system call dispatch. This implements all three kinds of
system call: direct and the two indirect variants. It handles all the
special cases for thumb as well.

Signed-off-by: Stacey Son <sson@FreeBSD.org>
Signed-off-by: Kyle Evans <kevans@FreeBSD.org>
Signed-off-by: Warner Losh <imp@bsdimp.com>
Reviewed-by: Kyle Evans <kevans@FreeBSD.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
2 years agobsd-user/arm/target_arch_cpu.h: Implement data abort exceptions
Warner Losh [Thu, 23 Sep 2021 14:57:14 +0000 (08:57 -0600)]
bsd-user/arm/target_arch_cpu.h: Implement data abort exceptions

Implement EXCP_PREFETCH_ABORT AND EXCP_DATA_ABORT. Both of these data
exceptions cause a SIGSEGV.

Signed-off-by: Kyle Evans <kevans@FreeBSD.org>
Signed-off-by: Olivier Houchard <cognet@ci0.org>
Signed-off-by: Stacey Son <sson@FreeBSD.org>
Signed-off-by: Warner Losh <imp@bsdimp.com>
Reviewed-by: Kyle Evans <kevans@FreeBSD.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
2 years agobsd-user/arm/target_arch_cpu.h: Implement trivial EXCP exceptions
Warner Losh [Thu, 23 Sep 2021 14:54:17 +0000 (08:54 -0600)]
bsd-user/arm/target_arch_cpu.h: Implement trivial EXCP exceptions

Implement EXCP_UDEF, EXCP_DEBUG, EXCP_INTERRUPT, EXCP_ATOMIC and
EXCP_YIELD. The first two generate a signal to the emulated
binary. EXCP_ATOMIC handles atomic operations. The remainder are fancy
nops.

Signed-off-by: Stacey Son <sson@FreeBSD.org>
Signed-off-by: Mikaël Urankar <mikael.urankar@gmail.com>
Signed-off-by: Kyle Evans <kevans@FreeBSD.org>
Signed-off-by: Warner Losh <imp@bsdimp.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
2 years agobsd-user/arm/target_arch_cpu.h: Dummy target_cpu_loop implementation
Warner Losh [Thu, 23 Sep 2021 14:47:16 +0000 (08:47 -0600)]
bsd-user/arm/target_arch_cpu.h: Dummy target_cpu_loop implementation

Add a boiler plate CPU loop that does nothing except return an error for
all traps.

Signed-off-by: Sean Bruno <sbruno@FreeBSD.org>
Signed-off-by: Stacey Son <sson@FreeBSD.org>
Signed-off-by: Warner Losh <imp@bsdimp.com>
Reviewed-by: Kyle Evans <kevans@FreeBSD.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
2 years agobsd-user/arm/target_arch_cpu.h: Implement target_cpu_clone_regs
Warner Losh [Thu, 23 Sep 2021 14:44:05 +0000 (08:44 -0600)]
bsd-user/arm/target_arch_cpu.h: Implement target_cpu_clone_regs

Implement target_cpu_clone_regs to clone the resister state on a fork.

Signed-off-by: Stacey Son <sson@FreeBSD.org>
Signed-off-by: Warner Losh <imp@bsdimp.com>
Reviewed-by: Kyle Evans <kevans@FreeBSD.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
2 years agobsd-user/arm/target_arch_cpu.h: CPU Loop definitions
Warner Losh [Thu, 23 Sep 2021 14:41:13 +0000 (08:41 -0600)]
bsd-user/arm/target_arch_cpu.h: CPU Loop definitions

target_arch_cpu.h is for CPU loop definitions. Create the file and
define target_cpu_init and target_cpu_reset for arm.

Signed-off-by: Olivier Houchard <cognet@ci0.org>
Signed-off-by: Stacey Son <sson@FreeBSD.org>
Signed-off-by: Warner Losh <imp@bsdimp.com>
Reviewed-by: Kyle Evans <kevans@FreeBSD.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
2 years agobsd-user/arm/target_arch_cpu.c: Target specific TLS routines
Warner Losh [Thu, 23 Sep 2021 14:32:06 +0000 (08:32 -0600)]
bsd-user/arm/target_arch_cpu.c: Target specific TLS routines

Target specific TLS routines to get and set the TLS values.

Signed-off-by: Kyle Evans <kevans@FreeBSD.org>
Signed-off-by: Stacey Son <sson@FreeBSD.org>
Signed-off-by: Warner Losh <imp@bsdimp.com>
Reviewed-by: Kyle Evans <kevans@FreeBSD.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
2 years agobsd-user/arm/target_syscall.h: Add copyright and update name
Warner Losh [Thu, 23 Sep 2021 14:29:39 +0000 (08:29 -0600)]
bsd-user/arm/target_syscall.h: Add copyright and update name

The preferred name for the 32-bit arm is now armv7. Update the name to
reflect that. In addition, add Stacey's copyright to this file and
update the include guards to the new convention.

Signed-off-by: Stacey Son <sson@FreeBSD.org>
Signed-off-by: Warner Losh <imp@bsdimp.com>
Reviewed-by: Kyle Evans <kevans@FreeBSD.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
2 years agobsd-user/arm/target_arch_sysarch.h: Use consistent include guards
Warner Losh [Thu, 23 Sep 2021 14:28:24 +0000 (08:28 -0600)]
bsd-user/arm/target_arch_sysarch.h: Use consistent include guards

As part of upstreaming, the include guards have been made more
consistent. Update this file to use the new guards.

Signed-off-by: Warner Losh <imp@bsdimp.com>
Reviewed-by: Kyle Evans <kevans@FreeBSD.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
2 years agobsd-user/target_os_signal.h: Move signal prototypes to target_os_ucontext.h
Warner Losh [Fri, 5 Nov 2021 16:55:35 +0000 (10:55 -0600)]
bsd-user/target_os_signal.h: Move signal prototypes to target_os_ucontext.h

Switch to the CPUArchState typedef and move target-provided prototypes
to target_os_ucontext.h.

Signed-off-by: Warner Losh <imp@bsdimp.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
2 years agobsd-user/x86_64: Move functions into signal.c
Warner Losh [Thu, 4 Nov 2021 22:53:13 +0000 (16:53 -0600)]
bsd-user/x86_64: Move functions into signal.c

Move the current inline functions into sigal.c. This will increate the
flexibility of implementation in the future.

Signed-off-by: Warner Losh <imp@bsdimp.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
2 years agobsd-user/x86_64/target_arch_signal.h: Fill in mcontext_t
Warner Losh [Thu, 4 Nov 2021 22:51:50 +0000 (16:51 -0600)]
bsd-user/x86_64/target_arch_signal.h: Fill in mcontext_t

Fill in target_mcontext match the FreeBSD mcontext_t structure. Also
define the size correctly.

Signed-off-by: Warner Losh <imp@bsdimp.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
2 years agobsd-user/x86_64/target_arch_signal.h: use new target_os_ucontext.h
Warner Losh [Fri, 29 Oct 2021 15:07:02 +0000 (09:07 -0600)]
bsd-user/x86_64/target_arch_signal.h: use new target_os_ucontext.h

Signed-off-by: Warner Losh <imp@bsdimp.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
2 years agobsd-user/x86_64/target_arch_signal.h: Remove target_sigcontext
Warner Losh [Fri, 29 Oct 2021 14:27:50 +0000 (08:27 -0600)]
bsd-user/x86_64/target_arch_signal.h: Remove target_sigcontext

In FreeBSD, sigcontext was retired in favor of ucontext/mcontext.
Remove vestigial target_sigcontext.

Signed-off-by: Warner Losh <imp@bsdimp.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
2 years agobsd-user/i386: Move the inlines into signal.c
Warner Losh [Thu, 4 Nov 2021 22:45:26 +0000 (16:45 -0600)]
bsd-user/i386: Move the inlines into signal.c

Move the (now stubbed out) inlines into bsd-user/i386/signal.c.

Signed-off-by: Warner Losh <imp@bsdimp.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
2 years agobsd-user/i386/target_arch_signal.h: Update mcontext_t to match FreeBSD
Warner Losh [Thu, 4 Nov 2021 22:41:55 +0000 (16:41 -0600)]
bsd-user/i386/target_arch_signal.h: Update mcontext_t to match FreeBSD

Fill in target_mcontext_t to match the FreeBSD mcontex_t. Also tag the
current size of mcontext and ucontext to enable size checking for i386.

Signed-off-by: Warner Losh <imp@bsdimp.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
2 years agobsd-user/i386/target_arch_signal.h: use new target_os_ucontext.h
Warner Losh [Fri, 29 Oct 2021 15:07:59 +0000 (09:07 -0600)]
bsd-user/i386/target_arch_signal.h: use new target_os_ucontext.h

Signed-off-by: Warner Losh <imp@bsdimp.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
2 years agobsd-user/i386/target_arch_signal.h: Remove target_sigcontext
Warner Losh [Fri, 29 Oct 2021 14:25:45 +0000 (08:25 -0600)]
bsd-user/i386/target_arch_signal.h: Remove target_sigcontext

In FreeBSD, sigcontext was retired in favor of ucontext/mcontext.
Remove vestigial target_sigcontext.

Signed-off-by: Warner Losh <imp@bsdimp.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
2 years agobsd-user: create a per-arch signal.c file
Warner Losh [Thu, 4 Nov 2021 22:34:48 +0000 (16:34 -0600)]
bsd-user: create a per-arch signal.c file

Create a place-holder signal.c file for each of the architectures that
are currently built. In the future, some code that's currently inlined
in target_arch_signal.h will live here.

Signed-off-by: Warner Losh <imp@bsdimp.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
2 years agobsd-user/freebsd: Create common target_os_ucontext.h file
Warner Losh [Fri, 29 Oct 2021 14:39:01 +0000 (08:39 -0600)]
bsd-user/freebsd: Create common target_os_ucontext.h file

FreeBSD has a MI ucontext structure that contains the MD mcontext
machine state and other things that are machine independent. Create an
include file for all the ucontext stuff. It needs to be included in the
arch specific files after target_mcontext is defined. This is largely
copied from sys/_ucontext.h with the comments about layout removed
because we don't support ancient FreeBSD binaries.

Signed-off-by: Warner Losh <imp@bsdimp.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
2 years agobsd-user/mips*: Remove mips support
Warner Losh [Thu, 4 Nov 2021 22:31:27 +0000 (16:31 -0600)]
bsd-user/mips*: Remove mips support

FreeBSD is dropping support for mips starting with FreeBSD 14. mips
support has been removed from the bsd-user fork because updating it for
new signal requirements will take too much time. Remove it here since it
is a distraction.

Signed-off-by: Warner Losh <imp@bsdimp.com>
Acked-by: Richard Henderson <richard.henderson@linaro.org>
2 years agotarget/riscv: Implement the stval/mtval illegal instruction
Alistair Francis [Mon, 20 Dec 2021 06:49:16 +0000 (16:49 +1000)]
target/riscv: Implement the stval/mtval illegal instruction

The stval and mtval registers can optionally contain the faulting
instruction on an illegal instruction exception. This patch adds support
for setting the stval and mtval registers.

The RISC-V spec states that "The stval register can optionally also be
used to return the faulting instruction bits on an illegal instruction
exception...". In this case we are always writing the value on an
illegal instruction.

This doesn't match all CPUs (some CPUs won't write the data), but in
QEMU let's just populate the value on illegal instructions. This won't
break any guest software, but will provide more information to guests.

Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Message-id: 20211220064916.107241-4-alistair.francis@opensource.wdc.com

2 years agotarget/riscv: Fixup setting GVA
Alistair Francis [Mon, 20 Dec 2021 06:49:15 +0000 (16:49 +1000)]
target/riscv: Fixup setting GVA

In preparation for adding support for the illegal instruction address
let's fixup the Hypervisor extension setting GVA logic and improve the
variable names.

Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Message-id: 20211220064916.107241-3-alistair.francis@opensource.wdc.com

2 years agotarget/riscv: Set the opcode in DisasContext
Alistair Francis [Mon, 20 Dec 2021 06:49:14 +0000 (16:49 +1000)]
target/riscv: Set the opcode in DisasContext

Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Message-id: 20211220064916.107241-2-alistair.francis@opensource.wdc.com

2 years agotarget/riscv: actual functions to realize crs 128-bit insns
Frédéric Pétrot [Thu, 6 Jan 2022 21:01:08 +0000 (22:01 +0100)]
target/riscv: actual functions to realize crs 128-bit insns

The csrs are accessed through function pointers: we add 128-bit read
operations in the table for three csrs (writes fallback to the
64-bit version as the upper 64-bit information is handled elsewhere):
- misa, as mxl is needed for proper operation,
- mstatus and sstatus, to return sd
In addition, we also add read and write accesses to the machine and
supervisor scratch registers.

Signed-off-by: Frédéric Pétrot <frederic.petrot@univ-grenoble-alpes.fr>
Co-authored-by: Fabien Portas <fabien.portas@grenoble-inp.org>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-id: 20220106210108.138226-19-frederic.petrot@univ-grenoble-alpes.fr
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
2 years agotarget/riscv: modification of the trans_csrxx for 128-bit support
Frédéric Pétrot [Thu, 6 Jan 2022 21:01:07 +0000 (22:01 +0100)]
target/riscv: modification of the trans_csrxx for 128-bit support

As opposed to the gen_arith and gen_shift generation helpers, the csr insns
do not have a common prototype, so the choice to generate 32/64 or 128-bit
helper calls is done in the trans_csrxx functions.

Signed-off-by: Frédéric Pétrot <frederic.petrot@univ-grenoble-alpes.fr>
Co-authored-by: Fabien Portas <fabien.portas@grenoble-inp.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-id: 20220106210108.138226-18-frederic.petrot@univ-grenoble-alpes.fr
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
2 years agotarget/riscv: helper functions to wrap calls to 128-bit csr insns
Frédéric Pétrot [Thu, 6 Jan 2022 21:01:06 +0000 (22:01 +0100)]
target/riscv: helper functions to wrap calls to 128-bit csr insns

Given the side effects they have, the csr instructions are realized as
helpers. We extend this existing infrastructure for 128-bit sized csr.
We return 128-bit values using the same approach as for div/rem.
Theses helpers all call a unique function that is currently a fallback
on the 64-bit version.
The trans_csrxx functions supporting 128-bit are yet to be implemented.

Signed-off-by: Frédéric Pétrot <frederic.petrot@univ-grenoble-alpes.fr>
Co-authored-by: Fabien Portas <fabien.portas@grenoble-inp.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-id: 20220106210108.138226-17-frederic.petrot@univ-grenoble-alpes.fr
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
2 years agotarget/riscv: adding high part of some csrs
Frédéric Pétrot [Thu, 6 Jan 2022 21:01:05 +0000 (22:01 +0100)]
target/riscv: adding high part of some csrs

Adding the high part of a very minimal set of csr.

Signed-off-by: Frédéric Pétrot <frederic.petrot@univ-grenoble-alpes.fr>
Co-authored-by: Fabien Portas <fabien.portas@grenoble-inp.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-id: 20220106210108.138226-16-frederic.petrot@univ-grenoble-alpes.fr
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
2 years agotarget/riscv: support for 128-bit M extension
Frédéric Pétrot [Thu, 6 Jan 2022 21:01:04 +0000 (22:01 +0100)]
target/riscv: support for 128-bit M extension

Mult are generated inline (using a cool trick pointed out by Richard), but
for div and rem, given the complexity of the implementation of these
instructions, we call helpers to produce their behavior. From an
implementation standpoint, the helpers return the low part of the results,
while the high part is temporarily stored in a dedicated field of cpu_env
that is used to update the architectural register in the generation wrapper.

Signed-off-by: Frédéric Pétrot <frederic.petrot@univ-grenoble-alpes.fr>
Co-authored-by: Fabien Portas <fabien.portas@grenoble-inp.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-id: 20220106210108.138226-15-frederic.petrot@univ-grenoble-alpes.fr
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
2 years agotarget/riscv: support for 128-bit arithmetic instructions
Frédéric Pétrot [Thu, 6 Jan 2022 21:01:03 +0000 (22:01 +0100)]
target/riscv: support for 128-bit arithmetic instructions

Addition of 128-bit adds and subs in their various sizes,
"set if less than"s and branches.
Refactored the code to have a comparison function used for both stls and
branches.

Signed-off-by: Frédéric Pétrot <frederic.petrot@univ-grenoble-alpes.fr>
Co-authored-by: Fabien Portas <fabien.portas@grenoble-inp.org>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-id: 20220106210108.138226-14-frederic.petrot@univ-grenoble-alpes.fr
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
2 years agotarget/riscv: support for 128-bit shift instructions
Frédéric Pétrot [Thu, 6 Jan 2022 21:01:02 +0000 (22:01 +0100)]
target/riscv: support for 128-bit shift instructions

Handling shifts for 32, 64 and 128 operation length for RV128, following the
general framework for handling various olens proposed by Richard.

Signed-off-by: Frédéric Pétrot <frederic.petrot@univ-grenoble-alpes.fr>
Co-authored-by: Fabien Portas <fabien.portas@grenoble-inp.org>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-id: 20220106210108.138226-13-frederic.petrot@univ-grenoble-alpes.fr
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
2 years agotarget/riscv: support for 128-bit U-type instructions
Frédéric Pétrot [Thu, 6 Jan 2022 21:01:01 +0000 (22:01 +0100)]
target/riscv: support for 128-bit U-type instructions

Adding the 128-bit version of lui and auipc, and introducing to that end
a "set register with immediat" function to handle extension on 128 bits.

Signed-off-by: Frédéric Pétrot <frederic.petrot@univ-grenoble-alpes.fr>
Co-authored-by: Fabien Portas <fabien.portas@grenoble-inp.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-id: 20220106210108.138226-12-frederic.petrot@univ-grenoble-alpes.fr
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
2 years agotarget/riscv: support for 128-bit bitwise instructions
Frédéric Pétrot [Thu, 6 Jan 2022 21:01:00 +0000 (22:01 +0100)]
target/riscv: support for 128-bit bitwise instructions

The 128-bit bitwise instructions do not need any function prototype change
as the functions can be applied independently on the lower and upper part of
the registers.

Signed-off-by: Frédéric Pétrot <frederic.petrot@univ-grenoble-alpes.fr>
Co-authored-by: Fabien Portas <fabien.portas@grenoble-inp.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-id: 20220106210108.138226-11-frederic.petrot@univ-grenoble-alpes.fr
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
2 years agotarget/riscv: accessors to registers upper part and 128-bit load/store
Frédéric Pétrot [Thu, 6 Jan 2022 21:00:59 +0000 (22:00 +0100)]
target/riscv: accessors to registers upper part and 128-bit load/store

Get function to retrieve the 64 top bits of a register, stored in the gprh
field of the cpu state. Set function that writes the 128-bit value at once.
The access to the gprh field can not be protected at compile time to make
sure it is accessed only in the 128-bit version of the processor because we
have no way to indicate that the misa_mxl_max field is const.

The 128-bit ISA adds ldu, lq and sq. We provide support for these
instructions. Note that (a) we compute only 64-bit addresses to actually
access memory, cowardly utilizing the existing address translation mechanism
of QEMU, and (b) we assume for now little-endian memory accesses.

Signed-off-by: Frédéric Pétrot <frederic.petrot@univ-grenoble-alpes.fr>
Co-authored-by: Fabien Portas <fabien.portas@grenoble-inp.org>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-id: 20220106210108.138226-10-frederic.petrot@univ-grenoble-alpes.fr
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
2 years agotarget/riscv: moving some insns close to similar insns
Frédéric Pétrot [Thu, 6 Jan 2022 21:00:58 +0000 (22:00 +0100)]
target/riscv: moving some insns close to similar insns

lwu and ld are functionally close to the other loads, but were after the
stores in the source file.
Similarly, xor was away from or and and by two arithmetic functions, while
the immediate versions were nicely put together.
This patch moves the aforementioned loads after lhu, and xor above or,
where they more logically belong.

Signed-off-by: Frédéric Pétrot <frederic.petrot@univ-grenoble-alpes.fr>
Co-authored-by: Fabien Portas <fabien.portas@grenoble-inp.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-id: 20220106210108.138226-9-frederic.petrot@univ-grenoble-alpes.fr
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
2 years agotarget/riscv: setup everything for rv64 to support rv128 execution
Frédéric Pétrot [Thu, 6 Jan 2022 21:00:57 +0000 (22:00 +0100)]
target/riscv: setup everything for rv64 to support rv128 execution

This patch adds the support of the '-cpu rv128' option to
qemu-system-riscv64 so that we can indicate that we want to run rv128
executables.
Still, there is no support for 128-bit insns at that stage so qemu fails
miserably (as expected) if launched with this option.

Signed-off-by: Frédéric Pétrot <frederic.petrot@univ-grenoble-alpes.fr>
Co-authored-by: Fabien Portas <fabien.portas@grenoble-inp.org>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-id: 20220106210108.138226-8-frederic.petrot@univ-grenoble-alpes.fr
[ Changed by AF
 - Rename CPU to "x-rv128"
]
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
2 years agotarget/riscv: array for the 64 upper bits of 128-bit registers
Frédéric Pétrot [Thu, 6 Jan 2022 21:00:56 +0000 (22:00 +0100)]
target/riscv: array for the 64 upper bits of 128-bit registers

The upper 64-bit of the 128-bit registers have now a place inside
the cpu state structure, and are created as globals for future use.

Signed-off-by: Frédéric Pétrot <frederic.petrot@univ-grenoble-alpes.fr>
Co-authored-by: Fabien Portas <fabien.portas@grenoble-inp.org>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-id: 20220106210108.138226-7-frederic.petrot@univ-grenoble-alpes.fr
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
2 years agotarget/riscv: separation of bitwise logic and arithmetic helpers
Frédéric Pétrot [Thu, 6 Jan 2022 21:00:55 +0000 (22:00 +0100)]
target/riscv: separation of bitwise logic and arithmetic helpers

Introduction of a gen_logic function for bitwise logic to implement
instructions in which no propagation of information occurs between bits and
use of this function on the bitwise instructions.

Signed-off-by: Frédéric Pétrot <frederic.petrot@univ-grenoble-alpes.fr>
Co-authored-by: Fabien Portas <fabien.portas@grenoble-inp.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-id: 20220106210108.138226-6-frederic.petrot@univ-grenoble-alpes.fr
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
2 years agotarget/riscv: additional macros to check instruction support
Frédéric Pétrot [Thu, 6 Jan 2022 21:00:54 +0000 (22:00 +0100)]
target/riscv: additional macros to check instruction support

Given that the 128-bit version of the riscv spec adds new instructions, and
that some instructions that were previously only available in 64-bit mode
are now available for both 64-bit and 128-bit, we added new macros to check
for the processor mode during translation.
Although RV128 is a superset of RV64, we keep for now the RV64 only tests
for extensions other than RVI and RVM.

Signed-off-by: Frédéric Pétrot <frederic.petrot@univ-grenoble-alpes.fr>
Co-authored-by: Fabien Portas <fabien.portas@grenoble-inp.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-id: 20220106210108.138226-5-frederic.petrot@univ-grenoble-alpes.fr
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
2 years agoqemu/int128: addition of div/rem 128-bit operations
Frédéric Pétrot [Thu, 6 Jan 2022 21:00:53 +0000 (22:00 +0100)]
qemu/int128: addition of div/rem 128-bit operations

Addition of div and rem on 128-bit integers, using the 128/64->128 divu and
64x64->128 mulu in host-utils.
These operations will be used within div/rem helpers in the 128-bit riscv
target.

Signed-off-by: Frédéric Pétrot <frederic.petrot@univ-grenoble-alpes.fr>
Co-authored-by: Fabien Portas <fabien.portas@grenoble-inp.org>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-id: 20220106210108.138226-4-frederic.petrot@univ-grenoble-alpes.fr
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
2 years agoexec/memop: Adding signed quad and octo defines
Frédéric Pétrot [Thu, 6 Jan 2022 21:00:52 +0000 (22:00 +0100)]
exec/memop: Adding signed quad and octo defines

Adding defines to handle signed 64-bit and unsigned 128-bit quantities in
memory accesses.

Signed-off-by: Frédéric Pétrot <frederic.petrot@univ-grenoble-alpes.fr>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-id: 20220106210108.138226-3-frederic.petrot@univ-grenoble-alpes.fr
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>
2 years agoexec/memop: Adding signedness to quad definitions
Frédéric Pétrot [Thu, 6 Jan 2022 21:00:51 +0000 (22:00 +0100)]
exec/memop: Adding signedness to quad definitions

Renaming defines for quad in their various forms so that their signedness is
now explicit.
Done using git grep as suggested by Philippe, with a bit of hand edition to
keep assignments aligned.

Signed-off-by: Frédéric Pétrot <frederic.petrot@univ-grenoble-alpes.fr>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Alistair Francis <alistair.francis@wdc.com>
Message-id: 20220106210108.138226-2-frederic.petrot@univ-grenoble-alpes.fr
Signed-off-by: Alistair Francis <alistair.francis@wdc.com>