From patchwork Wed Mar 27 18:45:25 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 161267 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp6828968jan; Wed, 27 Mar 2019 11:47:28 -0700 (PDT) X-Google-Smtp-Source: APXvYqwAnERpIgEXsZgcMedbzfnJRwHS15/cg34i9Cc/w+lapJMTdgZeJRrUDdxP5gsEftpTITmq X-Received: by 2002:a81:2511:: with SMTP id l17mr33593795ywl.288.1553712448254; Wed, 27 Mar 2019 11:47:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553712448; cv=none; d=google.com; s=arc-20160816; b=E685JAOolph76vRAl2C4cUiMGA3lTg+CnzCLR3SH/cJZDdY7O+ktDGK6zj53vgHsto VZ1MDVDjzAn5qax0S0W9lDkhVZab3kR1YJA/FNAdHAHUEsfEytbrZHxg6KKK53u7vXEA 5aRPQB0mbOSeYOLQKzdcv8Rz4ifcYtgxGftA+uY/aQcmABx3qdWuT4GwdDcL/bWIbARY TpXgEUDoKZCC7poFQ7Y0+KNeuQSjnD8Hn31GIv5krDkI1WByCzXTLM+s+VaU/eRN6xhR X7j5y2QrzvUWGw3MeowUXEQmZL+9YsqyMVBCrl778sTrR5WhtQIUZMPx51B51zW017un r8Aw== 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:references:in-reply-to:message-id:date:to:from; bh=8DqzNT+1eqAUVQzUS8cZmk13+wbzfmV2BRc/+KDKHWY=; b=yP5Wpf0QipFKhHAwqzfdb1XI5GRHQaErivee5F8Bee9LnO5M1vYg29oJNehkmJcjSo 1aMouUVBLhPD9FGzTtdZST4dt2b+0GaOEY3nIvkuhwxxfxXrRRrh42jrWnBLYHZYYf1I t4WnTeSZGAoIbztlMaORMym5uTEBh4LnNxZTrzbyFWSvPw5K3ia30KchoGEm5J3lJEYW 9JUz1WnoppBNt+efDzBwr5PE3PvA+IosRVJfjNtAu3LkEoCZS8yoyacgPQDPdZBSHIGY lUG2rc899xtQmx95NKhkMUg3roonxkMs/ytgse47tC65kV2GwoexAZcjDTeeb+AEvalH DuZw== 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 b12si7453692ywh.256.2019.03.27.11.47.28 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 27 Mar 2019 11:47:28 -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 1h9DYf-0001jh-BY; Wed, 27 Mar 2019 18:45:53 +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 1h9DYe-0001jU-6j for xen-devel@lists.xenproject.org; Wed, 27 Mar 2019 18:45:52 +0000 X-Inumbo-ID: 8b6cb592-50c0-11e9-aa93-9f7bd1018adb Received: from foss.arm.com (unknown [217.140.101.70]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTP id 8b6cb592-50c0-11e9-aa93-9f7bd1018adb; Wed, 27 Mar 2019 18:45:51 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 3FED315BF; Wed, 27 Mar 2019 11:45:51 -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 0BA3E3F557; Wed, 27 Mar 2019 11:45:49 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Wed, 27 Mar 2019 18:45:25 +0000 Message-Id: <20190327184531.30986-7-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190327184531.30986-1-julien.grall@arm.com> References: <20190327184531.30986-1-julien.grall@arm.com> Subject: [Xen-devel] [PATCH 06/12] xen/arm64: sysreg: Implement the 32-bit helpers using the 64-bit helpers 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: Artem_Mygaiev@epam.com, Oleksandr_Tyshchenko@epam.com, Julien Grall , sstabellini@kernel.org, Andrii_Anisov@epam.com MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" Clang is pickier than GCC for the register size in asm statement. It expects the register size to match the value size. The instructions msr/mrs are expecting a 64-bit register. This means the implementation of the 32-bit helpers is not correct. The easiest solution is to implement the 32-bit helpers using the 64-bit helpers. Signed-off-by: Julien Grall Reviewed-by: Stefano Stabellini --- xen/include/asm-arm/arm64/sysregs.h | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/xen/include/asm-arm/arm64/sysregs.h b/xen/include/asm-arm/arm64/sysregs.h index 08585a969e..c60029d38f 100644 --- a/xen/include/asm-arm/arm64/sysregs.h +++ b/xen/include/asm-arm/arm64/sysregs.h @@ -59,14 +59,9 @@ /* Access to system registers */ -#define READ_SYSREG32(name) ({ \ - uint32_t _r; \ - asm volatile("mrs %0, "__stringify(name) : "=r" (_r)); \ - _r; }) -#define WRITE_SYSREG32(v, name) do { \ - uint32_t _r = v; \ - asm volatile("msr "__stringify(name)", %0" : : "r" (_r)); \ -} while (0) +#define READ_SYSREG32(name) ((uint32_t)READ_SYSREG64(name)) + +#define WRITE_SYSREG32(v, name) WRITE_SYSREG64((uint64_t)v, name) #define WRITE_SYSREG64(v, name) do { \ uint64_t _r = v; \