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=-4.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no 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 CDB24C4363D for ; Tue, 6 Oct 2020 13:17:43 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 5E10E2078E for ; Tue, 6 Oct 2020 13:17:43 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="Ch/yor3Q"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="ogYaITeV" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5E10E2078E 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=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:To:Subject:Message-ID:Date:From:In-Reply-To: References:MIME-Version:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=vTyF18U9IfMpQiFVR2t6Gnsu+c/6LonFJfgS+K1NoNc=; b=Ch/yor3Q6zZvQD5i0IA/rbEOa HdXKjcT9++iShX8tZnyNgnc7WONIl7v3ZzMsHzJ6+sNngT7WRRgtUXkVpTbPJhGJedPdeJjVWYEXO w9kNuJB6vkr10rnoXvmwmRKw87lu+ywSadACmyiAVSgHC91LqctRM7PL1pvJfVQdrJU2RzdUnVo8H R5U0LpT4dfLdA0e7xFuakw/yqk01GClQEkU3wK4IXKm0JTrjVCymvgeqyj2VKnTvXgvFqVKmFPGqE WKIA9Z+sejzq+bLMAxyO67r709TA7F+x2r1aYQdSIAdASQETXnvzyj+kQFVuH4e0GpQ6ySZO2FCr0 qvqnAqzwQ==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kPmpF-0007Oo-9v; Tue, 06 Oct 2020 13:16:17 +0000 Received: from mail-lj1-x241.google.com ([2a00:1450:4864:20::241]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kPmpB-0007Ny-Tr for linux-arm-kernel@lists.infradead.org; Tue, 06 Oct 2020 13:16:15 +0000 Received: by mail-lj1-x241.google.com with SMTP id p15so6591283ljj.8 for ; Tue, 06 Oct 2020 06:16:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=E0EKr50U1QHHk1/GysECGKkjL2Cx4Zts6t8kYevTEjI=; b=ogYaITeVz8H+sPEjnV4hzgWxw170cuSL/y2iUQvSIemRd6iffwRiMgglMchzU4dJu+ gKAHqhqhVMPfBXE1yexy6T8a3K2cK9APqk6K1CNJYYry6StcTr+F5GmpjNe1oTtQ7Xvw yjzTlNmI8OQGGwC6sOMUsX0um/vUJ6OapLfrVDUdkF9vdakTNwz61r7CWA0+HlPOdc30 z+IUd3+QlkNCDgPU/eTod+Nj94Dp1AzBnOLPYerH2+7t1GLqZZf/5V1Mgc7TbT2WzSZs 187UXCrvOhMd9zvKBhmLFijlockIZSfPzlaqZBVd7XTiQ93yrr36Qc4VH3DVYD3R+lBa YtUw== 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=E0EKr50U1QHHk1/GysECGKkjL2Cx4Zts6t8kYevTEjI=; b=Nd01LILA9tno5q7WGes25X5vn4kWObGdZyz4NQDALkWaWEbM+hXID1XcyMN5Lx2LmH bmE4ZeZFRM4m8DohPUXHn65TKFbuELw14NTUPn0y+McnN0CctnMmJBCuHR4K5beU5Wtz L3nBkRUS7U/oSB1P+kLevUoZZVH3uJqT46sFKSvQbqPto0VKG5erPQVDMQQMWIhwLaWz fhL6ZVu2NS87yM4dqzxgu1Qxsf5E/4s0jCS3czJHwDpeSkp1JUQldnpI29ONfggyU9C1 Rf6EyX9AlKiXwVp5FAl9uJEWevkJPepXqKKq6B9Bv8prDCGa+rMR38j+LgKlweqhtf39 vdkw== X-Gm-Message-State: AOAM533mP/z0nkct1deuRS0d0g653ER/f/vNPNJd812q9kb0CESeu7sd pKSPlRjenq3/IDqkA8On3dZgGc7Xoi/6G9QQ33SdJA== X-Google-Smtp-Source: ABdhPJyNjLzSM/LAUWRTQsogakE7kf96E8cVZgPyxVe0vTZxMdXpvPgJ+N06cDUuavc+qy8N/tdGLSALFtzPWzB5nZY= X-Received: by 2002:a2e:4e01:: with SMTP id c1mr1691526ljb.144.1601990172108; Tue, 06 Oct 2020 06:16:12 -0700 (PDT) MIME-Version: 1.0 References: <20201006094918.9819-1-ardb@kernel.org> In-Reply-To: <20201006094918.9819-1-ardb@kernel.org> From: Linus Walleij Date: Tue, 6 Oct 2020 15:16:01 +0200 Message-ID: Subject: Re: [PATCH 0/2] ARM: move FDT mapping out of linear region To: Ard Biesheuvel X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201006_091614_268676_0A93D582 X-CRM114-Status: GOOD ( 22.77 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Rob Herring , Florian Fainelli , Russell King , Linux ARM , Nicolas Pitre 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 On Tue, Oct 6, 2020 at 11:49 AM Ard Biesheuvel wrote: > For the ARM kernel, setting up the kernel's virtual address space at boot > is tricky, given the risk of collision between 1:1 mapped regions and > virtually remapped regions. There is also a concern regarding the exact > mapping attributes that are needed for each region, which differs between > ARM architecture revisions, UP vs SMP etc > > For this reason, the kernel VA space is set up in two stages: at early > boot, only the kernel itself and the DT are mapped using section mappings > and later on, all existing mappings are torn down except the one covering > the first memblock covering the kernel, and remapped again using the full > fledged mapping routines that can map at page granularity and use all the > right mapping attributes. > > There are cases where this may result in the DT getting unmapped at > this point, and not remapped again. For instance, if the first memblock > is not PMD aligned, we will align it up, and mark the memory below it > as MEMBLOCK_NOMAP, to avoid having to allocate page tables to create > the mapping before we have a mapped memblock to allocate from. If the > DT happens to reside in this region, it will not be mapped at all when > the permanent kernel VA mappings are in place, resulting in crashes. > > As we happen to have a 4 MB hole in the kernel VA space (between the > end of the VMALLOC space and the start of the FIXMAP region), let's > use it to create a permanent, read-only mapping of the DT that is not > affected by any such issues. > > Cc: Linus Walleij > Cc: Florian Fainelli > Cc: Russell King > Cc: Nicolas Pitre > Cc: Rob Herring Hats off, this works perfectly. I tossed these patches under my KASan stack and it boots without any problems on the Qualcomm APQ8060 with its peculiar memory layout. Reviewed-by/Tested-by: Linus Walleij Yours, Linus Walleij _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel