From patchwork Fri Sep 11 17:22:01 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Catalin Marinas X-Patchwork-Id: 53492 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f199.google.com (mail-wi0-f199.google.com [209.85.212.199]) by patches.linaro.org (Postfix) with ESMTPS id C9F87215BF for ; Fri, 11 Sep 2015 17:23:47 +0000 (UTC) Received: by wisv5 with SMTP id v5sf21084060wis.0 for ; Fri, 11 Sep 2015 10:23:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:subject:date:message-id :in-reply-to:references:precedence:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:cc:mime-version :content-type:content-transfer-encoding:sender:errors-to :x-original-sender:x-original-authentication-results:mailing-list; bh=FBdDmcySe2E2AUxJiYz49A1vVdfe2X30GJfw8vaNMlw=; b=LrAm9ePwzT/5tQt9auvQJV+4wYK4+CaiZ0El4pDGNeFMu6Q0pFv4ATrb7cE5+PwIKh z2n3ZeQyLw4JHFs+WIDAkUB0zjwdG1lAh2c1wtXMdRRiCFsBSJNcqYtJvRQFycaBpJSJ W4AzlZNZ/qcYXkMHIOvu/ssuJNfyuZ917HtHChPN46HMMyYnnre1oJvadHQ+INGDqt/K 7Nxa+cTetbgQprBo24JQhJ3z7kTkviN+HEely5ZLuS7I2qlIeXA7f0CiEkW4qhY0CUxo e/J6Zk5zfBWP6hPshXqmC1dwJ1q8YXdbj5kCX8dJfwP6bLLrh1+89T4LcOyE1ucal3Ak CSDg== X-Gm-Message-State: ALoCoQly7XDTpq3qdaSsQsvijdNAQPC+VY6mLXh+2khe6IEAPOSfvBcxV65YJVg7+HWBM3FSOlUl X-Received: by 10.112.99.37 with SMTP id en5mr11644974lbb.7.1441992226912; Fri, 11 Sep 2015 10:23:46 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.204.200 with SMTP id la8ls347470lac.96.gmail; Fri, 11 Sep 2015 10:23:46 -0700 (PDT) X-Received: by 10.152.1.72 with SMTP id 8mr29009864lak.70.1441992226625; Fri, 11 Sep 2015 10:23:46 -0700 (PDT) Received: from mail-la0-f52.google.com (mail-la0-f52.google.com. [209.85.215.52]) by mx.google.com with ESMTPS id kx10si823080lac.157.2015.09.11.10.23.46 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 11 Sep 2015 10:23:46 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.52 as permitted sender) client-ip=209.85.215.52; Received: by lanb10 with SMTP id b10so52030302lan.3 for ; Fri, 11 Sep 2015 10:23:46 -0700 (PDT) X-Received: by 10.112.129.202 with SMTP id ny10mr18654018lbb.112.1441992226493; Fri, 11 Sep 2015 10:23:46 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.59.35 with SMTP id w3csp1741518lbq; Fri, 11 Sep 2015 10:23:45 -0700 (PDT) X-Received: by 10.107.46.136 with SMTP id u8mr5524041iou.69.1441992225552; Fri, 11 Sep 2015 10:23:45 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id lp4si76663igb.86.2015.09.11.10.23.45 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 11 Sep 2015 10:23:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) client-ip=2001:1868:205::9; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZaS1x-0004XA-Id; Fri, 11 Sep 2015 17:22:33 +0000 Received: from foss.arm.com ([217.140.101.70]) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZaS1v-0004Hl-03 for linux-arm-kernel@lists.infradead.org; Fri, 11 Sep 2015 17:22:31 +0000 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 41E3C491; Fri, 11 Sep 2015 10:22:23 -0700 (PDT) Received: from e104818-lin.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id A11CF3F21A; Fri, 11 Sep 2015 10:22:10 -0700 (PDT) From: Catalin Marinas To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 2/3] arm64: Fix pte_modify() to preserve the hardware dirty information Date: Fri, 11 Sep 2015 18:22:01 +0100 Message-Id: <1441992122-19888-3-git-send-email-catalin.marinas@arm.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1441992122-19888-1-git-send-email-catalin.marinas@arm.com> References: <1441992122-19888-1-git-send-email-catalin.marinas@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150911_102231_047123_AEF36F24 X-CRM114-Status: UNSURE ( 9.13 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -6.9 (------) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-6.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high trust [217.140.101.70 listed in list.dnswl.org] -0.0 T_RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , Cc: Julien Grall , Will Deacon MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: catalin.marinas@arm.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.52 as permitted sender) smtp.mailfrom=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 The pte_modify() function with hardware AF/DBM enabled must transfer the hardware dirty information to the software PTE_DIRTY bit. However, it was setting this bit in newprot and the mask does not cover such bit. This patch sets PTE_DIRTY on the original pte which will be preserved in the returned value. Signed-off-by: Catalin Marinas Cc: Will Deacon Cc: Julien Grall Fixes: 2f4b829c625e ("arm64: Add support for hardware updates of the access and dirty pte bits") --- arch/arm64/include/asm/pgtable.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/include/asm/pgtable.h b/arch/arm64/include/asm/pgtable.h index 69207f016891..31df98adf005 100644 --- a/arch/arm64/include/asm/pgtable.h +++ b/arch/arm64/include/asm/pgtable.h @@ -503,7 +503,7 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) PTE_PROT_NONE | PTE_WRITE | PTE_TYPE_MASK; /* preserve the hardware dirty information */ if (pte_hw_dirty(pte)) - newprot |= PTE_DIRTY; + pte = pte_mkdirty(pte); pte_val(pte) = (pte_val(pte) & ~mask) | (pgprot_val(newprot) & mask); return pte; }