From patchwork Thu Jun 20 17:47:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 167346 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp2365374ilk; Thu, 20 Jun 2019 10:48:47 -0700 (PDT) X-Google-Smtp-Source: APXvYqyQKOt0vAhzs+TqqnQb+1uNmA7XniPbOM8QOFRTzNu+eeeBujCy/z9lJd89jbzboQLISY9E X-Received: by 2002:a5e:da4b:: with SMTP id o11mr14459564iop.212.1561052927845; Thu, 20 Jun 2019 10:48:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561052927; cv=none; d=google.com; s=arc-20160816; b=db096tltWLZme/OD62PJz+kALJciq06DOQRWnNLckwACVbVRX2QR9/pi/Mdh/rM1Sp 6K0iuq3w0L2aanYxW78qIyji3wgaJ5CIpY2LanFgh3v4PQ24HRLnf9NYPGqaWJSnD2wr GDr5BOPIxRSAaHR2SMNqRe2stxwU/d7phqW3+M7SE6TgVSgL43jHIv94KtanpTDoU019 Faln4diseSzlezcJqkJnCdKjD7wO+kiWFwtpsvb3yaXSbVXPvUv6uA5+DxiR2r7ZCNQ3 Kpoe9zo9RxFBLC7rmy8edUgJlJnumoaD+U1k+5NFka2wdgJMdBM8xrtJdDZ6+uZkYPL+ Ft7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:message-id:date:to:from; bh=xfTW/DDZL+qg5EXnFACIbtS4+IE5W0+QUin4o/5ywEY=; b=AwqBn50Pgqp78ZfRQQJRm3ZQfqFs+ZAwzaQF+Vkp//HwC7/PktCaU/IEWPNKt5UDOW ULceuplDef570wiXvIh+rrw61NjvOEzOejGkRrJzzwLNyYOdTD7IA8xD3ZH79cxhHzx9 dVXpK4GNbhACeLVPH8arayaTcgw7HM7JpBSxvxThgnCjP1tbuwTgjlWJvQ2EQpumS3ws Mza5PzwZrYWMMTphrqeyTzWRK+4Ea1ZDO7ijwzKNwqJwtgzbDoZLs3diMoq+kRGVkAjq PsUUvaPiUjYA52zwJ1XmpQHCXr8khbXScZ43IbvE+WwvvUrMKyIbUKT0R+sItWNtGPNZ vRcA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id a13si80020jah.77.2019.06.20.10.48.47 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 20 Jun 2019 10:48:47 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1he19Y-00015b-T0; Thu, 20 Jun 2019 17:47:16 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1he19X-00015S-Ma for xen-devel@lists.xenproject.org; Thu, 20 Jun 2019 17:47:15 +0000 X-Inumbo-ID: 6eafa8c8-9383-11e9-ba41-4327d1b8e17c Received: from foss.arm.com (unknown [217.140.110.172]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTP id 6eafa8c8-9383-11e9-ba41-4327d1b8e17c; Thu, 20 Jun 2019 17:47:12 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id A0FFF360; Thu, 20 Jun 2019 10:47:11 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.196.50]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id CFAE83F246; Thu, 20 Jun 2019 10:47:10 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Thu, 20 Jun 2019 18:47:06 +0100 Message-Id: <20190620174706.16657-1-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 Subject: [Xen-devel] [PRE-4.12 PATCH] xen/arm: time: cycles_t should be an uint64_t and not unsigned long X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Julien Grall , sstabellini@kernel.org, ian.jackson@eu.citrix.com, jbeulich@suse.com MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" Since commit ca73ac8e7d "xen/arm: Add an isb() before reading CNTPCT_EL0 to prevent re-ordering", get_cycles() is now returning the number of cycles and used in more callers. While the counter registers is always 64-bit, get_cycles() will only reutrn a 32-bit on Arm32 and therefore truncate the value. This will result to weird behavior by both Xen and the Guest as the timer will not be setup correctly. This could be resolved by switch cycles_t from unsigned long to unsigned int. Signed-off-by: Julien Grall Reviewed-by: Stefano Stabellini --- This is only targeting xen 4.11 and earlier. Xen 4.12 and later have a correct definition of cycles_t thanks to da3d55ae67 "console: avoid printing no or null time stamps". This will hopefully unblock osstest on staging-4.10 and staging-4.11. This patch should be backported up to Xen 4.8. --- xen/include/asm-arm/time.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xen/include/asm-arm/time.h b/xen/include/asm-arm/time.h index ca30406669..bd7dc86d78 100644 --- a/xen/include/asm-arm/time.h +++ b/xen/include/asm-arm/time.h @@ -7,7 +7,7 @@ DT_MATCH_COMPATIBLE("arm,armv7-timer"), \ DT_MATCH_COMPATIBLE("arm,armv8-timer") -typedef unsigned long cycles_t; +typedef uint64_t cycles_t; static inline cycles_t get_cycles (void) {