thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone
ae23c9
From e851c8ce61bd343961c59afee9062d04a880b1d6 Mon Sep 17 00:00:00 2001
ae23c9
From: David Hildenbrand <david@redhat.com>
ae23c9
Date: Fri, 21 Dec 2018 15:36:14 +0000
ae23c9
Subject: [PATCH 12/22] hw/s390x: Fix bad mask in time2tod()
ae23c9
ae23c9
RH-Author: David Hildenbrand <david@redhat.com>
ae23c9
Message-id: <20181221153614.27961-13-david@redhat.com>
ae23c9
Patchwork-id: 83756
ae23c9
O-Subject: [RHEL-8.0 qemu-kvm v2 PATCH 12/12] hw/s390x: Fix bad mask in time2tod()
ae23c9
Bugzilla: 1653569
ae23c9
RH-Acked-by: Cornelia Huck <cohuck@redhat.com>
ae23c9
RH-Acked-by: Thomas Huth <thuth@redhat.com>
ae23c9
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
ae23c9
ae23c9
Since "s390x/tcg: avoid overflows in time2tod/tod2time", the
ae23c9
time2tod() function tries to deal with the 9 uppermost bits in the
ae23c9
time value, but uses the wrong mask for this: 0xff80000000000000 should
ae23c9
be used instead of 0xff10000000000000 here.
ae23c9
ae23c9
Fixes: 14055ce53c2d901d826ffad7fb7d6bb8ab46bdfd
ae23c9
Cc: qemu-stable@nongnu.org
ae23c9
Signed-off-by: Thomas Huth <thuth@redhat.com>
ae23c9
Message-Id: <1544792887-14575-1-git-send-email-thuth@redhat.com>
ae23c9
Reviewed-by: David Hildenbrand <david@redhat.com>
ae23c9
[CH: tweaked commit message]
ae23c9
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
ae23c9
(cherry picked from commit aba7a5a2de3dba5917024df25441f715b9249e31)
ae23c9
Signed-off-by: David Hildenbrand <david@redhat.com>
ae23c9
ae23c9
Signed-off-by: Danilo C. L. de Paula <ddepaula@redhat.com>
ae23c9
---
ae23c9
 include/hw/s390x/tod.h | 2 +-
ae23c9
 1 file changed, 1 insertion(+), 1 deletion(-)
ae23c9
ae23c9
diff --git a/include/hw/s390x/tod.h b/include/hw/s390x/tod.h
ae23c9
index cbd7552..47ef9de 100644
ae23c9
--- a/include/hw/s390x/tod.h
ae23c9
+++ b/include/hw/s390x/tod.h
ae23c9
@@ -56,7 +56,7 @@ typedef struct S390TODClass {
ae23c9
 /* Converts ns to s390's clock format */
ae23c9
 static inline uint64_t time2tod(uint64_t ns)
ae23c9
 {
ae23c9
-    return (ns << 9) / 125 + (((ns & 0xff10000000000000ull) / 125) << 9);
ae23c9
+    return (ns << 9) / 125 + (((ns & 0xff80000000000000ull) / 125) << 9);
ae23c9
 }
ae23c9
 
ae23c9
 /* Converts s390's clock format to ns */
ae23c9
-- 
ae23c9
1.8.3.1
ae23c9