From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.1 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 98EE0C433B4 for ; Mon, 17 May 2021 15:02:41 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 27F8661029 for ; Mon, 17 May 2021 15:02:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 27F8661029 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=eW1CZZJt5/t81vWtZx5hODzm5izfh5Qbyo+ukIv5lT8=; b=YX6Ipfd5jxMdcv65Ow8VHhC/y QLM3tfibk1mDlQeoxxgJ+26UKk4Wgc+SJyFW1/fz4kGgJThbWOp2OoQeZmWoYplVoPGqYvETRIeGr PKO1IjdcXZNBDPGJOD11VbzrIgovpiA3AaYF0xOmRluaBcaJPyBlASZIR1MDZm0Cz09r521mCN6Ql Fl/JiIt027OFeerbvER62u9MbBYHrLAfSEWaJj+UpXSYsyAhM+SH6kggo2I4Elu0DxFAF/EWbAcQV QDvb+IWfO3aqFIVgIeHyzLDscwFR/0pXE3cAytQYVwnLfqiH1fnE4Lw9KcKfR+RB+7ehUy47YmQ3m R7NxWwjXA==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1liejm-00FLE8-Be; Mon, 17 May 2021 15:00:54 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1liejh-00FLDJ-IG for linux-arm-kernel@desiato.infradead.org; Mon, 17 May 2021 15:00:49 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender :Reply-To:Content-Type:Content-ID:Content-Description; bh=a1Icj33cVQz5+rlV9zDpEQ19nt6FhzyUrJNZ0Mb9Rt8=; b=GNIYmjeKhOEyDtTy9TYmvVLJQp Z+rLmeFH8Fw+BRkeOBdAurlP8i7NQO7EvSWmbQ1RbIfIxuOY1394MazPbwVszxgyu9JcmtBCm3ZQT BPVRqwBmZ6ZaERCVtQTTE+ZzFVIvP/UYUxfYSN3JIQZzfSKrDok5IjlaBf7HBn1cYd5M3B3zqTAzU vkaoMPgqcltj2AJanlrhrxjj/LCvfo+4DH4SXWRMtg2O3RIK09eotpE1Zr6qMDM53pKiciTHnA3iG GZA2mgfvsaANKRlBVwr8NZJ16n2kSpxigUsPJQ90OKtYSqofsC/2QVKj9f6qEPsiEtywHLnX+mOwg GK+x8ysg==; Received: from mail-lf1-x134.google.com ([2a00:1450:4864:20::134]) by bombadil.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1liejc-00DtQh-GT for linux-arm-kernel@lists.infradead.org; Mon, 17 May 2021 15:00:48 +0000 Received: by mail-lf1-x134.google.com with SMTP id a2so9242484lfc.9 for ; Mon, 17 May 2021 08:00:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=a1Icj33cVQz5+rlV9zDpEQ19nt6FhzyUrJNZ0Mb9Rt8=; b=Gq5smhoEQaLkyC08FFbW7+susPJ9jzbGPnU4U5Q2fARZ+pvmwrUaqTC3noXomUsu+W 1p1YIgIz4qKLt6nsguBYuwc71mc9lZjedAez4VjDosUBwfw52K7nIqon6mF0nE4DlA+E pU6eFYAj+V/A2kGrP6c1ODTjoRVl/3jd9B7wGlPIW0II/X/WhR+2st6yeZp0hoZVK+vS XS3hPNSRAu0J4CVVWswmwn5ZoqGwbCV/2xcOtytGZnK5dX9vT2Ct2LQQphbos7bmFItv +sbYcVp2N+jtJohojoyDkgFzLn88cPQYoM5RME8+x90E2Y57MREvsYhPxEXuk7m06SVP 6Lng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=a1Icj33cVQz5+rlV9zDpEQ19nt6FhzyUrJNZ0Mb9Rt8=; b=K3bSmMsaJsI6CTAzjb6LPSLk4jQhpQS9I2NglUtQY2p2TQ1AkeF4L0wmRNI8jGiAsw yW6wgkJapJ1FC2slt+cEoUEpSw/IAXLXuaencVyCD5nDIDsGrBcA7PajFiM8UuL3cZ9I Gv1ermDSF6CyGmk1NKhJXxzyE550Iwz8ASOTPRH0JvJx6JmzodswXyFsnMPiJfsgBNM8 KSXEFjLKRkSRDEhUKPIXR+BKnJFRBKuajNzkVUl2cvBE+JAaYzq/raOS2Rkr5qQxcmfX yuWYK1u6tf3aTCibGD34jw8tc8RG4g21OVxRCVNskPge218YbHWBD1jhMXAh3XjWD/Hz YGXg== X-Gm-Message-State: AOAM5303xXgDKCp6agoRlVPCD33W7r5soepqsJaLzWgBavhGI1PEUB48 hRiAhTowyk97aW1tJzYEkGYTuwQ8vSgGeg== X-Google-Smtp-Source: ABdhPJwIHwXc5A5hAyR4DOBOatNUoy+S1qH3bV9vpCEwCW3jiseERex4soi5p447z7aFLV4npq//MA== X-Received: by 2002:ac2:4dac:: with SMTP id h12mr229994lfe.308.1621263642317; Mon, 17 May 2021 08:00:42 -0700 (PDT) Received: from localhost.localdomain (c-fdcc225c.014-348-6c756e10.bbcust.telenor.se. [92.34.204.253]) by smtp.gmail.com with ESMTPSA id h13sm2863080lji.102.2021.05.17.08.00.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 May 2021 08:00:42 -0700 (PDT) From: Linus Walleij To: linux-arm-kernel@lists.infradead.org, Russell King , Arnd Bergmann Cc: Florian Fainelli , Geert Uytterhoeven , Ard Biesheuvel , Linus Walleij Subject: [PATCH 1/3] ARM: Split KERNEL_OFFSET from PAGE_OFFSET Date: Mon, 17 May 2021 16:57:17 +0200 Message-Id: <20210517145719.110966-2-linus.walleij@linaro.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210517145719.110966-1-linus.walleij@linaro.org> References: <20210517145719.110966-1-linus.walleij@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210517_080044_630224_C31B9CC7 X-CRM114-Status: GOOD ( 20.84 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org We want to be able to compile the kernel into an address different from PAGE_OFFSET (start of lowmem) + TEXT_OFFSET, so start to pry apart the address of where the kernel is located from the address where the lowmem is located by defining and using KERNEL_OFFSET in a few key places. Signed-off-by: Linus Walleij --- arch/arm/include/asm/memory.h | 8 +++++++- arch/arm/kernel/head.S | 3 +-- arch/arm/kernel/vmlinux.lds.S | 2 +- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/arch/arm/include/asm/memory.h b/arch/arm/include/asm/memory.h index a711322d9f40..a5f1d1826a98 100644 --- a/arch/arm/include/asm/memory.h +++ b/arch/arm/include/asm/memory.h @@ -20,8 +20,14 @@ #endif #include -/* PAGE_OFFSET - the virtual address of the start of the kernel image */ +/* + * PAGE_OFFSET: the virtual address of the start of lowmem, memory above + * the virtual address range for userspace. + * KERNEL_OFFSET: the virtual address of the start of the kernel image. + * we may further offset this with TEXT_OFFSET in practice. + */ #define PAGE_OFFSET UL(CONFIG_PAGE_OFFSET) +#define KERNEL_OFFSET (PAGE_OFFSET) #ifdef CONFIG_MMU diff --git a/arch/arm/kernel/head.S b/arch/arm/kernel/head.S index 7f62c5eccdf3..4e2daaa7636a 100644 --- a/arch/arm/kernel/head.S +++ b/arch/arm/kernel/head.S @@ -23,7 +23,6 @@ #if defined(CONFIG_DEBUG_LL) && !defined(CONFIG_DEBUG_SEMIHOSTING) #include CONFIG_DEBUG_LL_INCLUDE #endif - /* * swapper_pg_dir is the virtual address of the initial page table. * We place the page tables 16K below KERNEL_RAM_VADDR. Therefore, we must @@ -31,7 +30,7 @@ * the least significant 16 bits to be 0x8000, but we could probably * relax this restriction to KERNEL_RAM_VADDR >= PAGE_OFFSET + 0x4000. */ -#define KERNEL_RAM_VADDR (PAGE_OFFSET + TEXT_OFFSET) +#define KERNEL_RAM_VADDR (KERNEL_OFFSET + TEXT_OFFSET) #if (KERNEL_RAM_VADDR & 0xffff) != 0x8000 #error KERNEL_RAM_VADDR must start at 0xXXXX8000 #endif diff --git a/arch/arm/kernel/vmlinux.lds.S b/arch/arm/kernel/vmlinux.lds.S index f7f4620d59c3..20c4f6d20c7a 100644 --- a/arch/arm/kernel/vmlinux.lds.S +++ b/arch/arm/kernel/vmlinux.lds.S @@ -47,7 +47,7 @@ SECTIONS #endif } - . = PAGE_OFFSET + TEXT_OFFSET; + . = KERNEL_OFFSET + TEXT_OFFSET; .head.text : { _text = .; HEAD_TEXT -- 2.31.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel