Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp230325yba; Mon, 20 May 2019 07:48:17 -0700 (PDT) X-Google-Smtp-Source: APXvYqxfxo+DeAkJPplFuFkgTqWrLvz9DqlutjpIczf0nfMW/YJIoKm8tsPYlVxfjKHbV8BXxmES X-Received: by 2002:a62:b40a:: with SMTP id h10mr73478523pfn.216.1558363697097; Mon, 20 May 2019 07:48:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558363697; cv=none; d=google.com; s=arc-20160816; b=0h2//hHCzYt7ZxPDWiEtoLbKpBtzGj7CmAX4SJ2XMt9ILrs59Iy9dyWqnubjShX3s1 C85hZnu06L7RxBci7+YUT4aK/CozPLTfdMJ8YDZR8PWLBPm+BVKvFyh543hw9QJUc90x k4FtmLRiKrlzAdAdsbiJhtB1R73Fp2pFLFQKy+WqNNAvqCTbw4XdoDw4LoDBQhPVk1jt QgBILSAFbKzFbsUd/tsjQv2Xeo15j1EnaqexB/LTUoUSg3JolOgcJWhxtPdhlryeosS3 9v/iqFyBq8Qsh0FR++bCkc2Dgv7Lu4aAKT4wdL7t9tev+bZDqYrzaFD40U/P2UHfkPz0 OrFQ== 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:dkim-signature; bh=IAsS+ge4xF9NsjigSlUWvtRwDOMNtAXXWGXbe9rZsXc=; b=xysh31w2WlVbb8y1mPWvV/EusSmfhz/CGe6Vj5GjjuWCiVD933pSOoP9SL7CNalGhS lJuSowK6fUmoW0T6S2LvQBm2Zzyn66Zn2SojTP9r2EL2VJ6FhxwOTgrK9CYqe+WsKKLT jVFr9e4ol3a3GMudly2lz3XOVXvCv36huseE/L0buReGBav+SGz3EEcaBIxTtFKmTYdE jl/2d5rnybk2ex0hAnn1eN9XEGp68IQlRTO9YJidBUcTrPaIA9WyZHfiPKIPrUaWWMAE mEDH3GgPLjznYE9EL/uU1FSoW2iXqveWiFqSF2p6CXGfrhscLdSiPCEzLR2+cJW2OM97 ll4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=brO4dH1o; 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 i3si3845723pgq.440.2019.05.20.07.48.02; Mon, 20 May 2019 07:48:17 -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=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=brO4dH1o; 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 S1731668AbfETLn4 (ORCPT + 99 others); Mon, 20 May 2019 07:43:56 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:49544 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729598AbfETLn4 (ORCPT ); Mon, 20 May 2019 07:43:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=IAsS+ge4xF9NsjigSlUWvtRwDOMNtAXXWGXbe9rZsXc=; b=brO4dH1ooQLImPEWeoy1PZsO4 kLUKz7vtSS/uhxkQkqAUkooG9gOhdBFTIQNobLOTyLSUOBpiFGG5+uTMBCpmclIVKwJg+4fMX8QtG yRfWM7zqqsrstCEJra0tLrEjLSzMiV4PGvajeoXrS0nmAchtZKRP28OX2CZF5MPc2ysrM+B4vL7Zx q4E/KMXmOQw1IWtVfuoADZ1kRhVxIiFpx/jjdtzUX8r65dgY4ILut+JYFmP2j0HD8xkFj0YfvOUeQ J9hT4VLzlAKHTRcoRf5zSLwRrmzddoTwqFpmum5RxwANo2LTSFi6ZcdSZAHVTgKgdZYw2HsAp3uAs 4AvNtBx4g==; Received: from hch by bombadil.infradead.org with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1hSght-000776-05; Mon, 20 May 2019 11:43:53 +0000 Date: Mon, 20 May 2019 04:43:52 -0700 From: Christoph Hellwig To: Anup Patel Cc: Palmer Dabbelt , Albert Ou , "linux-kernel@vger.kernel.org" , Mike Rapoport , Christoph Hellwig , Atish Patra , Paul Walmsley , "linux-riscv@lists.infradead.org" Subject: Re: [PATCH v4 2/2] RISC-V: Setup initial page tables in two stages Message-ID: <20190520114352.GA5372@infradead.org> References: <20190502050206.23373-1-anup.patel@wdc.com> <20190502050206.23373-3-anup.patel@wdc.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190502050206.23373-3-anup.patel@wdc.com> User-Agent: Mutt/1.9.2 (2017-12-15) X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > void __init parse_dtb(unsigned int hartid, void *dtb) > { > - if (early_init_dt_scan(__va(dtb))) > + dtb = (void *)fix_to_virt(FIX_FDT) + ((uintptr_t)dtb & ~PAGE_MASK); > + if (early_init_dt_scan(dtb)) FYI, parse_dtb in mainline now lost the hartid argument and takes a phys_addr_t for the dtb address. That being said I find the above way to magic. So we take the fixmap address and then only the offset from something passed as a pointer? This just looks very weird. The way FIX_FDT is defined to add to my confusion, which might partially be due to not understanding fixmaps very well. But it seems like at very least we should set up an actual kernel pointer for the dtb in setup_vm based on what that gets passed and stop passing any arguments to parse_dtb to keep that magic in one place. And possibly add some comment. > +#if MAX_EARLY_MAPPING_SIZE < PGDIR_SIZE It seems MAX_EARLY_MAPPING_SIZE is defined to a fix constant, why do we need these conditionals?