Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp7537747ybp; Wed, 16 Oct 2019 10:07:26 -0700 (PDT) X-Google-Smtp-Source: APXvYqwGQ+IaIaVPetnKUdETnxSJr+oYT4nZBI+WNf3YRiFqvo164VE26mXC7Z5gyCx+FdkJpsyC X-Received: by 2002:a05:6402:8cf:: with SMTP id d15mr39034407edz.225.1571245646823; Wed, 16 Oct 2019 10:07:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571245646; cv=none; d=google.com; s=arc-20160816; b=YNjAFadTM6RAiAjW4HKhz0BzGgMO6oXuTzHFP5dpOWr2Wf0xJHJOCGyEHY3D10ftBy UkWp2VdMDTFdcZQMR4AtlxOr3JprRhggVL0sa+/tt8RBvhFTNNCblSVkErcN3/LBvSQn ltu9UyzOTMPzMjutCMI2B3ArEv99wnv6ZpGlGGCW8jJzQtobGRrOljwZQaWZ5fzhzN0Y 3cR6ntg+mpufhVVcPKXVytn7RKXIu4B3slwK4CD6k+mxioEapTiC0KLrTOJUWiT03Iv/ H2s7r1ZcZ96WPPxnaK6U2qppwPzVfET7lwFSfali2pWkaFSAyccnu1Epm2QFsGo10Fu2 PG3w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date:dkim-signature; bh=m6YvTC56tPty4UucunSEA15cVT7bFCmaoiGJUpQ0cBw=; b=UjqmrxLU9J/lHylinYTMvxaxCg/+Z+kopMjUm4KZOjNyAHIlxY7Z0R4pReADUL5A4B 8mzprrtZJSL7/Do1jgRrFpiGw+yLofY5/Mo8cseomheGrSjBc9anzveV9n4QHqnTPvDV rtOchiU3vLw3xBR2T4RI1EDl0c9ArH8IymE2Wl1+kMztExGOImiVdy9Lu4+nxcZp/RNU UP8QC+14zAnRxf07gxuWEDfDbbwOq0ogjqqJdpnQES3ZUf8R09KzEujXAmV4/uq8baS5 O4M2Ct1xmIKEzVUMaOLTP/GVCKv9CsYXat9c76ROWw7xIa+M4gWlkDJfL90V6yNHxxZc WA9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@sifive.com header.s=google header.b=KXn3cyGt; 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 z7si15517985ejr.99.2019.10.16.10.07.03; Wed, 16 Oct 2019 10:07:26 -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=@sifive.com header.s=google header.b=KXn3cyGt; 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 S2393553AbfJPPYK (ORCPT + 99 others); Wed, 16 Oct 2019 11:24:10 -0400 Received: from mail-il1-f195.google.com ([209.85.166.195]:45601 "EHLO mail-il1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731357AbfJPPYK (ORCPT ); Wed, 16 Oct 2019 11:24:10 -0400 Received: by mail-il1-f195.google.com with SMTP id u1so3019639ilq.12 for ; Wed, 16 Oct 2019 08:24:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sifive.com; s=google; h=date:from:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=m6YvTC56tPty4UucunSEA15cVT7bFCmaoiGJUpQ0cBw=; b=KXn3cyGteTFQOdBxy4js14JQAsqJPlqSpcTTlnW9WRZKJpxck4oF2gh6Z54q3qAY39 zQ21uHEpi3HJD3nJX7mI4Z4wc29Gd5mVNjHdciFBnLUC/FADeeeAJcROeCjHYxddvWiL wfZb2QQKN8V7+l+JMfr9lUa9AiELF/jFtTN8PbfPa9kSf3r7aGB3m3fbMNMW+mo5/p6t mdFUKJRwXPzGoMAXZ/VS9CU+8I1+f516eyUfAN9JYiqalyO9Zr4GSUA2MjpB7d5OC2nH HxdZ2LCcvugonljcCw9SCMuDq7T/G9mZOEuvpctUP/UGF+hPewnih3CrluZOlY56VDgA j5dw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version; bh=m6YvTC56tPty4UucunSEA15cVT7bFCmaoiGJUpQ0cBw=; b=pPAQlarAa6Be1IpQTRWYKsURYLf/99nsmrpnOtM3N/U+tNJ4tPaRZ/klJeoWSdf+Av YRdWGBLKc16VRt8Co6vo4RD/YxncNLytZRo2Df6sz27+h46do6bZLQKk8kbYhjBWbwCZ ftMN+UDj0lz/znMLcizqMdaSoVLmIEkVzXiDRmC4DLaY9VhV7dZsRKeFfVaLSRNRcrwT wzYwCbHWoqmKjfCOl4+a+K0/RkEZ0Ng59NAqDseFBdiObzxSJP/5jWuNIkYuthtRUl/0 eE5p3kOJgL67VRPl+7abfyvpbnJ8w+KmT216Mu/XsZA4Um+SUtqfCByIjVAimdqdA6j9 XXaQ== X-Gm-Message-State: APjAAAWK3RDeMmpWPIHZzx34tjXC/s76+PZtsZfW6+SlqSlhOKtmwWXW hrn0tHM3rbi7pRa6V7u/CxPbbw== X-Received: by 2002:a92:5fd7:: with SMTP id i84mr12437767ill.151.1571239449319; Wed, 16 Oct 2019 08:24:09 -0700 (PDT) Received: from localhost ([64.62.168.194]) by smtp.gmail.com with ESMTPSA id t9sm17591906iop.86.2019.10.16.08.24.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 16 Oct 2019 08:24:07 -0700 (PDT) Date: Wed, 16 Oct 2019 08:24:04 -0700 (PDT) From: Paul Walmsley X-X-Sender: paulw@viisi.sifive.com To: greentime.hu@sifive.com cc: green.hu@gmail.com, palmer@sifive.com, linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] RISC-V: fix virtual address overlapped in FIXADDR_START and VMEMMAP_START In-Reply-To: <20191016073408.7299-1-greentime.hu@sifive.com> Message-ID: References: <20191016073408.7299-1-greentime.hu@sifive.com> User-Agent: Alpine 2.21.9999 (DEB 301 2018-08-15) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 16 Oct 2019, greentime.hu@sifive.com 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 Thanks, here's what's been queued for v5.4-rc. - Paul From: Greentime Hu Date: Tue, 8 Oct 2019 14:45:24 +0800 Subject: [PATCH] RISC-V: fix virtual address overlapped in FIXADDR_START and VMEMMAP_START This patch fixes the virtual address layout in pgtable.h. The virtual address of FIXADDR_START and VMEMMAP_START should not be overlapped. Fixes: d95f1a542c3d ("RISC-V: Implement sparsemem") Signed-off-by: Greentime Hu Reviewed-by: Anup Patel [paul.walmsley@sifive.com: fixed patch description] Signed-off-by: Paul Walmsley --- 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 7255f2d8395b..42292d99cc74 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.23.0