Two s390x bugfixes.

-----BEGIN PGP SIGNATURE-----
 
 iQJGBAABCAAwFiEEw9DWbcNiT/aowBjO3s9rk8bwL68FAlwbxRoSHGNvaHVja0By
 ZWRoYXQuY29tAAoJEN7Pa5PG8C+v9kwP/3pETmGan3n0ygyEBQDWW1EyZTZcxziE
 JFToS8vj7Kfw5IgOcQfMw3mGz2MJtP6UbCkkZAuq1PWw+0Bh4AVnnO+0rD26vBOh
 drApetGc+Z31IOotweuvvVcp/gcS2cREsJ4chG8OcKO39JR7cKnvxwzTuLajbYb+
 yU/y6HFqgmzQbXuxjRFIva4Vc+YsioxO2Ldo0i1qGdg02N4r4x97SkI0KPhBBvFw
 GKsWo3o7Jf/m9ijNlY/CJpX4BhUtGVZGNeItz+KzxYe+wISze1vHlE7RoT1fj7i6
 ivpvZil+d35cyo59tsypMwJWLxRznl23ngswYpIn5L7h493EsW5tEduoILQaHseU
 9Ys/d9Lk8VwxIFqM9QXmycVOmmGUpFppqGB45whYhWsNoLRlfO92h5rneLcsnC+I
 f8Y0ByL5tY6qeJ/Dc32Fp+NA5sA/1CMuqD0BdbIkJ6T3wn1Lrh7//KUiyii5PCL6
 OApK5HwojQqasnDI+14NvXARLECXclDQcC2briYWqmauKkLpCgONjO0ODC/WjZbU
 tksDF23jkQO+MElv9Eg9mIlfIZBrWsB4wCFHZht2tfdcs3+vORqQUwJpSC1GifTZ
 GYLQmD1t5qgpWWO0VUM3N0sL7ktU9ZJFp8eeAXgzAPjt4gbgQktpPI5uwYLcHCww
 3NEGWJ51VWhK
 =QBlz
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/cohuck/tags/s390x-20181220' into staging

Two s390x bugfixes.

# gpg: Signature made Thu 20 Dec 2018 16:36:42 GMT
# gpg:                using RSA key DECF6B93C6F02FAF
# gpg: Good signature from "Cornelia Huck <conny@cornelia-huck.de>"
# gpg:                 aka "Cornelia Huck <huckc@linux.vnet.ibm.com>"
# gpg:                 aka "Cornelia Huck <cornelia.huck@de.ibm.com>"
# gpg:                 aka "Cornelia Huck <cohuck@kernel.org>"
# gpg:                 aka "Cornelia Huck <cohuck@redhat.com>"
# Primary key fingerprint: C3D0 D66D C362 4FF6 A8C0  18CE DECF 6B93 C6F0 2FAF

* remotes/cohuck/tags/s390x-20181220:
  hw/s390x: Fix bad mask in time2tod()
  hw/s390/ccw.c: Don't take address of packed members

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2018-12-20 20:39:04 +00:00
commit 41e2c56ed9
2 changed files with 25 additions and 5 deletions

View File

@ -1290,9 +1290,19 @@ void copy_scsw_to_guest(SCSW *dest, const SCSW *src)
static void copy_schib_to_guest(SCHIB *dest, const SCHIB *src)
{
int i;
/*
* We copy the PMCW and SCSW in and out of local variables to
* avoid taking the address of members of a packed struct.
*/
PMCW src_pmcw, dest_pmcw;
SCSW src_scsw, dest_scsw;
copy_pmcw_to_guest(&dest->pmcw, &src->pmcw);
copy_scsw_to_guest(&dest->scsw, &src->scsw);
src_pmcw = src->pmcw;
copy_pmcw_to_guest(&dest_pmcw, &src_pmcw);
dest->pmcw = dest_pmcw;
src_scsw = src->scsw;
copy_scsw_to_guest(&dest_scsw, &src_scsw);
dest->scsw = dest_scsw;
dest->mba = cpu_to_be64(src->mba);
for (i = 0; i < ARRAY_SIZE(dest->mda); i++) {
dest->mda[i] = src->mda[i];
@ -1339,9 +1349,19 @@ static void copy_scsw_from_guest(SCSW *dest, const SCSW *src)
static void copy_schib_from_guest(SCHIB *dest, const SCHIB *src)
{
int i;
/*
* We copy the PMCW and SCSW in and out of local variables to
* avoid taking the address of members of a packed struct.
*/
PMCW src_pmcw, dest_pmcw;
SCSW src_scsw, dest_scsw;
copy_pmcw_from_guest(&dest->pmcw, &src->pmcw);
copy_scsw_from_guest(&dest->scsw, &src->scsw);
src_pmcw = src->pmcw;
copy_pmcw_from_guest(&dest_pmcw, &src_pmcw);
dest->pmcw = dest_pmcw;
src_scsw = src->scsw;
copy_scsw_from_guest(&dest_scsw, &src_scsw);
dest->scsw = dest_scsw;
dest->mba = be64_to_cpu(src->mba);
for (i = 0; i < ARRAY_SIZE(dest->mda); i++) {
dest->mda[i] = src->mda[i];

View File

@ -56,7 +56,7 @@ typedef struct S390TODClass {
/* Converts ns to s390's clock format */
static inline uint64_t time2tod(uint64_t ns)
{
return (ns << 9) / 125 + (((ns & 0xff10000000000000ull) / 125) << 9);
return (ns << 9) / 125 + (((ns & 0xff80000000000000ull) / 125) << 9);
}
/* Converts s390's clock format to ns */