Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1177672imu; Thu, 22 Nov 2018 11:31:49 -0800 (PST) X-Google-Smtp-Source: AFSGD/UjbINZbjH7a6rcokzZiDVAcXtj5d7ifUKQphloffQf/I9506JXTzxbAEcoD0c7K78vwI9d X-Received: by 2002:a17:902:1126:: with SMTP id d35mr8513577pla.1.1542915109866; Thu, 22 Nov 2018 11:31:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542915109; cv=none; d=google.com; s=arc-20160816; b=XllBYR5pYVtaWUafAFar12pawEJgkJMDua46CLu7Lu7DnEX0K0IRc0/dhiUzHRu8CG 6W3Qmo/wmEle8ApBkSHtlOkyMO40Ta0miHKvYlHDkqRingK03HDSKFy9/fipBNx+WNmg G9Or3gPq0Gftvb5VW7kJn6GRTG6nggam11DxeSo5cALNNlQJZbk+lTsiPytKdmXVYN60 U63tZt3YCZ3d2IBIWsoZLY4/qd6WMgLnW+gfXVlWnjP66YyMmZOUc1s55GXfD1b2WE3b SdH8D3Vbp3l7I+bXt3gDwoHitBWpTlhtk+esOn8aHOJD+X2NBtK6M5UmHpQziriKb6WL 6l0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=8qDiSZlcxuZE85zaHO6mpMyDb3HoCPPktM4tw61YqRY=; b=sjwZBKFBgXijSqQhyeMm7pCwCdf/p4NKq8GO0ioY7e9MJqp9YExxnQJA0mQYwAfnDx JLL4fJVSbd/OoarsfMyr7nETwJnb8KC/Gr7YnL+F3iwhEJjTDGEmZfHmy23Uz0ffJXuA c9znTCZVfBpICmtuovl6O0wlTAbR2Zt9xXNLuYhgSpbK4y/hqA9rInoJ374H1fiJPs/h QMlWaLbVBo+RAzSqoLaCcBAhkzg+m6X/bNtTJdS7+g7F1TO3dW/iRB7sN+8PHlN0a7uu reQxQLVrl7V07BoQFR8gOD98Ia4JK6e3+5fwbCNiUzUWIFWDbSXZtKOQ2IMeOnE0WFcz 6DGA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r11si36075963pli.175.2018.11.22.11.31.34; Thu, 22 Nov 2018 11:31:49 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2392253AbeKVQWf (ORCPT + 99 others); Thu, 22 Nov 2018 11:22:35 -0500 Received: from smtp2200-217.mail.aliyun.com ([121.197.200.217]:45373 "EHLO smtp2200-217.mail.aliyun.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389389AbeKVQWf (ORCPT ); Thu, 22 Nov 2018 11:22:35 -0500 X-Alimail-AntiSpam: AC=CONTINUE;BC=0.07688008|-1;CH=green;FP=0|0|0|0|0|-1|-1|-1;HT=e01e01534;MF=ren_guo@c-sky.com;NM=1;PH=DS;RN=3;RT=3;SR=0;TI=SMTPD_---.DMQddPA_1542865480; Received: from localhost(mailfrom:ren_guo@c-sky.com fp:SMTPD_---.DMQddPA_1542865480) by smtp.aliyun-inc.com(10.147.41.199); Thu, 22 Nov 2018 13:44:40 +0800 From: Guo Ren To: linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org Cc: Guo Ren Subject: [PATCH 1/2] csky: bugfix tlb_get_pgd error. Date: Thu, 22 Nov 2018 13:44:39 +0800 Message-Id: <1542865479-5796-1-git-send-email-ren_guo@c-sky.com> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org It's wrong to mask/unmask highest bit in addr to translate the vaddr to paddr. We should use PAGE_OFFSET and PHYS_OFFSET. Wrong implement: return ((get_pgd()|(1<<31)) - PHYS_OFFSET) & ~1; When PHYS_OFFSET=0xc0000000 and get_pgd() return 0xe0000000, it'll return 0x60000000. It's wrong and should be 0xa0000000. Now correct it to: return ((get_pgd() - PHYS_OFFSET) & ~1) + PAGE_OFFSET; Signed-off-by: Guo Ren --- arch/csky/include/asm/mmu_context.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/csky/include/asm/mmu_context.h b/arch/csky/include/asm/mmu_context.h index c410aa4..b2905c0 100644 --- a/arch/csky/include/asm/mmu_context.h +++ b/arch/csky/include/asm/mmu_context.h @@ -16,7 +16,7 @@ static inline void tlbmiss_handler_setup_pgd(unsigned long pgd, bool kernel) { - pgd &= ~(1<<31); + pgd -= PAGE_OFFSET; pgd += PHYS_OFFSET; pgd |= 1; setup_pgd(pgd, kernel); @@ -29,7 +29,7 @@ static inline void tlbmiss_handler_setup_pgd(unsigned long pgd, bool kernel) static inline unsigned long tlb_get_pgd(void) { - return ((get_pgd()|(1<<31)) - PHYS_OFFSET) & ~1; + return ((get_pgd() - PHYS_OFFSET) & ~1) + PAGE_OFFSET; } #define cpu_context(cpu, mm) ((mm)->context.asid[cpu]) -- 2.7.4