mirror of
https://gitlab.com/qemu-project/qemu
synced 2024-11-05 20:35:44 +00:00
RISC-V: Critical fixes for QEMU 2.12
This series includes changes that are considered release critical, such as floating point register file corruption under SMP Linux due to incorrect handling of mstatus.FS. This workaround will be replaced with a more comprehensive fix for mstatus.FS handling in QEMU 2.13. -----BEGIN PGP SIGNATURE----- iF0EABECAB0WIQR8mZMOsXzYugc9Xvpr8dezV+8+TwUCWr0g4gAKCRBr8dezV+8+ TyQ+AJ9wsxU3gMINYSge/pj2aMReTuyXFgCfT+4R6HB8JLtHBoUE2M28V7JBp9w= =TnOr -----END PGP SIGNATURE----- Merge remote-tracking branch 'remotes/riscv/tags/riscv-qemu-2.12-critical-fixes' into staging RISC-V: Critical fixes for QEMU 2.12 This series includes changes that are considered release critical, such as floating point register file corruption under SMP Linux due to incorrect handling of mstatus.FS. This workaround will be replaced with a more comprehensive fix for mstatus.FS handling in QEMU 2.13. # gpg: Signature made Thu 29 Mar 2018 18:22:42 BST # gpg: using DSA key 6BF1D7B357EF3E4F # gpg: Good signature from "Michael Clark <michaeljclark@mac.com>" # gpg: aka "Michael Clark <mjc@sifive.com>" # gpg: aka "Michael Clark <michael@metaparadigm.com>" # gpg: WARNING: This key is not certified with a trusted signature! # gpg: There is no indication that the signature belongs to the owner. # Primary key fingerprint: 7C99 930E B17C D8BA 073D 5EFA 6BF1 D7B3 57EF 3E4F * remotes/riscv/tags/riscv-qemu-2.12-critical-fixes: RISC-V: Workaround for critical mstatus.FS bug Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
f184de7553
1 changed files with 15 additions and 2 deletions
|
@ -144,8 +144,21 @@ void csr_write_helper(CPURISCVState *env, target_ulong val_to_write,
|
|||
}
|
||||
|
||||
mstatus = (mstatus & ~mask) | (val_to_write & mask);
|
||||
int dirty = (mstatus & MSTATUS_FS) == MSTATUS_FS;
|
||||
dirty |= (mstatus & MSTATUS_XS) == MSTATUS_XS;
|
||||
|
||||
/* Note: this is a workaround for an issue where mstatus.FS
|
||||
does not report dirty after floating point operations
|
||||
that modify floating point state. This workaround is
|
||||
technically compliant with the RISC-V Privileged
|
||||
specification as it is legal to return only off, or dirty.
|
||||
at the expense of extra floating point save/restore. */
|
||||
|
||||
/* FP is always dirty or off */
|
||||
if (mstatus & MSTATUS_FS) {
|
||||
mstatus |= MSTATUS_FS;
|
||||
}
|
||||
|
||||
int dirty = ((mstatus & MSTATUS_FS) == MSTATUS_FS) |
|
||||
((mstatus & MSTATUS_XS) == MSTATUS_XS);
|
||||
mstatus = set_field(mstatus, MSTATUS_SD, dirty);
|
||||
env->mstatus = mstatus;
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue