From patchwork Thu Nov 18 09:30:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Huang Pei X-Patchwork-Id: 12626369 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F4182C4332F for ; Thu, 18 Nov 2021 09:30:48 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D3E4761B93 for ; Thu, 18 Nov 2021 09:30:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245154AbhKRJdq (ORCPT ); Thu, 18 Nov 2021 04:33:46 -0500 Received: from mail.loongson.cn ([114.242.206.163]:48744 "EHLO loongson.cn" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S243503AbhKRJdk (ORCPT ); Thu, 18 Nov 2021 04:33:40 -0500 Received: from localhost.localdomain (unknown [111.9.175.10]) by mail.loongson.cn (Coremail) with SMTP id AQAAf9AxbuQeHZZhYxcAAA--.269S3; Thu, 18 Nov 2021 17:30:16 +0800 (CST) From: Huang Pei To: Thomas Bogendoerfer , ambrosehua@gmail.com Cc: Bibo Mao , Andrew Morton , linux-mips@vger.kernel.org, linux-arch@vger.kernel.org, linux-mm@kvack.org, Jiaxun Yang , Paul Burton , Li Xuefeng , Yang Tiezhu , Gao Juxin , Fuxin Zhang , Huacai Chen Subject: [PATCH 2/4] MIPS: fix tx39_flush_cache_page Date: Thu, 18 Nov 2021 17:30:03 +0800 Message-Id: <20211118093005.3121-2-huangpei@loongson.cn> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20211118093005.3121-1-huangpei@loongson.cn> References: <20211118093005.3121-1-huangpei@loongson.cn> MIME-Version: 1.0 X-CM-TRANSID: AQAAf9AxbuQeHZ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20x vaj40_Jr0_JF4lIxAIcVC2z280aVAFwI0_Jr0_Gr1lIxAIcVC2z280aVCY1x0267AKxVW8 JVW8JrUvcSsGvfC2KfnxnUUI43ZEXa7VUUPxhtUUUUU== X-CM-SenderInfo: xkxd0whshlqz5rrqw2lrqou0/ Precedence: bulk List-ID: X-Mailing-List: linux-mips@vger.kernel.org Indexed cache operation need KSEG0 address for safety and assume that no dcache alias nor high memory Signed-off-by: Huang Pei --- arch/mips/mm/c-tx39.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/arch/mips/mm/c-tx39.c b/arch/mips/mm/c-tx39.c index 03dfbb40ec73..49e4a16186ce 100644 --- a/arch/mips/mm/c-tx39.c +++ b/arch/mips/mm/c-tx39.c @@ -170,6 +170,7 @@ static void tx39_flush_cache_page(struct vm_area_struct *vma, unsigned long page struct mm_struct *mm = vma->vm_mm; pmd_t *pmdp; pte_t *ptep; + unsigned long vaddr = phys_to_virt(pfn_to_phys(pfn)); /* * If ownes no valid ASID yet, cannot possibly have gotten @@ -207,11 +208,14 @@ static void tx39_flush_cache_page(struct vm_area_struct *vma, unsigned long page /* * Do indexed flush, too much work to get the (possible) TLB refills * to work correctly. + * + * Assuming that tx39 family do not support high memory, nor has + * dcache alias, vaddr can index dcache directly and correctly */ if (cpu_has_dc_aliases || exec) - tx39_blast_dcache_page_indexed(page); + tx39_blast_dcache_page_indexed(vaddr); if (exec) - tx39_blast_icache_page_indexed(page); + tx39_blast_icache_page_indexed(vaddr); } static void local_tx39_flush_data_cache_page(void * addr)