Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp704008yba; Thu, 16 May 2019 07:40:08 -0700 (PDT) X-Google-Smtp-Source: APXvYqy2FQT660O3q4H7RN/XMDPkHLf/d3nS4NXo4V6Srqkcz/CwS27KsqDIjE97r6WIKyC8ZMuf X-Received: by 2002:a62:ac0a:: with SMTP id v10mr55132606pfe.57.1558017608248; Thu, 16 May 2019 07:40:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558017608; cv=none; d=google.com; s=arc-20160816; b=HGurgRdbmMXL81QZomaAiFA4m/M2anRZKO8XCn/d8TSFyc8KivBBtkLIoYjSnN+qAG dOmkBDwclgl6EjaNnLj/Xtaiq8P45xddSWKIHtSJQUVSEbvlbLuEMsZ1USDhe2pLV/Lx ljJk8DPH6pzDv+tvKl3q2tstL69Q9lSQQtRoc0jKgCcy8Zi1g3vqFhrM4PGxZ/QGiBoD 243R2MWU4GoOnKyWLoyo9DUFnLfH9A3vZpX9zd/brwQ6AfeSa6MmrgMdJa6GdTXa0ylU f9cqfCRnWuT88GP7EFMUCvKfWsXMcA35SAwKHBw+o9eudxynMICv8uzNgUp/vIX2lQXy iblg== 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=ZEuIp88xnVr1ozM6x0kuSvF5WYoMEGVhjJEmoVoPjIE=; b=z4bgNF0GNdrV6soLHgirL5snzbxDxGkOyGrXV7e3uZVWQhEjW3YCTypk7+MxQULHqT GwXJ63xv+MPYJespk3C+i/413i0hbFzI7Z5IvHzri2Vr2a4Di3S+60SltOW4kcNQtwMh 9vqKozHBvMQweVRGZNdQHXtUfrhD28tEQKKmQnvFP2X5RHTBvXhZO4/9008cyPVOKFTb BbTLoliDLPU8vWf/9J1EGxXkmpBneapEulu8o37McaIMUH6buREiDZx2o/Ub89K1jGQa 6JSuDBO2K7l0LIYpbPB+dFCsA7U0UDlq8whhByj0eGbK0TGyeNmwzQHiOZ1G6uOUDgRV ozeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=n2o986ut; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f11si4951133pgl.539.2019.05.16.07.39.51; Thu, 16 May 2019 07:40:08 -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=@kernel.org header.s=default header.b=n2o986ut; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727144AbfEPOhT (ORCPT + 99 others); Thu, 16 May 2019 10:37:19 -0400 Received: from mail.kernel.org ([198.145.29.99]:56424 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726687AbfEPOhS (ORCPT ); Thu, 16 May 2019 10:37:18 -0400 Received: from mail-qt1-f171.google.com (mail-qt1-f171.google.com [209.85.160.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D040C20862; Thu, 16 May 2019 14:37:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1558017437; bh=UPgAsUc79XNtfoQLrq5V7qKL0/VATYvYljrh0Yj6lC8=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=n2o986utdwrt65N1HHcVbGub2fHvrq6Z4LEqkZ2qoBktiT2y2DVRtZPHi7RdF9M4b PLRCHV1s+1ZaAkWT+a8kBvyFVXzVXKww0djxYygi+d8bTb7bkSpZ003Bw0TIqndGt2 waogEKjp45WBd1mx5k4syT9ImPuVR90FaHySr/x8= Received: by mail-qt1-f171.google.com with SMTP id y22so4124656qtn.8; Thu, 16 May 2019 07:37:17 -0700 (PDT) X-Gm-Message-State: APjAAAWYKF4x1IS1n0KLvQxaIxWrF4lpfYhIMYN8LdImu7mK6A4QWPc2 +K479C24tmlqPVR82OYdgZOQK4Bt/JRqILipBg== X-Received: by 2002:a0c:87cd:: with SMTP id 13mr13711355qvk.218.1558017437078; Thu, 16 May 2019 07:37:17 -0700 (PDT) MIME-Version: 1.0 References: <20190516102817.188519-1-hsinyi@chromium.org> <20190516102817.188519-2-hsinyi@chromium.org> In-Reply-To: <20190516102817.188519-2-hsinyi@chromium.org> From: Rob Herring Date: Thu, 16 May 2019 09:37:05 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v3 2/3] arm64: implement update_fdt_pgprot() To: Hsin-Yi Wang Cc: "moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE" , devicetree@vger.kernel.org, "linux-kernel@vger.kernel.org" , Frank Rowand , Catalin Marinas , Will Deacon , Andrew Morton , Mike Rapoport , Ard Biesheuvel , Miles Chen , James Morse , Andrew Murray , Mark Rutland , Chintan Pandya , Jun Yao , Yu Zhao , Robin Murphy , Laura Abbott , Stephen Boyd , Kees Cook 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 Thu, May 16, 2019 at 5:28 AM Hsin-Yi Wang wrote: > > Basically does similar things like __fixmap_remap_fdt(). It's supposed > to be called after fixmap_remap_fdt() is called at least once, so region > checking can be skipped. Since it needs to know dt physical address, make > a copy of the value of __fdt_pointer. > > Signed-off-by: Hsin-Yi Wang > --- > arch/arm64/kernel/setup.c | 2 ++ > arch/arm64/mm/mmu.c | 17 +++++++++++++++++ > 2 files changed, 19 insertions(+) Why not just map the FDT R/W at the start and change it to RO just before calling unflatten_device_tree? Then all the FDT scanning functions or any future fixups we need can just assume R/W. That is essentially what Stephen suggested. However, there's no need for a weak function as it can all be done within the arch code. However, I'm still wondering why the FDT needs to be RO in the first place. Rob