From patchwork Thu May 20 12:43:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fuad Tabba X-Patchwork-Id: 12270197 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E0F9FC4361A for ; Thu, 20 May 2021 12:49:33 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 56E1861001 for ; Thu, 20 May 2021 12:49:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 56E1861001 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:Cc:To:From:Subject:References:Mime-Version: Message-Id:In-Reply-To:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=LcsFymNCXUySFt76tFHQkKWYPJv99YL9m/jvK4/zxT8=; b=VCirSfcDiAUXIV s4sTQoZMV6yWL+nif4jAOaDOY1Q8qSU0gcpKWA86bscdgBz2hvemCfp70PWO1hXdUebe5ARTlBbSX TDdcLWneTn+72n5gtoWKWLiXKGLVZWJDZm2T48BiNwUhizrzpz48lmAHsxr1m3NvZ1MNg+fh5RkRX 5L3K4dNcLA7fSQBxpi/0ZXJVc2/a4hdbLOrQS0gBxKGgFUSFj1UFYNkEUJNHM3OK8TdDth+M2X+Mj 9cTh11219Fk8vDKBrIKWU53xjVCzn7uTdBLyye3Btvq1ViswqELwZcIOvoLU2Azs1ZL2526tqoZ2B NDWCaM9L+7O/u/Vci91g==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lji5k-000wN3-3Z; Thu, 20 May 2021 12:47:56 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lji2U-000u1s-CZ for linux-arm-kernel@desiato.infradead.org; Thu, 20 May 2021 12:44:34 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Type:Cc:To:From:Subject: References:Mime-Version:Message-Id:In-Reply-To:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=E2iNWjxbuYP1ToNdaOW918Q7826xkkT2mW79gH162Vc=; b=r6EBJAACwy+WrgSe9wA23iY8/w nVIeb0m9hWooZfNKmpYIQvWe7wZ3Jc+3v6amIvKtfi58q4+Di8PfRT4ixPfaMWcW/ENkweXD4P2Ph kDZKrqFxqzYTbSkhhvl0cMBv5VCy7cRvQhPub/zMm1WdZjUY8KSVlsamFCCR2hTMFSyKB+Tt6cm98 FI8hRB/y966ROPmM5kuhEdbK5R9ipXiGGMIuuUHJXBLt8WtpsOH+pUIGBRmWL9+yTdrc4RHS3bDq4 oJmqb5jsQK3DH1KIXynWUEqUZM3fBGgyU9GrZlIdPRWTNC58jNbJkC1eBtpSTI8NUWg8IcmmdZMhM Bl9T4v2g==; Received: from mail-wm1-x34a.google.com ([2a00:1450:4864:20::34a]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lji2R-00GKfD-Mt for linux-arm-kernel@lists.infradead.org; Thu, 20 May 2021 12:44:33 +0000 Received: by mail-wm1-x34a.google.com with SMTP id n127-20020a1c27850000b02901717a27c785so2289399wmn.9 for ; Thu, 20 May 2021 05:44:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=E2iNWjxbuYP1ToNdaOW918Q7826xkkT2mW79gH162Vc=; b=HXWJc/n3DAhHhZa7egbmncaGnAWr5CyALt1mThq5yQFO6xwwasJnao5d3ysK2lljgE d7M6ZriD3l3UG+3Jqyg0iruvxNZt9N6PCMU+KzzTS/Uh6R46g0yxAYRbvOE/ZhSDaDBw mQZS7maRHE1VPhd4g2vLl9zJj4iYX+iLGdn4IIiltaI3RVRqpbuILJXVnjk4/OWe/Upi BZKWTgVzYjSHZCUdzRnBlaDX/jCEERFrJ4Ah5uCkn2/tYhF5N/bGK+MQqPgqs17BWjVy qPkA8/J7rANl9+aWwiSlG4u/9r4GNwST559yPP6sLJ2cC9X85vhU0RqXuJWhBuHiVATP qAJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=E2iNWjxbuYP1ToNdaOW918Q7826xkkT2mW79gH162Vc=; b=MUAuYrARjmPrWnfP7Rc3ivoNU9V4KgMCVC+O7z+q737SwkxbRjSMCEIkz5E5HAc4Ed /S+Cue3vd7pHrOlbBtpRXK6PT3IdFSFkRWDAD3J+5YRRDfwvAcdKCyEr3ina3HWy6fVH PtGgus8OVlryNUsa2fWZyznBaL7oxRZI7WK2cOQncmt1/PQcYVmp2eNyfc4R1F4TJyTH CX5gWMNyq4+jqGKRfgqtROMZ9CSEM1STWrk3Q3zj7qX7dY6Gf4OQf2JSCZew7iSvB0aL JjpYavAPQgA8d+f998w10CbwO9mlPge9Uaxfxad5clWd5z9XD46I695+41qR1Q8Gy7ym Jvgg== X-Gm-Message-State: AOAM530PzNcNa4N0JlhxQ7it5ZShKWghcQT9FzspYMtqTroKFV879Cg/ i5kADdVlR4RW+ZGbIq4gdmpl+Tm+roveVo0gVhjLOIUPlSLT9WrKCyxfo6DWIWJzsppS+UYcwHc x9mLJ25Bp8YPxm0wP03FVD3vWGEK7eHwj+L6JDPJIPp8F168wKj+oiW8fWam5h7wLZs3ZZgmUBK DGug== X-Google-Smtp-Source: ABdhPJzofVO53IUQ4nGzc798SqPFGMEcnD7jqmbI3jSRqVrdINY3ZONVgBDkTG3l6IvCwtlQTG5CxaI6MA== X-Received: from tabba.c.googlers.com ([fda3:e722:ac3:10:28:9cb1:c0a8:482]) (user=tabba job=sendgmr) by 2002:a7b:c344:: with SMTP id l4mr3861265wmj.120.1621514669568; Thu, 20 May 2021 05:44:29 -0700 (PDT) Date: Thu, 20 May 2021 13:43:58 +0100 In-Reply-To: <20210520124406.2731873-1-tabba@google.com> Message-Id: <20210520124406.2731873-11-tabba@google.com> Mime-Version: 1.0 References: <20210520124406.2731873-1-tabba@google.com> X-Mailer: git-send-email 2.31.1.751.gd2f1c929bd-goog Subject: [PATCH v3 10/18] arm64: __inval_dcache_area to take end parameter instead of size From: Fuad Tabba To: linux-arm-kernel@lists.infradead.org Cc: will@kernel.org, catalin.marinas@arm.com, mark.rutland@arm.com, maz@kernel.org, ardb@kernel.org, james.morse@arm.com, alexandru.elisei@arm.com, suzuki.poulose@arm.com, robin.murphy@arm.com, tabba@google.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210520_054431_770583_83227F84 X-CRM114-Status: GOOD ( 15.25 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org To be consistent with other functions with similar names and functionality in cacheflush.h, cache.S, and cachetlb.rst, change to specify the range in terms of start and end, as opposed to start and size. Because the code is shared with __dma_inv_area, it changes the parameters for that as well. However, __dma_inv_area is local to cache.S, so no other users are affected. No functional change intended. Reported-by: Will Deacon Signed-off-by: Fuad Tabba Acked-by: Mark Rutland --- arch/arm64/include/asm/cacheflush.h | 2 +- arch/arm64/kernel/head.S | 5 +---- arch/arm64/mm/cache.S | 16 +++++++++------- arch/arm64/mm/flush.c | 2 +- 4 files changed, 12 insertions(+), 13 deletions(-) diff --git a/arch/arm64/include/asm/cacheflush.h b/arch/arm64/include/asm/cacheflush.h index a586afa84172..157234706817 100644 --- a/arch/arm64/include/asm/cacheflush.h +++ b/arch/arm64/include/asm/cacheflush.h @@ -59,7 +59,7 @@ extern void __flush_icache_range(unsigned long start, unsigned long end); extern void invalidate_icache_range(unsigned long start, unsigned long end); extern void __flush_dcache_area(void *addr, size_t len); -extern void __inval_dcache_area(void *addr, size_t len); +extern void __inval_dcache_area(unsigned long start, unsigned long end); extern void __clean_dcache_area_poc(void *addr, size_t len); extern void __clean_dcache_area_pop(void *addr, size_t len); extern void __clean_dcache_area_pou(void *addr, size_t len); diff --git a/arch/arm64/kernel/head.S b/arch/arm64/kernel/head.S index 96873dfa67fd..8df0ac8d9123 100644 --- a/arch/arm64/kernel/head.S +++ b/arch/arm64/kernel/head.S @@ -117,7 +117,7 @@ SYM_CODE_START_LOCAL(preserve_boot_args) dmb sy // needed before dc ivac with // MMU off - mov x1, #0x20 // 4 x 8 bytes + add x1, x0, #0x20 // 4 x 8 bytes b __inval_dcache_area // tail call SYM_CODE_END(preserve_boot_args) @@ -268,7 +268,6 @@ SYM_FUNC_START_LOCAL(__create_page_tables) */ adrp x0, init_pg_dir adrp x1, init_pg_end - sub x1, x1, x0 bl __inval_dcache_area /* @@ -382,12 +381,10 @@ SYM_FUNC_START_LOCAL(__create_page_tables) adrp x0, idmap_pg_dir adrp x1, idmap_pg_end - sub x1, x1, x0 bl __inval_dcache_area adrp x0, init_pg_dir adrp x1, init_pg_end - sub x1, x1, x0 bl __inval_dcache_area ret x28 diff --git a/arch/arm64/mm/cache.S b/arch/arm64/mm/cache.S index 80da4b8718b6..5170d9ab450a 100644 --- a/arch/arm64/mm/cache.S +++ b/arch/arm64/mm/cache.S @@ -138,25 +138,24 @@ alternative_else_nop_endif SYM_FUNC_END(__clean_dcache_area_pou) /* - * __inval_dcache_area(kaddr, size) + * __inval_dcache_area(start, end) * - * Ensure that any D-cache lines for the interval [kaddr, kaddr+size) + * Ensure that any D-cache lines for the interval [start, end) * are invalidated. Any partial lines at the ends of the interval are * also cleaned to PoC to prevent data loss. * - * - kaddr - kernel address - * - size - size in question + * - start - kernel start address of region + * - end - kernel end address of region */ SYM_FUNC_START_LOCAL(__dma_inv_area) SYM_FUNC_START_PI(__inval_dcache_area) /* FALLTHROUGH */ /* - * __dma_inv_area(start, size) + * __dma_inv_area(start, end) * - start - virtual start address of region - * - size - size in question + * - end - virtual end address of region */ - add x1, x1, x0 dcache_line_size x2, x3 sub x3, x2, #1 tst x1, x3 // end cache line aligned? @@ -237,8 +236,10 @@ SYM_FUNC_END_PI(__dma_flush_area) * - dir - DMA direction */ SYM_FUNC_START_PI(__dma_map_area) + add x1, x0, x1 cmp w2, #DMA_FROM_DEVICE b.eq __dma_inv_area + sub x1, x1, x0 b __dma_clean_area SYM_FUNC_END_PI(__dma_map_area) @@ -249,6 +250,7 @@ SYM_FUNC_END_PI(__dma_map_area) * - dir - DMA direction */ SYM_FUNC_START_PI(__dma_unmap_area) + add x1, x0, x1 cmp w2, #DMA_TO_DEVICE b.ne __dma_inv_area ret diff --git a/arch/arm64/mm/flush.c b/arch/arm64/mm/flush.c index ac485163a4a7..4e3505c2bea6 100644 --- a/arch/arm64/mm/flush.c +++ b/arch/arm64/mm/flush.c @@ -88,7 +88,7 @@ EXPORT_SYMBOL_GPL(arch_wb_cache_pmem); void arch_invalidate_pmem(void *addr, size_t size) { - __inval_dcache_area(addr, size); + __inval_dcache_area((unsigned long)addr, (unsigned long)addr + size); } EXPORT_SYMBOL_GPL(arch_invalidate_pmem); #endif