Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1246766ybt; Thu, 25 Jun 2020 01:04:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxRMpbMR1QZlpS22Z91Imza3yyjxBhadPXIJ9+yUZontQFUrdrVF0q6Nu+2MZBm2caz3hYr X-Received: by 2002:a50:a687:: with SMTP id e7mr29293582edc.62.1593072298698; Thu, 25 Jun 2020 01:04:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593072298; cv=none; d=google.com; s=arc-20160816; b=yGsZfGRAUOBfvdPbgfe1RJo6mCgdi+L9LmLxhf/ErJat5TZ4y21ZWzp8kC0wFjRhoJ y93EdeucSwPBtGd4ngobvXcEIyPYaWZ3tS3jRxZ8+JWUoxJfWgCHT/eR2IGT8C/DEIgY MptVTGcQrFXMq5OhNvqCDh8/yuLDtFT2GDBjL4B873hSMX6xtA86T/cxo7qfbOexR8bC iswKyiOg7HMQaFtCTuAnIhFQr15ur2A2uY2N9vr6ZyW3V/VVV5dSR9a5zNbk9fzJikum u5JA0UHAq4scx4pOMPGJkce167vWv0msU+ZIX5aeAiQp5Nt4cGZkQt7+/lPGobEA9c90 zyJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=Oh42kMoram2aNKWrPHkaDE9AC7/ARurusyOL/hgSww8=; b=G5z/DygWDCPNQQs9o+0grNlRV9Vt2VncZUbKTIcotdIWfMDaXdYPKNTDM7Pzhh8TXV uhEFEDlohWVlMwp6wdJpUt/qJJV8bxkw/ODtJxfMaMm5sInyxS5uQ8LIHZKglhRmXg8k ucJDXPCFO3ZzKpRKyHaKFiBOZ+l3CxN9obmdAIwHnwdYglNLi/c9HQZYq9u2Z/cGbmIR H1aPS7aleFhT97AaIqMz7ETgX/DJf4WNWUCBfBAQ98FEJ7y3Cndgj/ffsMjvKPRAgA/p MY7mgk2KmIJ4rMyUM9EZvUzn+ySFSr2dthbUvzC6PuOcQfVb9QAnBEWxdwuenoo7gRr7 LuiQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e7si9849595edn.164.2020.06.25.01.04.34; Thu, 25 Jun 2020 01:04:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390666AbgFYIEB (ORCPT + 99 others); Thu, 25 Jun 2020 04:04:01 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:53562 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2390571AbgFYIDk (ORCPT ); Thu, 25 Jun 2020 04:03:40 -0400 Received: from DGGEMS413-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 18368F27340BFF8FC205; Thu, 25 Jun 2020 16:03:37 +0800 (CST) Received: from DESKTOP-KKJBAGG.china.huawei.com (10.173.220.25) by DGGEMS413-HUB.china.huawei.com (10.3.19.213) with Microsoft SMTP Server id 14.3.487.0; Thu, 25 Jun 2020 16:03:27 +0800 From: Zhenyu Ye To: , , , , , , , , , , , , , , , , CC: , , , , , , , , , Subject: [RESEND PATCH v5 3/6] arm64: Add tlbi_user_level TLB invalidation helper Date: Thu, 25 Jun 2020 16:03:11 +0800 Message-ID: <20200625080314.230-4-yezhenyu2@huawei.com> X-Mailer: git-send-email 2.22.0.windows.1 In-Reply-To: <20200625080314.230-1-yezhenyu2@huawei.com> References: <20200625080314.230-1-yezhenyu2@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.173.220.25] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add a level-hinted parameter to __tlbi_user, which only gets used if ARMv8.4-TTL gets detected. ARMv8.4-TTL provides the TTL field in tlbi instruction to indicate the level of translation table walk holding the leaf entry for the address that is being invalidated. This patch set the default level value of flush_tlb_range() to 0, which will be updated in future patches. And set the ttl value of flush_tlb_page_nosync() to 3 because it is only called to flush a single pte page. Signed-off-by: Zhenyu Ye --- arch/arm64/include/asm/tlbflush.h | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/arch/arm64/include/asm/tlbflush.h b/arch/arm64/include/asm/tlbflush.h index 8adbd6fd8489..bfb58e62c127 100644 --- a/arch/arm64/include/asm/tlbflush.h +++ b/arch/arm64/include/asm/tlbflush.h @@ -88,6 +88,12 @@ __tlbi(op, arg); \ } while (0) +#define __tlbi_user_level(op, arg, level) do { \ + if (arm64_kernel_unmapped_at_el0()) \ + __tlbi_level(op, (arg | USER_ASID_FLAG), level); \ +} while (0) + + /* * TLB Invalidation * ================ @@ -189,8 +195,9 @@ static inline void flush_tlb_page_nosync(struct vm_area_struct *vma, unsigned long addr = __TLBI_VADDR(uaddr, ASID(vma->vm_mm)); dsb(ishst); - __tlbi(vale1is, addr); - __tlbi_user(vale1is, addr); + /* This function is only called on a small page */ + __tlbi_level(vale1is, addr, 3); + __tlbi_user_level(vale1is, addr, 3); } static inline void flush_tlb_page(struct vm_area_struct *vma, @@ -230,11 +237,11 @@ static inline void __flush_tlb_range(struct vm_area_struct *vma, dsb(ishst); for (addr = start; addr < end; addr += stride) { if (last_level) { - __tlbi(vale1is, addr); - __tlbi_user(vale1is, addr); + __tlbi_level(vale1is, addr, 0); + __tlbi_user_level(vale1is, addr, 0); } else { - __tlbi(vae1is, addr); - __tlbi_user(vae1is, addr); + __tlbi_level(vae1is, addr, 0); + __tlbi_user_level(vae1is, addr, 0); } } dsb(ish); -- 2.26.2