Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp7219371ybp; Wed, 16 Oct 2019 05:40:49 -0700 (PDT) X-Google-Smtp-Source: APXvYqxLNdM3D5qGexLPrCwSunQTbALP8LQ+UimumfR53lpJolyVzScxrLaIcvxCnSWc7P4HsScs X-Received: by 2002:a17:906:6451:: with SMTP id l17mr9998216ejn.114.1571229649409; Wed, 16 Oct 2019 05:40:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571229649; cv=none; d=google.com; s=arc-20160816; b=J6aXOeUKi8zUbTMM21wXKh/gs2Cx54WUutOrRA7Q0pbXqy/TDo3LaZdkfTFMhzrL/q /waKu+MISwQbZJQX5E10eKvqJ5fAFHg5BoKMmowGCwFIqHqyH5oJHAv+4W0l2c7DVFfg dJNxXREQj7K+YId/Y8zNqecTcGpbMiUeZhbscqtLrEQnj6VPDyM5hOPCxSFmrM5HlM6p gLZJ+nGgxhweEQnGLOmQiZpcfwcVauRLHQbwstd5FMbd6oeKfn0MG+kSTEIOB050mrHn PO+uo8aWoinWrbdI+j1awSo7YxeHM/wgkPDmqAuoOaO+U8G70AlF3SwZ276LHs1R54Ja oBEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=Of9U+idySm1f7zahNIvCqAevKwBri2ZmJMTLKSSsyAM=; b=Nev3XkmmwuVBFzMIgkSIxFe38ijIzC38aJ7eWNntNs7sTm7f00ON/p11Xvf1M1Q8Sk +izJFrLZe2+AzQZumBoP2NCZmP0bIsv2os80hk4vVzA76eOFjDPUlvR0ZT74jvM8eUnq YqHEHcJwJbVqDWGrPthUjD/y8tncs9Ed46w+YzpVD1kpkf/tCL+PhdwNCpwzS4g5dHmd 8d5wW624mqeiOR65H/jYd8Qz8nSh7SMQEAVnjUZtC4gUIxzvXjMefzAALoL46zJ9VEx/ iudGmokVLDckqIQWp11nolROjOL3VDej5iVYioMjfU5XMKlGmTch13B5OWaVRuDlP1BW nDTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@brainfault-org.20150623.gappssmtp.com header.s=20150623 header.b=JDRvwufl; 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 i24si14899882ejh.35.2019.10.16.05.40.25; Wed, 16 Oct 2019 05:40:49 -0700 (PDT) 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; dkim=pass header.i=@brainfault-org.20150623.gappssmtp.com header.s=20150623 header.b=JDRvwufl; 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 S2391357AbfJPHuA (ORCPT + 99 others); Wed, 16 Oct 2019 03:50:00 -0400 Received: from mail-wm1-f67.google.com ([209.85.128.67]:53223 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2391302AbfJPHt7 (ORCPT ); Wed, 16 Oct 2019 03:49:59 -0400 Received: by mail-wm1-f67.google.com with SMTP id r19so1724300wmh.2 for ; Wed, 16 Oct 2019 00:49:58 -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=Of9U+idySm1f7zahNIvCqAevKwBri2ZmJMTLKSSsyAM=; b=JDRvwuflF5JjJLkwOlEL2zXx2Czdzdk9RV9OXNAYOpDXXQ4yv0GekH0yOJQe1pT7O2 IRKQSJMqSBmS6z2WLJC1ofVqU8cSOIgIGXwY6bmOjrqCkWReRrv8leYVraJrh9DmU3r7 0/Ygo/0nut2WZSooZoC9k31IeP/GV7VM4gJbdtZzwwgBFKv1G4ecEZdHYVJ0KaX7f2GQ v7ABD7pi/PISIFSmTixlj/iWL2w6meSHc1pqL2Mne5K9Vo9yPM4Qt82NpO7SuJO4v6P0 mAUI4EpTdWMiwujK0Z0h5B2BvJIAjQAO++ja/8NStba6ltxtj9uzBAaWaqqaURNnVnyo vY4g== 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=Of9U+idySm1f7zahNIvCqAevKwBri2ZmJMTLKSSsyAM=; b=XxWWnOlaBEbMcbLzWhgpK4qFaBdL9icJnN77z5dGD9zLjqIjWkJcFx0yC7KdeaFpP5 u4jGxHr+VRXMMyH9FmT/+CmREh0pCzi2BtPggpLi7WKdjZsQ8fw6nfPU3OF21+rcjAlB mjc1zBcNqDQ8s8cUCxVNWStQ6D/m2mRXdFkpuSb4iNH3FWucP/izd3E1Kwh2W5x6QBcI fdFDx66WCYvZ/hJcRJtnH4L1NdfnYyAi0HlR5fSBwL3y6R5j6oq+NvW8mW9LeowLQLqN xzVYRMeStFKv1TuWSPNgHmCFD5yBePaW/ZnSVMI0YYykj7dLXnN5d1Ze0k32AtMdthPU ijMw== X-Gm-Message-State: APjAAAVDMhji0fxarSDq5EerBsmnUmg8EMACOgDLZlGLcZIwxrx0BwfE hEzTSK4cNMhYhnyGa2YIrRdH5nTg0AFov94jKwVPSA== X-Received: by 2002:a05:600c:214f:: with SMTP id v15mr2001725wml.177.1571212197232; Wed, 16 Oct 2019 00:49:57 -0700 (PDT) MIME-Version: 1.0 References: <20191016073408.7299-1-greentime.hu@sifive.com> In-Reply-To: <20191016073408.7299-1-greentime.hu@sifive.com> From: Anup Patel Date: Wed, 16 Oct 2019 13:19:45 +0530 Message-ID: Subject: Re: [PATCH] RISC-V: fix virtual address overlapped in FIXADDR_START and VMEMMAP_START To: greentime.hu@sifive.com Cc: Greentime Hu , Paul Walmsley , Palmer Dabbelt , linux-riscv , "linux-kernel@vger.kernel.org List" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Oct 16, 2019 at 1:04 PM wrote: > > From: Greentime Hu > > This patch fixes the virtual address layout in pgtable.h. > The virtual address of FIXADDR_START and VMEMMAP_START should not be overlapped. > These addresses will be existed at the same time in Linux kernel that they can't > be overlapped. > > Fixes: d95f1a542c3d ("RISC-V: Implement sparsemem") > Signed-off-by: Greentime Hu > --- > arch/riscv/include/asm/pgtable.h | 16 ++++++++-------- > 1 file changed, 8 insertions(+), 8 deletions(-) > > diff --git a/arch/riscv/include/asm/pgtable.h b/arch/riscv/include/asm/pgtable.h > index 4f4162d90586..b927fb4ecf1c 100644 > --- a/arch/riscv/include/asm/pgtable.h > +++ b/arch/riscv/include/asm/pgtable.h > @@ -87,14 +87,6 @@ extern pgd_t swapper_pg_dir[]; > #define VMALLOC_END (PAGE_OFFSET - 1) > #define VMALLOC_START (PAGE_OFFSET - VMALLOC_SIZE) > > -#define FIXADDR_TOP VMALLOC_START > -#ifdef CONFIG_64BIT > -#define FIXADDR_SIZE PMD_SIZE > -#else > -#define FIXADDR_SIZE PGDIR_SIZE > -#endif > -#define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE) > - > /* > * Roughly size the vmemmap space to be large enough to fit enough > * struct pages to map half the virtual address space. Then > @@ -108,6 +100,14 @@ extern pgd_t swapper_pg_dir[]; > > #define vmemmap ((struct page *)VMEMMAP_START) > > +#define FIXADDR_TOP (VMEMMAP_START) > +#ifdef CONFIG_64BIT > +#define FIXADDR_SIZE PMD_SIZE > +#else > +#define FIXADDR_SIZE PGDIR_SIZE > +#endif > +#define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE) > + > /* > * ZERO_PAGE is a global shared page that is always zero, > * used for zero-mapped memory areas, etc. > -- > 2.17.1 > Looks good to me. Reviewed-by: Anup Patel Regards, Anup