From patchwork Fri Dec 14 13:08:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Huth X-Patchwork-Id: 10731117 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EE9C916B1 for ; Fri, 14 Dec 2018 13:08:58 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C94172C707 for ; Fri, 14 Dec 2018 13:08:58 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B86452C722; Fri, 14 Dec 2018 13:08:58 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 641A42C707 for ; Fri, 14 Dec 2018 13:08:58 +0000 (UTC) Received: from localhost ([::1]:33430 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gXnD7-000690-7T for patchwork-qemu-devel@patchwork.kernel.org; Fri, 14 Dec 2018 08:08:57 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:32878) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gXnCV-0005pC-A6 for qemu-devel@nongnu.org; Fri, 14 Dec 2018 08:08:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gXnCS-0007PW-Jl for qemu-devel@nongnu.org; Fri, 14 Dec 2018 08:08:19 -0500 Received: from mx1.redhat.com ([209.132.183.28]:60166) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gXnCS-0007NX-DD; Fri, 14 Dec 2018 08:08:16 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id AEA57753E2; Fri, 14 Dec 2018 13:08:15 +0000 (UTC) Received: from thuth.com (reserved-198-198.str.redhat.com [10.33.198.198]) by smtp.corp.redhat.com (Postfix) with ESMTP id 76B1B29AD7; Fri, 14 Dec 2018 13:08:11 +0000 (UTC) From: Thomas Huth To: qemu-s390x@nongnu.org, Cornelia Huck Date: Fri, 14 Dec 2018 14:08:07 +0100 Message-Id: <1544792887-14575-1-git-send-email-thuth@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Fri, 14 Dec 2018 13:08:15 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH] hw/s390x: Fix bad mask in time2tod() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Halil Pasic , Christian Borntraeger , qemu-stable@nongnu.org, qemu-devel@nongnu.org, David Hildenbrand Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP The time2tod() function tries to deal with the 9 uppermost bits in the time value, but uses the wrong mask for this: 0xff80000000000000 should be used instead of 0xff10000000000000 here. Fixes: 14055ce53c2d901d826ffad7fb7d6bb8ab46bdfd Signed-off-by: Thomas Huth Reviewed-by: David Hildenbrand --- include/hw/s390x/tod.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/hw/s390x/tod.h b/include/hw/s390x/tod.h index cbd7552..47ef9de 100644 --- a/include/hw/s390x/tod.h +++ b/include/hw/s390x/tod.h @@ -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 */