target/ppc: Fix SPE unavailable exception triggering
authorMatthieu Bucchianeri <matthieu.bucchianeri@leostella.com>
Mon, 27 Jul 2020 17:55:53 +0000 (10:55 -0700)
committerDavid Gibson <david@gibson.dropbear.id.au>
Wed, 12 Aug 2020 03:16:27 +0000 (13:16 +1000)
commit8dcdb535d7cc4ba6270bb756e12e1d323254ed4e
tree54fc8837dc3450a06dd7007e60c57d8c1c09dffd
parentc4b8b49d68856ffacacfd792b0ab0d4aa0982e8d
target/ppc: Fix SPE unavailable exception triggering

When emulating certain floating point instructions or vector instructions on
PowerPC machines, QEMU did not properly generate the SPE/Embedded Floating-
Point Unavailable interrupt. See the buglink further below for references to
the relevant NXP documentation.

This patch fixes the behavior of some evfs* instructions that were
incorrectly emitting the interrupt.

More importantly, this patch fixes the behavior of several efd* and ev*
instructions that were not generating the interrupt. Triggering the
interrupt for these instructions fixes lazy FPU/vector context switching on
some operating systems like Linux.

Without this patch, the result of some double-precision arithmetic could be
corrupted due to the lack of proper saving and restoring of the upper
32-bit part of the general-purpose registers.

Buglink: https://bugs.launchpad.net/qemu/+bug/1888918
Buglink: https://bugs.launchpad.net/qemu/+bug/1611394
Signed-off-by: Matthieu Bucchianeri <matthieu.bucchianeri@leostella.com>
Message-Id: <20200727175553.32276-1-matthieu.bucchianeri@leostella.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
target/ppc/translate/spe-impl.inc.c