From patchwork Mon Aug 8 17:49:35 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laura Abbott X-Patchwork-Id: 9269091 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5EC6660871 for ; Mon, 8 Aug 2016 17:52:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5591028161 for ; Mon, 8 Aug 2016 17:52:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4779228156; Mon, 8 Aug 2016 17:52:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 01DC428156 for ; Mon, 8 Aug 2016 17:52:18 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1bWohR-0001di-CJ; Mon, 08 Aug 2016 17:50:53 +0000 Received: from mail-qt0-f180.google.com ([209.85.216.180]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1bWogr-0000DV-TG for linux-arm-kernel@lists.infradead.org; Mon, 08 Aug 2016 17:50:19 +0000 Received: by mail-qt0-f180.google.com with SMTP id w38so207428106qtb.0 for ; Mon, 08 Aug 2016 10:49:57 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=SPfLH6ykV+4jxiwFv44rYlECsobhRBcVqpGSt+yUtl0=; b=VNGIS5GKzIsP5f2kVVYEY/Q0aDT+mIOY8zY0bs8DUHqpzGALQRghmDnHoQD2nMlcCs 4E5xbjESA6UQDhG8FUlHcDKcuZhhNktwBRm2W/P3WDO7nvceMBRvAtS8hvCdSGl7Tb70 44PO7FpHH1ERNbNqONNL0pmEedTtaBuQ0ebLqbs53dYA7UwhuGjUbrDlHduxDVdosc/4 qUQGONR4IaQkrCsJlF4znmXX4Y+HqoybBg88t7pouWY8jGnhKCFcmhpl5yC5Mt2McHkV FY/lBxsFoa/AksgBh95VVtxrs/7Y9s7HqisdYMzsTNpWpNjzYcPVUTN8H3CPBUUfldu2 pZww== X-Gm-Message-State: AEkoouvw0q/vBB6V1ixown8K2jw80T+8aYhsS62seMUXweJwrIXXi4Thgkw/m9NnksyuQw3j X-Received: by 10.237.37.58 with SMTP id v55mr30021469qtc.9.1470678596708; Mon, 08 Aug 2016 10:49:56 -0700 (PDT) Received: from labbott-redhat-machine.redhat.com ([2601:602:9800:177f::337f]) by smtp.gmail.com with ESMTPSA id v22sm18036577qtc.19.2016.08.08.10.49.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 08 Aug 2016 10:49:55 -0700 (PDT) From: Laura Abbott To: Sumit Semwal , John Stultz , =?UTF-8?q?Arve=20Hj=C3=B8nnev=C3=A5g?= , Riley Andrews Subject: [RFCv2][PATCH 3/5] arm64: Implement ARCH_HAS_FORCE_CACHE Date: Mon, 8 Aug 2016 10:49:35 -0700 Message-Id: <1470678577-14010-4-git-send-email-labbott@redhat.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1470678577-14010-1-git-send-email-labbott@redhat.com> References: <1470678577-14010-1-git-send-email-labbott@redhat.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160808_105018_172441_CB3D0C9A X-CRM114-Status: GOOD ( 10.23 ) 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: devel@driverdev.osuosl.org, Jon Medhurst , Android Kernel Team , Greg Kroah-Hartman , Daniel Vetter , Will Deacon , Russell King , linux-kernel@vger.kernel.org, linaro-mm-sig@lists.linaro.org, Rohit kumar , Bryan Huntsman , Jeremy Gebben , Eun Taik Lee , Catalin Marinas , Liviu Dudau , Laura Abbott , Mitchel Humpherys , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP arm64 may need to guarantee the caches are synced. Implement versions of the kernel_force_cache API based on the DMA APIs. Signed-off-by: Laura Abbott --- arch/arm64/include/asm/cacheflush.h | 5 +++++ arch/arm64/mm/flush.c | 11 +++++++++++ 2 files changed, 16 insertions(+) diff --git a/arch/arm64/include/asm/cacheflush.h b/arch/arm64/include/asm/cacheflush.h index c64268d..9980dd8 100644 --- a/arch/arm64/include/asm/cacheflush.h +++ b/arch/arm64/include/asm/cacheflush.h @@ -149,4 +149,9 @@ int set_memory_rw(unsigned long addr, int numpages); int set_memory_x(unsigned long addr, int numpages); int set_memory_nx(unsigned long addr, int numpages); +#define ARCH_HAS_FORCE_CACHE 1 + +void kernel_force_cache_clean(struct page *page, size_t size); +void kernel_force_cache_invalidate(struct page *page, size_t size); + #endif diff --git a/arch/arm64/mm/flush.c b/arch/arm64/mm/flush.c index 43a76b0..0af78ab 100644 --- a/arch/arm64/mm/flush.c +++ b/arch/arm64/mm/flush.c @@ -20,6 +20,7 @@ #include #include #include +#include #include #include @@ -94,3 +95,13 @@ EXPORT_SYMBOL(flush_dcache_page); * Additional functions defined in assembly. */ EXPORT_SYMBOL(flush_icache_range); + +void kernel_force_cache_clean(struct page *page, size_t size) +{ + __dma_map_area(page_address(page), size, DMA_BIDIRECTIONAL); +} + +void kernel_force_cache_invalidate(struct page *page, size_t size) +{ + __dma_unmap_area(page_address(page), size, DMA_BIDIRECTIONAL); +}