Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp1319639ybg; Tue, 2 Jun 2020 07:02:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx4PQisaTfrYoHdb61vJzjNdnBL+ysYOp5ETS7/M4M53rSwQfePzqi789Hs6oMQvPgHp2Qa X-Received: by 2002:a50:d7c7:: with SMTP id m7mr27403127edj.101.1591106547195; Tue, 02 Jun 2020 07:02:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591106547; cv=none; d=google.com; s=arc-20160816; b=ph0okCHt2zSvRdmcUzXPe1y8PAqzpGHdPkiNtM5UlhwyW+JLlRa9i2h1gmPpUelSZQ Qfilkm89nIZrI0ekA9FuWhqSQw6hBabQb9OGPbrYhn8TjNMGhbkkhPyENeNGjBkIoRjY 2IzdZeYu4SbJ37r3iu1U5qSoWFg3OHLm2WFlhd3mFHiGfB6rnMi30AVSxrBg9YOYUTau 6QgYbX6GRMGyApxierIL2vUZ9J2hGaIDWUO3PK/PwTiLDTx1OL7n1pIHEULFS096ixBb Gum+acwQH2h8EOg4QjYJD5jQMCYoa9W8VGA9Ndsp/6G4mLvyV0nW/rayC1cJGd34Wf/M 8wlg== 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=l0z+eUncasPvmtoAB4eWE1+e1XD+vHZhT8Cur633DqY=; b=doWm3l1wFzbHg3SrAwP0t3Vo6bgblFcFCRB8s3ROBmXoMkqJAJwAIl0wrbOsNseIrp tAv88Fjyu2OY1oZhhs9JzMZD7IqCyJ8MZcQAjoRg0MtkU5TSYD8mTGXKu81ZWImTipbQ 3NMl70UJp6xSK4z0JxNnv5J6ktW/YC3oVa5hyWz7VyckCF5Y+Bqv60Jfb5KxNXeJjCdd vPtsYAotCiLBOb8JitQC3LaRewYjd9R5agRIVDoo34gQc+Mjy9l/gbvQMSOTfB+b6IWd KIAf98Ehawe38iP2h+VhKs3FmNAVas4z5077UB0qd7qaSEEp1iYk0DdU0M3rBA1HJAni iXLQ== 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 op23si1356746ejb.354.2020.06.02.07.01.52; Tue, 02 Jun 2020 07:02:27 -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 S1727860AbgFBN7R (ORCPT + 99 others); Tue, 2 Jun 2020 09:59:17 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:5770 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727013AbgFBN7N (ORCPT ); Tue, 2 Jun 2020 09:59:13 -0400 Received: from DGGEMS404-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id C2A131C101A62D501614; Tue, 2 Jun 2020 21:59:10 +0800 (CST) Received: from DESKTOP-KKJBAGG.china.huawei.com (10.173.220.25) by DGGEMS404-HUB.china.huawei.com (10.3.19.204) with Microsoft SMTP Server id 14.3.487.0; Tue, 2 Jun 2020 21:59:02 +0800 From: Zhenyu Ye To: , , , , , , , , , , , , , , , , CC: , , , , , , , , , Subject: [PATCH v4 3/6] arm64: Add tlbi_user_level TLB invalidation helper Date: Tue, 2 Jun 2020 21:58:33 +0800 Message-ID: <20200602135836.1620-4-yezhenyu2@huawei.com> X-Mailer: git-send-email 2.22.0.windows.1 In-Reply-To: <20200602135836.1620-1-yezhenyu2@huawei.com> References: <20200602135836.1620-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.19.1