From patchwork Thu May 23 15:31:18 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Capper X-Patchwork-Id: 17153 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-vb0-f72.google.com (mail-vb0-f72.google.com [209.85.212.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 1D7002395B for ; Thu, 23 May 2013 15:32:32 +0000 (UTC) Received: by mail-vb0-f72.google.com with SMTP id w15sf2587689vbf.3 for ; Thu, 23 May 2013 08:31:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-beenthere:x-forwarded-to:x-forwarded-for :delivered-to:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references:x-gm-message-state:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-google-group-id:list-post:list-help:list-archive:list-unsubscribe; bh=yMRp6DqyadI+R7o8GRoUhwPynV91kcdDpcysP8MKPb4=; b=h3SnKuIC3X7FLG30g9FZlor+DXM5lfc8NVLQ1jJI3NoVNIp6I++N2dlfHincAT9IPx km8tkHqNiB8RNyiH8Gi2afwGdRVAlqI771ZCNjE4vfwWBULg5w5GnxGuYu891JJJjjjJ egtLvAq7L7NfRk3A724+EO3TUxMEIF6cVVuHZ8khk460yoe4/kagnYDqZLFgxe6eC5KG 3S9+UHGtC1rNBu/V2E3IQfDaDGGItccp5Qv3iR7wLMSpKKYg/RTmnoDnz0jezB9LVUzK poShay2stQBi3S6y06tK8RyTSeAuMqOQXEOBO0lxGNmUCN9i0cXnp7y3Tq5lou6vNEqj Mz+g== X-Received: by 10.236.139.134 with SMTP id c6mr6567805yhj.7.1369323096677; Thu, 23 May 2013 08:31:36 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.29.3 with SMTP id f3ls1414891qeh.83.gmail; Thu, 23 May 2013 08:31:36 -0700 (PDT) X-Received: by 10.58.90.5 with SMTP id bs5mr5527258veb.60.1369323096453; Thu, 23 May 2013 08:31:36 -0700 (PDT) Received: from mail-vc0-f180.google.com (mail-vc0-f180.google.com [209.85.220.180]) by mx.google.com with ESMTPS id sc6si6649710vdc.73.2013.05.23.08.31.36 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 23 May 2013 08:31:36 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.180 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.180; Received: by mail-vc0-f180.google.com with SMTP id gd11so2318769vcb.11 for ; Thu, 23 May 2013 08:31:36 -0700 (PDT) X-Received: by 10.52.176.65 with SMTP id cg1mr4819539vdc.1.1369323096312; Thu, 23 May 2013 08:31:36 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.126.138 with SMTP id c10csp57329vcs; Thu, 23 May 2013 08:31:35 -0700 (PDT) X-Received: by 10.180.205.200 with SMTP id li8mr25799595wic.15.1369323092446; Thu, 23 May 2013 08:31:32 -0700 (PDT) Received: from mail-wg0-x236.google.com (mail-wg0-x236.google.com [2a00:1450:400c:c00::236]) by mx.google.com with ESMTPS id dd6si9245941wib.71.2013.05.23.08.31.32 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 23 May 2013 08:31:32 -0700 (PDT) Received-SPF: neutral (google.com: 2a00:1450:400c:c00::236 is neither permitted nor denied by best guess record for domain of steve.capper@linaro.org) client-ip=2a00:1450:400c:c00::236; Received: by mail-wg0-f54.google.com with SMTP id j13so755543wgh.21 for ; Thu, 23 May 2013 08:31:32 -0700 (PDT) X-Received: by 10.180.185.207 with SMTP id fe15mr25437163wic.33.1369323092021; Thu, 23 May 2013 08:31:32 -0700 (PDT) Received: from localhost.localdomain (marmot.wormnet.eu. [188.246.204.87]) by mx.google.com with ESMTPSA id b11sm36416484wiv.10.2013.05.23.08.31.31 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 23 May 2013 08:31:31 -0700 (PDT) From: Steve Capper To: linux-arm-kernel@lists.infradead.org Cc: will.deacon@arm.com, patches@linaro.org, Steve Capper Subject: [PATCH v2 2/4] ARM: mm: Add support for flushing HugeTLB pages. Date: Thu, 23 May 2013 16:31:18 +0100 Message-Id: <1369323080-9673-3-git-send-email-steve.capper@linaro.org> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1369323080-9673-1-git-send-email-steve.capper@linaro.org> References: <1369323080-9673-1-git-send-email-steve.capper@linaro.org> X-Gm-Message-State: ALoCoQn5DPd2fsVXwWBe9eFioYjFW1aYtvG5hZHgJfiYrUmpBNHaEscIMnsxaaUXJqeJgfi77ppd X-Original-Sender: steve.capper@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.180 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , On ARM we use the __flush_dcache_page function to flush the dcache of pages when needed; usually when the PG_dcache_clean bit is unset and we are setting a PTE. A HugeTLB page is represented as a compound page consisting of an array of pages. Thus to flush the dcache of a HugeTLB page, one must flush more than a single page. This patch modifies __flush_dcache_page such that all constituent pages of a HugeTLB page are flushed. Signed-off-by: Steve Capper Reviewed-by: Will Deacon Reviewed-by: Catalin Marinas --- arch/arm/mm/flush.c | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/arch/arm/mm/flush.c b/arch/arm/mm/flush.c index 0d473cc..3706407 100644 --- a/arch/arm/mm/flush.c +++ b/arch/arm/mm/flush.c @@ -17,6 +17,7 @@ #include #include #include +#include #include "mm.h" @@ -168,19 +169,23 @@ void __flush_dcache_page(struct address_space *mapping, struct page *page) * coherent with the kernels mapping. */ if (!PageHighMem(page)) { - __cpuc_flush_dcache_area(page_address(page), PAGE_SIZE); + size_t page_size = PAGE_SIZE << compound_order(page); + __cpuc_flush_dcache_area(page_address(page), page_size); } else { - void *addr; - + unsigned long i; if (cache_is_vipt_nonaliasing()) { - addr = kmap_atomic(page); - __cpuc_flush_dcache_area(addr, PAGE_SIZE); - kunmap_atomic(addr); - } else { - addr = kmap_high_get(page); - if (addr) { + for (i = 0; i < (1 << compound_order(page)); i++) { + void *addr = kmap_atomic(page); __cpuc_flush_dcache_area(addr, PAGE_SIZE); - kunmap_high(page); + kunmap_atomic(addr); + } + } else { + for (i = 0; i < (1 << compound_order(page)); i++) { + void *addr = kmap_high_get(page); + if (addr) { + __cpuc_flush_dcache_area(addr, PAGE_SIZE); + kunmap_high(page); + } } } }