Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp705407yba; Thu, 16 May 2019 07:41:27 -0700 (PDT) X-Google-Smtp-Source: APXvYqwMQ+EI+y0+hpiovSKb0SZNNQlUWZawvSwXC7ZcOYNq0VQstJi+kuTFNWFYpMYpTJo2OHyP X-Received: by 2002:a17:902:9693:: with SMTP id n19mr50346672plp.92.1558017687745; Thu, 16 May 2019 07:41:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558017687; cv=none; d=google.com; s=arc-20160816; b=mfP+U1gkY48e5pr/uNXAnjlPOa8dfDuho4P4Eicnpdfsd2bbyjL09X3RxHSJ+BxqZ9 tLHmsvQK8f7uMgRf7IcrfTck7jN+yOPbLuwePdT3VDHasLxkBhUg5pCrQghZhOyubLWp UHgsPzthtNJP75klLTHSPlvP6eCFOrCLpXoV6yLJqZROz8pMhU2fTjA+GLuD90AoOVRu 7/IwyzW6CYAeQDMOI/2D/gIj4spJwRD6F3xhiRbFr5z/7zEv10Of88A3LDiywYx0L6ga kuUx0WnmRWoVGR2imdU7iK1yvx9lYCx+ftdGh7/utdfRgFKa71yPoE/YeUub0T3mVUsL AmRQ== 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=3CyBDin8DCVhqMsm5Y31nNq5E0wYgKjhJ5os3L5pACs=; b=H2HjQe/kGVsiKE/xRzeCXrFG9ZAAraN5epQz9TLjO480i/Hi3r+UtWNtvcOnHduaRI 2iesnLlg5tj7NBdQ22EEA0KpfowgzotLyDcAVeNHjs+637bICZgZjNEuDHD2CL6koQ5A xFEr95TeTfXb2b9UusPmLM64yXZHTUm5ypuBxfSf57Fk4NHg/B0EFeXeDbSiaC+8JrCb ViiDcpBOBHD4Gm6uUvMwsE3HKBfUSfeVvLdKMmq89IptqkWhwPpJEoHn3cYemoqZG8z5 +TWxkgqVketKAUtNXLg0KCyzIZ4Kw4417DiFFRd2YqJlCt4qcMYqm+/EppYSkcFnNOxD 4t5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=XewtSERX; 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=linaro.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.41.10; Thu, 16 May 2019 07:41:27 -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=@linaro.org header.s=google header.b=XewtSERX; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727290AbfEPOjr (ORCPT + 99 others); Thu, 16 May 2019 10:39:47 -0400 Received: from mail-ed1-f67.google.com ([209.85.208.67]:42788 "EHLO mail-ed1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726717AbfEPOjq (ORCPT ); Thu, 16 May 2019 10:39:46 -0400 Received: by mail-ed1-f67.google.com with SMTP id l25so5594529eda.9 for ; Thu, 16 May 2019 07:39:45 -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=3CyBDin8DCVhqMsm5Y31nNq5E0wYgKjhJ5os3L5pACs=; b=XewtSERXwuRq/hMVzfTTvLn3bup7RL3HYHHiSaecYOcuXF0IYqV7+eahP0uoc2sntm all0N0vBT2cEdbkpmEsZSMOHRpXo6iW0x4s9X85jbF/Gs3irW/ih2LB9XWftHVqFvoxL zLCWkLS84U94nRd2oDZuAQn3I+MZk66knbYg515af60MhANSCel3a9ThgmTA0MVapTqI 5zV2XK01YaT/iulH3tvZbCE7lRjnY+IhIzPwTcHf6do6SiNoFYitBpKumOTkoznvSoYZ 6KDcV0oC5T1hfz1q7tbHZMWpCM0WYLl0ytkNaqiRTMcFgZuF3edRp1KtFoFaMc9E57Z3 le5A== 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=3CyBDin8DCVhqMsm5Y31nNq5E0wYgKjhJ5os3L5pACs=; b=EYDfsGCIVlDCZFCNMzG/xJUGZejY9TA3ul+zjXQFMhk+Z9PLIak6/Im21PxUXb+h8L SE9T2bmqoLZ3LkmxQJx+TKBehurCgACCSYknvKMeqaq2kw17eL6eTj71YyOdIW71NO+X Dmnit/AshUdd0A7mhAh9Gqz/ruwWxjeOz9UaQ28Xx2JdiELpenCITSArOt2rXFCrswnB S3BJYu8I5ehIPztogkkmqXaAwjVn36dSNR+SkxmnVOckXGitycNnRsW6LoDInGHhnQro D6jSCbtc+dzYqXMWarMkLWcqKxLBikel+GjuBjj7LPukwKX0usYc5Bh9oW3nEG9xFqlG ha5Q== X-Gm-Message-State: APjAAAXX5EiKTCam3TWxFEWk5vW3RrFvemnZLvFxkB5rRv9EpsSWOOdW ojHic4Zzh9IdxuSBAjLJ4EG/d2V8hA2e7bUby4aOlA== X-Received: by 2002:a17:906:b6c8:: with SMTP id ec8mr39217179ejb.89.1558017584937; Thu, 16 May 2019 07:39:44 -0700 (PDT) MIME-Version: 1.0 References: <20190516102817.188519-1-hsinyi@chromium.org> <20190516102817.188519-2-hsinyi@chromium.org> In-Reply-To: From: Ard Biesheuvel Date: Thu, 16 May 2019 16:39:32 +0200 Message-ID: Subject: Re: [PATCH v3 2/3] arm64: implement update_fdt_pgprot() To: Rob Herring Cc: Hsin-Yi Wang , "moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE" , Devicetree List , "linux-kernel@vger.kernel.org" , Frank Rowand , Catalin Marinas , Will Deacon , Andrew Morton , Mike Rapoport , 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, 16 May 2019 at 16:37, 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. > It was RO because it could be RO, and we wanted to ensure that it didn't get modified inadvertently (hence the CRC check we added as well) If there is a need for the FDT to be RW, let's make it RW.