From patchwork Wed Oct 11 14:15:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 115561 Delivered-To: patch@linaro.org Received: by 10.140.22.163 with SMTP id 32csp813628qgn; Wed, 11 Oct 2017 07:17:41 -0700 (PDT) X-Received: by 10.36.22.13 with SMTP id a13mr22756185ita.69.1507731461434; Wed, 11 Oct 2017 07:17:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1507731461; cv=none; d=google.com; s=arc-20160816; b=WHVAD2oYOUK2rHOYj/cy9D4jTcZbzDo9l/EZAYRyYOYEIlCHUhWNPszvMWd38TTdUe 4+oS7t/BLfXJ2iR4p+M9kdbrWIQ5XRwKUvryJK5gD3AXXfbC3x+i7JTFWzU4U+6UsU1p Atq1eq2uMMd8LgNgN/9GJrRH5rIbnhwGuOydQG4lZCYMoOUXJfcAS4/AUxDMENBzaosv z91H3f0M5HXGPE0gNQXwATtkz2z/MTMpXYtgHj1IlNwrqiu8q5rxhrZV3dfkHhFMcgJj kAK/CssgAt9ftejzGo8HYL1hYpzTqJlElZeLy9GWaq4OF65v4tzDFcMG1Z4V04xGPcXv XKsg== 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 :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:cc:message-id:date:to:from:dkim-signature :arc-authentication-results; bh=QE9jcJyevvAIpvvbzFKkIjJB3G0d42kLUnk69RzjpxY=; b=L3+U5dqj2/YgVjvy70sRPLRaK5r1RA1DnrQ3vOqYQya47FdIJXBxGPh3U24NaOaZzY j1FzBeq511bmD3vghElql81X6xn93Hw+3MrU8vT0Q0dh8x3t/5nta1b4hwM1sNE5ZamF hV/moEjzKBdgu+2fIXYX3soX6JAZyyw+p29yqfJ+VHFW3/Wzx8oDU79/e4/266G4O+Lh qe+hDXe8k6rMUimwf/BoDWQRE0cTm2alljA/9uqr1QgDtsV1sebK/C/8d66/p0O6++85 4LslUeCd9jY0h2RcoWrB+M2qWmFrDUjqRKA/NSQrLM0b5jTZQXhFFJZLSx8BQQoAmzaB ceUQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=fwf/I6u8; spf=neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) smtp.mailfrom=xen-devel-bounces@lists.xen.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id b7si10163394itj.17.2017.10.11.07.17.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 Oct 2017 07:17:41 -0700 (PDT) Received-SPF: neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) client-ip=192.237.175.120; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=fwf/I6u8; spf=neutral (google.com: 192.237.175.120 is neither permitted nor denied by best guess record for domain of xen-devel-bounces@lists.xen.org) smtp.mailfrom=xen-devel-bounces@lists.xen.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e2HnW-0004RW-Ex; Wed, 11 Oct 2017 14:15:46 +0000 Received: from mail6.bemta6.messagelabs.com ([193.109.254.103]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1e2HnV-0004RC-8F for xen-devel@lists.xen.org; Wed, 11 Oct 2017 14:15:45 +0000 Received: from [85.158.143.35] by server-1.bemta-6.messagelabs.com id F7/49-31121-0972ED95; Wed, 11 Oct 2017 14:15:44 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprHIsWRWlGSWpSXmKPExsVyMfTGBt1e9Xu RBnuvMFss+biYxYHR4+ju30wBjFGsmXlJ+RUJrBltf2YxF/QLVjS3TmFqYJzI28XIxSEkMJFR YvWCXcwgDotAO7PE+0krwRwJgXcsEhemTWXtYuQEcvIk9q26yg5hp0ncPL+LDcKulvg6s5exi 5EDaJSaxJo3URBT+5gkNsxbxAISZxPQkVg3oxakXERAWuLa58uMIDazQIzEogMvwUqEBTIkLn xTAAmzCKhK/D2zA2w6r4CNRMuWBcwQm+QldrVdZJ3AyL+AkWEVo0ZxalFZapGukbFeUlFmekZ JbmJmjq6hgZlebmpxcWJ6ak5iUrFecn7uJkZg+DAAwQ7GP/MDDzFKcjApifJef343UogvKT+l MiOxOCO+qDQntfgQowwHh5IEr5zavUghwaLU9NSKtMwcYCDDpCU4eJREePVUgdK8xQWJucWZ6 RCpU4yWHBfuXPrDxHFgzy0g2XHz7h8mIZa8/LxUKXHeeJB5AiANGaV5cONg0XaJUVZKmJcR6E AhnoLUotzMElT5V4ziHIxKwryWIFN4MvNK4La+AjqICegg0bQ7IAeVJCKkpBoY5VNvHFu2rfD Py6tnnfPbZipE7U55f+Lyh/mzj2zc73j23Xo9OZYoobYPxo3/7nh/KuJ88OP6799mbywytdl0 1eUjf2dcvVW4LjzgZOsE7/Um3zaKH74fedt9fuLViIniAY1/b3ubs9W80DfXbvr21sDkqdt7Y a5vhds35K5VF/zK4GPhaa3wRomlOCPRUIu5qDgRAIEFClSxAgAA X-Env-Sender: julien.grall@linaro.org X-Msg-Ref: server-6.tower-21.messagelabs.com!1507731340!53661663!1 X-Originating-IP: [209.85.216.176] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 6418 invoked from network); 11 Oct 2017 14:15:40 -0000 Received: from mail-qt0-f176.google.com (HELO mail-qt0-f176.google.com) (209.85.216.176) by server-6.tower-21.messagelabs.com with AES128-GCM-SHA256 encrypted SMTP; 11 Oct 2017 14:15:40 -0000 Received: by mail-qt0-f176.google.com with SMTP id z50so5570125qtj.4 for ; Wed, 11 Oct 2017 07:15:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=DAc6i+erjgg1ANbxmUPu18hHyJfnCiKVlmA89bMNIxA=; b=fwf/I6u8rUAP04T3Pa+SMrJCgCsL48JX0Ig25CIGsdmeka5k880Eqi6DvW52lWxBqQ 5uSpvrbBjAcAkXPTkeI9oGte5yQ/iQzciZE2fqCLGt8+zHLD5supHTv2W34maQbYq8Mq w4z6FJNGbBH9TypQd3ZdIkzpcm3FAEM3cjcBE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=DAc6i+erjgg1ANbxmUPu18hHyJfnCiKVlmA89bMNIxA=; b=qXVX8qoJr1yjEQhYzR3CB9WOTP4X85yq25F58COSH4V8u0lEeTQ0uX+l+ck7J+M8xx 7pNtkyMFMyGr98AfmkunCblVCK15mXZqwkIYm0CFuUAha4xPlFzK0Mh299TYKlVUXJc0 1mUP+XRUFtnqkLBKrUdgMOgFuxOB5bkSSOA0cT3Z85N+VU9o6+KP44GrWccqD3R8/AJD VvHSdSve2+SSv57BUeHobrAIesrMMvZxjHdBekJB8O0yLq4FZ34tfiEPwMZfiBhZv4KV 1WWucgaVpphOJwcjpU6T589Pxc3hS1z8CwiWuRAmzv/2dNLkaPm6GJQOTCYS2cW9qXbc SXkQ== X-Gm-Message-State: AMCzsaVc+iyToBkzTQVLlM21pu98S9mwxX6i/eyB65iDKaDE6nGMH2Ej krfkkHPuwKvYWE2oBCEf8OoStx2Ryok= X-Google-Smtp-Source: AOwi7QDT5mIN7a4BHMHcTrXW6ihuxt7PYuh4lE4lR8uUSK8LJc39/KHtTnDsOAz+/vqNKzoyvCAvgA== X-Received: by 10.55.204.157 with SMTP id n29mr17520277qkl.243.1507731339855; Wed, 11 Oct 2017 07:15:39 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com ([2001:41d0:1:6c23::1]) by smtp.gmail.com with ESMTPSA id q206sm7881306qke.54.2017.10.11.07.15.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 Oct 2017 07:15:39 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xen.org Date: Wed, 11 Oct 2017 15:15:33 +0100 Message-Id: <20171011141533.11231-1-julien.grall@linaro.org> X-Mailer: git-send-email 2.11.0 Cc: andre.przywara@arm.com, sstabellini@kernel.org, Julien Grall Subject: [Xen-devel] [PATCH for-4.10] xen/arm: mm: Rework MAIR* definitions to handle 32-bit compilation environment X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" Commit a0543df403 "xen/arm: page: Clean-up the definition of MAIRVAL" combined the definition of MAIR0VAL and MAIR1VAL in MAIRVAL. Sadly, when building in 32-bit environment, the assembler is unable to compute 64-bit constant and will ignore the 32-bit most-significants bits. This will result of MAIR1 set 0. Rather than fully reverting the offending commit, the code is reworked to still avoid hardcoded values but split the definition in 2. Lastly, a comment is added to avoid trying to blindly combine the both definition again in the future. Signed-off-by: Julien Grall Reviewed-by: Andre Przywara Reviewed-by: Stefano Stabellini --- xen/include/asm-arm/page.h | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/xen/include/asm-arm/page.h b/xen/include/asm-arm/page.h index f558184e10..d948250a4a 100644 --- a/xen/include/asm-arm/page.h +++ b/xen/include/asm-arm/page.h @@ -52,18 +52,23 @@ * ?? 101 * reserved 110 * MT_NORMAL 111 1111 1111 -- Write-back write-allocate + * + * /!\ It is not possible to combine the definition in MAIRVAL and then + * split because it would result to a 64-bit value that some assembler + * doesn't understand. */ -#define MAIR(attr, mt) (_AC(attr, ULL) << ((mt) * 8)) +#define _MAIR0(attr, mt) (_AC(attr, ULL) << ((mt) * 8)) +#define _MAIR1(attr, mt) (_AC(attr, ULL) << (((mt) * 8) - 32)) + +#define MAIR0VAL (_MAIR0(0x00, MT_DEVICE_nGnRnE)| \ + _MAIR0(0x44, MT_NORMAL_NC) | \ + _MAIR0(0xaa, MT_NORMAL_WT) | \ + _MAIR0(0xee, MT_NORMAL_WB)) -#define MAIRVAL (MAIR(0x00, MT_DEVICE_nGnRnE)| \ - MAIR(0x44, MT_NORMAL_NC) | \ - MAIR(0xaa, MT_NORMAL_WT) | \ - MAIR(0xee, MT_NORMAL_WB) | \ - MAIR(0x04, MT_DEVICE_nGnRE) | \ - MAIR(0xff, MT_NORMAL)) +#define MAIR1VAL (_MAIR1(0x04, MT_DEVICE_nGnRE) | \ + _MAIR1(0xff, MT_NORMAL)) -#define MAIR0VAL (MAIRVAL & 0xffffffff) -#define MAIR1VAL (MAIRVAL >> 32) +#define MAIRVAL (MAIR1VAL << 32 | MAIR0VAL) /* * Layout of the flags used for updating the hypervisor page tables