Received: by 2002:a25:2c96:0:0:0:0:0 with SMTP id s144csp181413ybs; Sun, 24 May 2020 01:57:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwOQc8EEFyfWR662k2HZTm69/meIiyvnWZS6sXaPpFN8tQYODTKhJdMX2uI25/99FTlZgk6 X-Received: by 2002:a17:906:d216:: with SMTP id w22mr1931873ejz.420.1590310653330; Sun, 24 May 2020 01:57:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590310653; cv=none; d=google.com; s=arc-20160816; b=UsezNep2+L9vdqll0gk6eb+6+vDAATAbuWQsBsP6qzdAPWk/eJHyAWl+JpmClmxKGr f9RHT8KPVqCFSI3nBKuT5SdH+V/CTB4D2/cxJD3evJllOoIpfnzLUlDmhA6AM9lfHCcI X9CgvfbAPRnCtrg94yHwnWfBK7EQF44z7Q6RPAKwYe/Jp4VSKajIuVmMXRGfW82UBF2z qjd7iy/mrP2u2ZRC2S1hOQ4VYbsLxdsjYrBZYG6RDwY0a8+Kz6JEaHYWGHFJKqv9FTud W+EKvMG5MZN3sba5MF1Mh6aHUH5QwebOFnVPampNaxynb4SpVa7Pms2QarZMYXb1203i 5emw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=MuaKZ6gUHoGq94hCGMChhVqVRCz6WEL6uzx+rxfhFsk=; b=sUHQ8CayEhr6OGnzqHB51yeu43WvcpChJaFywy7K/Vlpoq4oM3Tt+YiBB9r3spNZY5 NRrQnBleh0MQTVSsD4PAV9mQXiigYp1RwL31mBmyIyChLxZvzt4E3N6E6ko5QV6+pgDR SS+EHR1IeW1d28P4MMasNlU0Ky/tP9NusVmOddYD1E9T1BsIcKrayoKGk1Xy1dF8RdoV OYYdNr3RgQHfsbcNP2dBrh0QCuolzfHHtIfExS1pyDYnKaBmYqL/JzTCN6YUh6se4Xgt DN55k2d/+IIbmziMhGnMHQJ1H9Rds8rk9DnAvTpcP5uNcAvP0JZAmvcAtMVNk0XFUpFI Y4aQ== ARC-Authentication-Results: i=1; mx.google.com; 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 d17si3454015eje.142.2020.05.24.01.57.09; Sun, 24 May 2020 01:57:33 -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; 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 S1728583AbgEXIxV (ORCPT + 99 others); Sun, 24 May 2020 04:53:21 -0400 Received: from relay12.mail.gandi.net ([217.70.178.232]:53393 "EHLO relay12.mail.gandi.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727848AbgEXIxV (ORCPT ); Sun, 24 May 2020 04:53:21 -0400 Received: from localhost.localdomain (lfbn-gre-1-325-105.w90-112.abo.wanadoo.fr [90.112.45.105]) (Authenticated sender: alex@ghiti.fr) by relay12.mail.gandi.net (Postfix) with ESMTPSA id 5C8BB200006; Sun, 24 May 2020 08:53:08 +0000 (UTC) From: Alexandre Ghiti To: Michael Ellerman , Benjamin Herrenschmidt , Paul Mackerras , Paul Walmsley , Palmer Dabbelt , Albert Ou , Anup Patel , Atish Patra , Zong Li , linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org Cc: Alexandre Ghiti Subject: [PATCH v3 0/3] vmalloc kernel mapping and relocatable kernel Date: Sun, 24 May 2020 04:52:56 -0400 Message-Id: <20200524085259.24784-1-alex@ghiti.fr> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This patchset originally implemented relocatable kernel support but now also moves the kernel mapping into the vmalloc zone. The first patch explains why we need to move the kernel into vmalloc zone (instead of memcpying it around). That patch should ease KASLR implementation a lot. The second patch allows to build relocatable kernels but is not selected by default. The third patch takes advantage of an already existing powerpc script that checks relocations at compile-time, and uses it for riscv. Alexandre Ghiti (3): riscv: Move kernel mapping to vmalloc zone riscv: Introduce CONFIG_RELOCATABLE arch, scripts: Add script to check relocations at compile time arch/powerpc/tools/relocs_check.sh | 18 +---- arch/riscv/Kconfig | 12 +++ arch/riscv/Makefile | 5 +- arch/riscv/Makefile.postlink | 36 +++++++++ arch/riscv/boot/loader.lds.S | 3 +- arch/riscv/include/asm/page.h | 10 ++- arch/riscv/include/asm/pgtable.h | 37 ++++++--- arch/riscv/kernel/head.S | 3 +- arch/riscv/kernel/module.c | 4 +- arch/riscv/kernel/vmlinux.lds.S | 9 ++- arch/riscv/mm/Makefile | 4 + arch/riscv/mm/init.c | 121 +++++++++++++++++++++++++---- arch/riscv/mm/physaddr.c | 2 +- arch/riscv/tools/relocs_check.sh | 26 +++++++ scripts/relocs_check.sh | 20 +++++ 15 files changed, 258 insertions(+), 52 deletions(-) create mode 100644 arch/riscv/Makefile.postlink create mode 100755 arch/riscv/tools/relocs_check.sh create mode 100755 scripts/relocs_check.sh -- 2.20.1