Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp227487pxk; Thu, 17 Sep 2020 01:03:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyEi+nQv4nepZsKY/OEvFLOWTdRq1qWdoKZ1ZzfaIL5y4qqYvT1uGxua//89XGipeFNfKDF X-Received: by 2002:aa7:c504:: with SMTP id o4mr32487508edq.82.1600329827654; Thu, 17 Sep 2020 01:03:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600329827; cv=none; d=google.com; s=arc-20160816; b=KXY7cNTCVAYwypfgc3Atq/hfQ8gn84pLIgpK1yJRrBBvH/rJ3qQAt4vHgaRo1jhApM ecf/B9cDnNNh0hKrN6wBpL/Zu2nqVKCLYcrc2iLabWdihae0E5wPncmR337PNBazNi8e s7JOzaAHjDBvaDOMIS1hbHP89E5LVVA4qOCszDFVB4FqmYePgTOpt156z4Ct15m0gHgL PbswnerUVcfIb9no6X/0OL8rur/mG4QbPR5vmNWVtrIxzwtZ4ZKkzcl8hmQxsKtxo4V9 CdZMlTfWyn/+WeIjma1AZj8lAZdFNtbYZhXxsBZ8gLsw0c7RB4XwtLF8DKTPj9mJJU6o h2Sw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=o9pR7FK+JGoERdb0Ak9FECdQMuRJrYsyh3lgs4kFEwQ=; b=myJMtMLztsan0MyUxYzQxHPH6ZFHBEkfFnIxXSMrYb+TBEszcg8170qA+T9a2wYsyV SIYxQaLs5M5gqejDzroX0zIirHcUx0vRR8281UGquPnimpDrEmByvTrScygR6tUlBEAN UM7DmMe4JyR/LLFzcCq/JiHbqfhpFnwJGTowzPVzgatFuduln8ckU/5gTSO9UmFovxbt uIQ3JhK5596QJXvyosPMsI0KMR5mjRJ/2w5ggxGC1gCTZ+AA9d78d6FuPgmut/c82pb2 LzNTRcWiw+L9kZUE+Ny/CuDg9OjLIxFohF+asEsJHUbb4+EdFYJtcZiqCR0IH8yAs4LH xSUw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@brainfault-org.20150623.gappssmtp.com header.s=20150623 header.b=MPL4ax1S; 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 n21si14105974edr.327.2020.09.17.01.03.23; Thu, 17 Sep 2020 01:03:47 -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; dkim=pass header.i=@brainfault-org.20150623.gappssmtp.com header.s=20150623 header.b=MPL4ax1S; 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 S1726198AbgIQH7e (ORCPT + 99 others); Thu, 17 Sep 2020 03:59:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54718 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726191AbgIQH7Z (ORCPT ); Thu, 17 Sep 2020 03:59:25 -0400 Received: from mail-wm1-x344.google.com (mail-wm1-x344.google.com [IPv6:2a00:1450:4864:20::344]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 63375C06174A for ; Thu, 17 Sep 2020 00:59:25 -0700 (PDT) Received: by mail-wm1-x344.google.com with SMTP id d4so1001473wmd.5 for ; Thu, 17 Sep 2020 00:59:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brainfault-org.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=o9pR7FK+JGoERdb0Ak9FECdQMuRJrYsyh3lgs4kFEwQ=; b=MPL4ax1SFCVhCQXNZ+Ha0xfJQbr9rJo7lwNYbfSI5tHuUDUWkjIfUKBOpQG43D6n/n FTlO+xC+hXTt010btWXgWLdlxelIeZtC21jWFar+z+83KCo0mepJEWxf/ReYS/dQDx6Y KCWzPCJ7YK+kTZ5K2OoNmp/SD7rIC67kuetU9tQxsswe7RWhRRCGRhKKdf9YHNkb9P54 yDrj9zZ7CVqqiG0kNJeb6FpmswiC1blbOcloYm1T/T//rJWS0ung+s9Fx2X5rzbRGL/n OJgFJjZZ51BK1Twn7baV28XqiiiGS8GoNJqsRSnm/GpxPYi+NLwEWRn7nGLC9M8+yjKd j7+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=o9pR7FK+JGoERdb0Ak9FECdQMuRJrYsyh3lgs4kFEwQ=; b=HHG87xwaX54Uu6NV+F0zXSTC7olAr8IuPiT2EYc/gLugor/8gl2xjVqAjOPJWCCYvf nZEzw7NlkU55aUdBwEhXnXVN1OAbNP/eZAorqD5fgxF28RJhW5GsDDaKjXdwLzihwC2z n3aLTxmF0CRk+0wERurj3jnveorenHUauqxrx06zUL3lUeDqz9CJZx8TkHZU7gXLxk2I df8y0laLYaXX7YKK96AKVGViAERH+6/iKi5Ofd3REdbSin293bUXDZRBHTF4abZKENA7 k2fkaJ/0+A+K7y7KqQ6YcT9FtacZDJ2cQm7aNWcRqX7ntMbBqFSMx29Zg9AJh7YOSz7g bUVg== X-Gm-Message-State: AOAM533KCTBuSwkwxIUeut8o97Dw6byXfUI5fhRH7Q/AcP0dzeF/aVGN rpkkW6qtIrIAtrGqi/fl3Il9b0Qy3K2hL3v30jnxUQ== X-Received: by 2002:a7b:c0c5:: with SMTP id s5mr8505787wmh.152.1600329563988; Thu, 17 Sep 2020 00:59:23 -0700 (PDT) MIME-Version: 1.0 References: <1600327549-3995-1-git-send-email-liush@allwinnertech.com> In-Reply-To: <1600327549-3995-1-git-send-email-liush@allwinnertech.com> From: Anup Patel Date: Thu, 17 Sep 2020 13:29:12 +0530 Message-ID: Subject: Re: [PATCH] riscv: fix pfn_to_virt err in do_page_fault(). To: liush Cc: Paul Walmsley , Palmer Dabbelt , Albert Ou , Andrew Morton , peterx@redhat.com, walken@google.com, daniel.m.jordan@oracle.com, vbabka@suse.cz, Mike Rapoport , linux-riscv , "linux-kernel@vger.kernel.org List" Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 17, 2020 at 12:56 PM liush wrote: > > The argument to pfn_to_virt() should be pfn not the value of CSR_SATP. > > Signed-off-by: liush > --- > arch/riscv/mm/fault.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/arch/riscv/mm/fault.c b/arch/riscv/mm/fault.c > index 716d64e..9b4e088 100644 > --- a/arch/riscv/mm/fault.c > +++ b/arch/riscv/mm/fault.c > @@ -212,7 +212,7 @@ asmlinkage void do_page_fault(struct pt_regs *regs) > * of a task switch. > */ > index = pgd_index(addr); > - pgd = (pgd_t *)pfn_to_virt(csr_read(CSR_SATP)) + index; > + pgd = (pgd_t *)pfn_to_virt(csr_read(CSR_SATP) & SATP_PPN) + index; > pgd_k = init_mm.pgd + index; > > if (!pgd_present(*pgd_k)) > -- > 2.7.4 > Looks good to me. Reviewed-by: Anup Patel Regards, Anup