Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp708930yba; Thu, 16 May 2019 07:44:57 -0700 (PDT) X-Google-Smtp-Source: APXvYqww8id6u0bhPx0TiDhHWiOTHNXLEB7OLkDUwvtxk/WfSCndU679zG08390ObwMm1kgLmfel X-Received: by 2002:a63:1657:: with SMTP id 23mr911894pgw.98.1558017897068; Thu, 16 May 2019 07:44:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558017897; cv=none; d=google.com; s=arc-20160816; b=bzZCqSNaCnijHM4ojW1HrZvG3l4iJYOKRAkiqjTvUJS2oJfWppON5V8KTGMYcgx/5g q6cmD9vmcBWdgn3mmbDsJgTlH+bneL8daBxGgiujlgTMDtxdEb8hKx3/D6Br8wrU89/p /B8H1YXGzwt+xpdeUWayb7k0XKcOf1nEjUFknXzrhUoNjRw2PaGu0iJYt0X23HEeexHx hda3e5NejupAY0Hth3FEiO4fBoqQrNYUgvGgNJQJcCBLeJP0X0Lz9Yy9iQ9+tp7AM9Xu LKUQYOMLKisHMic7QlRgMHGD3bOxj5NqhDJ0SzbROlVS5pud1RkHzxRMr8ssCEZYRO9G 28LQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=yF4W/HnE3+qnm9qc7XkJBdJytbChHcru9UWwEL8xflg=; b=wgmeqVhqM7mBEunyFw8qXPAL+rVfcT5vQZsUK4MjssgD2P1B65DEvza2Jd3epLZzoc Ab0papNUOtEOmo0LJ0Ws7I07SD2YK6bE0XEpsM+mnZtt5mqYEyfWpy5CqpmJ5uMUM4uw bRcQKaS67+hlV1FbLFR38Pz/443xnbTaN6FSel321ak4h91Ex3nA08wcLXf6w+MdB00D vT7Ziqgkoj7SqDR1gBUlGaoHdJR57h8SIoZwp3ZSPbCzD+LRB+mcxcHsYceUo7/CB7Nd 7NRSSV+6IpKsZT1j3uJxtYy4ry6pRdQHYw9IvwYcCwIruhHxeMDJ0dPVZ7/zTdrdvNjF cvbg== ARC-Authentication-Results: i=1; mx.google.com; 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 r7si4956270ple.418.2019.05.16.07.44.40; Thu, 16 May 2019 07:44:57 -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; 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 S1727264AbfEPOnL (ORCPT + 99 others); Thu, 16 May 2019 10:43:11 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:48250 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726717AbfEPOnK (ORCPT ); Thu, 16 May 2019 10:43:10 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 1D5461715; Thu, 16 May 2019 07:43:10 -0700 (PDT) Received: from lakrids.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id AFD003F71E; Thu, 16 May 2019 07:43:06 -0700 (PDT) Date: Thu, 16 May 2019 15:43:04 +0100 From: Mark Rutland To: Rob Herring Cc: Hsin-Yi Wang , "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 , Chintan Pandya , Jun Yao , Yu Zhao , Robin Murphy , Laura Abbott , Stephen Boyd , Kees Cook Subject: Re: [PATCH v3 2/3] arm64: implement update_fdt_pgprot() Message-ID: <20190516144303.GF43059@lakrids.cambridge.arm.com> References: <20190516102817.188519-1-hsinyi@chromium.org> <20190516102817.188519-2-hsinyi@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.11.1+11 (2f07cb52) (2018-12-01) 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 09:37:05AM -0500, Rob Herring wrote: > 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. We want to preserve the original FDT in a pristine form for kexec (and when exposed to userspace), and mapping it RO was the easiest way to catch it being randomly modified (e.g. without fixups applied). I'd prefer to keep it RO once we've removed/cleared certain properties from the chosen node that don't make sense to pass on for kexec Thanks, Mark.