From patchwork Thu May 20 12:43:54 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fuad Tabba X-Patchwork-Id: 12270189 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 A4B3DC433ED for ; Thu, 20 May 2021 12:48:03 +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 2F8A761163 for ; Thu, 20 May 2021 12:48:03 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2F8A761163 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=qTeV4BBzS4MLlIf9vq8ghBna09U+3Snsz7mCQCkY/pc=; b=O6KDomjvjItetY UslE5aV67mZR6hIpTZCkpEmuHlxnhzQ9EcrRXkBFht+H6vt9L/Zl+kcGJByF0jDS6yf+EVIEHzi50 Xxei0+8HO51ps6OxisWWQedgwE+IhnACfUXWAvTtMAyHtAAGXis97XMwouPSfw5rxYcVe6bN3LUx4 oz8iVEE3mam9orQ4kFqk+kIEF20irN184E1QeL1n3tkIEr1kgNPx+YFE4O4FFfW3RfIdnZPgqwuV+ pglsnwu5sj8vHCNS04AefIBMnYJViMjWqLgN/eI2xV5kXgkXIEC39UZ8wbNnXAHLdk903LQtpJTGV C5HzcAeX32itmHEBENgQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lji4P-000vEI-A6; Thu, 20 May 2021 12:46:33 +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 1lji2M-000u0n-D7 for linux-arm-kernel@desiato.infradead.org; Thu, 20 May 2021 12:44:26 +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=dmnjCj8KjLvWl3PuSvNM5eR1F4UYatdLENE/+5L9i1g=; b=MR20rK2xmoD+bpAQrm0UzMG7wJ RMcsqlpfhZ6mfUHL8335Q+vDNiL95rNTkNj7wz1BDnw9AAOex5r9EIjwgaUuImftF7jhU/k6JalUk Cuyy2bhyTLgNoX8jeZXjCU8wDnsb2v8GneSgHLiIbN5vxBIM8YDGBBrqZ5fzvOBezwgWA8XfJ6m58 iovYP8h6sRJi15IL/SSxF9perM/Pbw/qaeNwW/wvF6mapwR9+ELfT5B9WLZ7AdXY3ozw1Fnpcs+pd JA5Rt40sBcW3T47d6KoJlO6QS+4+Ws09DD8NoWcwBfhd/ek2xG76qgNHaZCclVQ7mVI+NGJo7OxiJ GN7kMraw==; Received: from mail-wm1-x349.google.com ([2a00:1450:4864:20::349]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lji2J-00GKdM-PJ for linux-arm-kernel@lists.infradead.org; Thu, 20 May 2021 12:44:25 +0000 Received: by mail-wm1-x349.google.com with SMTP id l15-20020a1ced0f0000b029017140e7436dso1388780wmh.2 for ; Thu, 20 May 2021 05:44:22 -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=dmnjCj8KjLvWl3PuSvNM5eR1F4UYatdLENE/+5L9i1g=; b=LqVaOHs5PM+OF9/4NmPyjGIgH16yvLQX2e2n2qJI4WgdOsl/L3kd8QRZDepk1hEoNI 29B5kDSnzZnmJ5mGVm70RBJFCRHVlqOiJXZk/zCSSoqxFgNxBwIWEyiT8x7UZm03nERo aczum/wzF10XO0BOSJXz+YRwXKiTCzjVj+4A0w5SsmPUHrM5ypdtdW7motCEaQ8tKLqf IbaOXaVGkmMXsJhGkhwA73oxqym1tXqUk0oCPEoakB3cVbYjyhWesL/4dOh7V0j5ViHT v9kQXnekQ1edBpkk7DRKFqhShrEmSyX+/DFj5ubYK3Vhu/MwdX9e5KVFpcA4tWSG64vb KSPg== 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=dmnjCj8KjLvWl3PuSvNM5eR1F4UYatdLENE/+5L9i1g=; b=pZJ6jYJvnRKj3kaNaYKg3wsMXSFvuCUeeYQgqtutRINceF8gyrZhRlpnPRQxL7zVUa etiwoie4ijZPbgm6yVAxrbR3BSXmvjx22OYpEzex/UanIytj7/Y8HZhntMTz7jTbzw9J 5ABJX6DTW3/3ikuSkiQDUKNID8JbAfg8rCx1sbBCcbZPuFU4H7tLX8VrVOFHyf9HMVdp D0YZ5aNBw+RPYgataWs/1THWjNRdqH4Ks1MvTMDw/Rigz+k9cHgAntVe+xxYlT/jy70L PV0xPIsFyYxpweDBnXaoEujwsVOvmfIdrRVhOxXkeGPgXTbigA2g0+bwacK3ejjSbae7 H95Q== X-Gm-Message-State: AOAM532Fe4/u+yd0NfMdwZ0EUOl9//iD3D8GCgJBvfLNvFohOXxoRUP+ jLjExDEghtPEXswv3uJHRAy+LyaEJK3Yq/enZumC1AM6E0CD3ajGS84kn10pGncaGKHpXFReOsY JwGi85VsY5UBPc9htlI3tM/zWCBZZpWkHqYeNzcIl7JdYbsHTQTzWZJAk1Nrgh0UhPPZpvNLcuk 2L6g== X-Google-Smtp-Source: ABdhPJwXDKKnFk3OZPOJeddGyVke7DK0c6lcKWRDPsqy3mF1jWuNDulpUJMVQ3+gGyVJ+/wnNQHRyG1zrQ== X-Received: from tabba.c.googlers.com ([fda3:e722:ac3:10:28:9cb1:c0a8:482]) (user=tabba job=sendgmr) by 2002:a1c:4e0b:: with SMTP id g11mr3452331wmh.3.1621514661208; Thu, 20 May 2021 05:44:21 -0700 (PDT) Date: Thu, 20 May 2021 13:43:54 +0100 In-Reply-To: <20210520124406.2731873-1-tabba@google.com> Message-Id: <20210520124406.2731873-7-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 06/18] arm64: Do not enable uaccess for invalidate_icache_range 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_054423_841501_42BD2A96 X-CRM114-Status: GOOD ( 12.91 ) 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 invalidate_icache_range() works on the kernel linear map, and doesn't need uaccess. Remove the code that toggles uaccess_ttbr0_enable, as well as the code that emits an entry into the exception table (via the macro invalidate_icache_by_line). Changes return type of invalidate_icache_range() from int (which used to indicate a fault) to void, since it doesn't need uaccess and won't fault. Note that return value was never checked by any of the callers. No functional change intended. Possible performance impact due to the reduced number of instructions. Reported-by: Catalin Marinas Reported-by: Will Deacon Link: https://lore.kernel.org/linux-arch/20200511110014.lb9PEahJ4hVOYrbwIb_qUHXyNy9KQzNFdb_I3YlzY6A@z/ Signed-off-by: Fuad Tabba Acked-by: Mark Rutland Acked-by: Catalin Marinas --- arch/arm64/include/asm/cacheflush.h | 2 +- arch/arm64/mm/cache.S | 11 +---------- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/arch/arm64/include/asm/cacheflush.h b/arch/arm64/include/asm/cacheflush.h index 52e5c1623224..a586afa84172 100644 --- a/arch/arm64/include/asm/cacheflush.h +++ b/arch/arm64/include/asm/cacheflush.h @@ -57,7 +57,7 @@ * - size - region size */ extern void __flush_icache_range(unsigned long start, unsigned long end); -extern int invalidate_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 __clean_dcache_area_poc(void *addr, size_t len); diff --git a/arch/arm64/mm/cache.S b/arch/arm64/mm/cache.S index c6bc3b8138e1..7318a40dd6ca 100644 --- a/arch/arm64/mm/cache.S +++ b/arch/arm64/mm/cache.S @@ -97,21 +97,12 @@ SYM_FUNC_END(__flush_cache_user_range) */ SYM_FUNC_START(invalidate_icache_range) alternative_if ARM64_HAS_CACHE_DIC - mov x0, xzr isb ret alternative_else_nop_endif - uaccess_ttbr0_enable x2, x3, x4 - - invalidate_icache_by_line x0, x1, x2, x3, 2f - mov x0, xzr -1: - uaccess_ttbr0_disable x1, x2 + invalidate_icache_by_line x0, x1, x2, x3 ret -2: - mov x0, #-EFAULT - b 1b SYM_FUNC_END(invalidate_icache_range) /*