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=-5.5 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,T_DKIMWL_WL_HIGH,URIBL_BLOCKED,USER_AGENT_MUTT autolearn=unavailable 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 3F555C04AB0 for ; Sat, 25 May 2019 09:31:19 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (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 106D12133D for ; Sat, 25 May 2019 09:31:19 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="B2CGq3mJ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 106D12133D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.ibm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-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=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Message-Id:In-Reply-To:MIME-Version: References:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=uQM95cxJu/FXdP0nV37Fi0nKkBibgZ1blQRW3dlj1nQ=; b=B2CGq3mJkW4SeR p39g4pFaRfanl9ACDWKUuW8jh72umH6Gh91wKyfcUUPUP/j4gBBk6n7ABPDhBAYpILVZJjIZDH5UG 1wstEsmQtXOyYkjBg2nRFrrvg8AfWCWB8iNeg+VBoVKhxdy5ncLkNtgmnIIbxZFP/Oq6O6mxkNaTj 0wCac+fPRVfLT0I1mPF47ZVTmhEhOPO5epPGYgAeoPNmVgfcJYiPv5NP2wmtTdUTywqKAHZWCB0RJ 0gbERMWRhhxBS0xKMuJXwLHBmkgZ8w2hRCNqwmqAEix4ALh5y/rcvk7KhnFcOPhA0URjkFFZNteeC /ZxPfkKCAQHPJ1+gVn3g==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hUT1A-00069X-2c; Sat, 25 May 2019 09:31:08 +0000 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hUT17-00068l-Ao for linux-arm-kernel@lists.infradead.org; Sat, 25 May 2019 09:31:06 +0000 Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x4P9U4Ze116641 for ; Sat, 25 May 2019 05:31:01 -0400 Received: from e06smtp07.uk.ibm.com (e06smtp07.uk.ibm.com [195.75.94.103]) by mx0a-001b2d01.pphosted.com with ESMTP id 2sq275h5d8-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Sat, 25 May 2019 05:31:01 -0400 Received: from localhost by e06smtp07.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Sat, 25 May 2019 10:30:59 +0100 Received: from b06cxnps3074.portsmouth.uk.ibm.com (9.149.109.194) by e06smtp07.uk.ibm.com (192.168.101.137) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Sat, 25 May 2019 10:30:53 +0100 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x4P9UqPT61014152 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 25 May 2019 09:30:52 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B7C6611C054; Sat, 25 May 2019 09:30:52 +0000 (GMT) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0478411C04A; Sat, 25 May 2019 09:30:51 +0000 (GMT) Received: from rapoport-lnx (unknown [9.148.205.112]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Sat, 25 May 2019 09:30:50 +0000 (GMT) Date: Sat, 25 May 2019 12:30:49 +0300 From: Mike Rapoport To: Stephen Boyd Subject: Re: [PATCH v4 1/3] amr64: map FDT as RW for early_init_dt_scan() References: <20190519160446.320-1-hsinyi@chromium.org> <5ce73503.1c69fb81.5f889.1d84@mx.google.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <5ce73503.1c69fb81.5f889.1d84@mx.google.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-TM-AS-GCONF: 00 x-cbid: 19052509-0028-0000-0000-000003714C55 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19052509-0029-0000-0000-00002431045F Message-Id: <20190525093048.GB31026@rapoport-lnx> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-05-25_07:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1905250067 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190525_023105_486242_568FCCDE X-CRM114-Status: GOOD ( 25.68 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , devicetree@vger.kernel.org, Yu Zhao , Kees Cook , Ard Biesheuvel , Catalin Marinas , Will Deacon , linux-kernel@vger.kernel.org, Jun Yao , Miles Chen , Rob Herring , James Morse , Hsin-Yi Wang , Andrew Murray , Andrew Morton , Laura Abbott , Frank Rowand , linux-arm-kernel@lists.infradead.org, Robin Murphy Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, May 23, 2019 at 05:04:18PM -0700, Stephen Boyd wrote: > Quoting Hsin-Yi Wang (2019-05-19 09:04:44) > > diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c > > index a170c6369a68..29648e86f7e5 100644 > > --- a/arch/arm64/mm/mmu.c > > +++ b/arch/arm64/mm/mmu.c > > @@ -940,12 +940,12 @@ void *__init __fixmap_remap_fdt(phys_addr_t dt_phys, int *size, pgprot_t prot) > > return dt_virt; > > } > > > > -void *__init fixmap_remap_fdt(phys_addr_t dt_phys) > > +void *__init fixmap_remap_fdt(phys_addr_t dt_phys, pgprot_t prot) > > { > > void *dt_virt; > > int size; > > > > - dt_virt = __fixmap_remap_fdt(dt_phys, &size, PAGE_KERNEL_RO); > > + dt_virt = __fixmap_remap_fdt(dt_phys, &size, prot); > > if (!dt_virt) > > return NULL; > > > > Sorry, I'm still confused why we want to call memblock_reserve() again. > Why not avoid it? > diff --git a/arch/arm64/include/asm/mmu.h b/arch/arm64/include/asm/mmu.h > index 67ef25d037ea..d0d9de9da5c1 100644 > --- a/arch/arm64/include/asm/mmu.h > +++ b/arch/arm64/include/asm/mmu.h > @@ -137,7 +137,7 @@ extern void init_mem_pgprot(void); > extern void create_pgd_mapping(struct mm_struct *mm, phys_addr_t phys, > unsigned long virt, phys_addr_t size, > pgprot_t prot, bool page_mappings_only); > -extern void *fixmap_remap_fdt(phys_addr_t dt_phys); > +extern void *__fixmap_remap_fdt(phys_addr_t dt_phys, int *size, pgprot_t prot); I'd drop '__' prefix from __fixmap_remap_fdt is it's the only function to remain. Otherwise makes perfect sense. > extern void mark_linear_text_alias_ro(void); > > #define INIT_MM_CONTEXT(name) \ > diff --git a/arch/arm64/kernel/kaslr.c b/arch/arm64/kernel/kaslr.c > index b09b6f75f759..0701c2cf1534 100644 > --- a/arch/arm64/kernel/kaslr.c > +++ b/arch/arm64/kernel/kaslr.c > @@ -65,9 +65,6 @@ static __init const u8 *kaslr_get_cmdline(void *fdt) > return default_cmdline; > } > > -extern void *__init __fixmap_remap_fdt(phys_addr_t dt_phys, int *size, > - pgprot_t prot); > - > /* > * This routine will be executed with the kernel mapped at its default virtual > * address, and if it returns successfully, the kernel will be remapped, and > diff --git a/arch/arm64/kernel/setup.c b/arch/arm64/kernel/setup.c > index 413d566405d1..3e97354566ff 100644 > --- a/arch/arm64/kernel/setup.c > +++ b/arch/arm64/kernel/setup.c > @@ -181,9 +181,13 @@ static void __init smp_build_mpidr_hash(void) > > static void __init setup_machine_fdt(phys_addr_t dt_phys) > { > - void *dt_virt = fixmap_remap_fdt(dt_phys); > + int size; > + void *dt_virt = __fixmap_remap_fdt(dt_phys, &size, PAGE_KERNEL); > const char *name; > > + if (dt_virt) > + memblock_reserve(dt_phys, size); > + > if (!dt_virt || !early_init_dt_scan(dt_virt)) { > pr_crit("\n" > "Error: invalid device tree blob at physical address %pa (virtual address 0x%p)\n" > @@ -195,6 +199,9 @@ static void __init setup_machine_fdt(phys_addr_t dt_phys) > cpu_relax(); > } > > + /* Early fixups are done, map the FDT as read-only now */ > + __fixmap_remap_fdt(dt_phys, &size, PAGE_KERNEL_RO); > + > name = of_flat_dt_get_machine_name(); > if (!name) > return; > diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c > index a170c6369a68..ddf6086cd9dd 100644 > --- a/arch/arm64/mm/mmu.c > +++ b/arch/arm64/mm/mmu.c > @@ -940,19 +940,6 @@ void *__init __fixmap_remap_fdt(phys_addr_t dt_phys, int *size, pgprot_t prot) > return dt_virt; > } > > -void *__init fixmap_remap_fdt(phys_addr_t dt_phys) > -{ > - void *dt_virt; > - int size; > - > - dt_virt = __fixmap_remap_fdt(dt_phys, &size, PAGE_KERNEL_RO); > - if (!dt_virt) > - return NULL; > - > - memblock_reserve(dt_phys, size); > - return dt_virt; > -} > - > int __init arch_ioremap_pud_supported(void) > { > /* only 4k granule supports level 1 block mappings */ > -- Sincerely yours, Mike. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel