public inbox for devicetree@vger.kernel.org
 help / color / mirror / Atom feed
From: Conor Dooley <conor.dooley@microchip.com>
To: Alexandre Ghiti <alex@ghiti.fr>
Cc: Mike Rapoport <rppt@kernel.org>, Conor Dooley <conor@kernel.org>,
	<palmer@dabbelt.com>, <linux-riscv@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>, <devicetree@vger.kernel.org>,
	<frowand.list@gmail.com>, <robh+dt@kernel.org>,
	<mick@ics.forth.gr>, <paul.walmsley@sifive.com>,
	<aou@eecs.berkeley.edu>,
	<Valentina.FernandezAlanis@microchip.com>,
	<Daire.McNamara@microchip.com>
Subject: Re: RISC-V reserved memory problems
Date: Mon, 20 Mar 2023 12:11:29 +0000	[thread overview]
Message-ID: <e2203659-e1ac-4fbf-9b5d-2c561255b645@spud> (raw)
In-Reply-To: <de204b7c-7c1d-bd7b-0072-d128757258e2@ghiti.fr>

[-- Attachment #1: Type: text/plain, Size: 2666 bytes --]

On Thu, Mar 09, 2023 at 04:12:57PM +0100, Alexandre Ghiti wrote:
> On 3/9/23 13:51, Conor Dooley wrote:
> > On Thu, Mar 09, 2023 at 01:45:05PM +0100, Alexandre Ghiti wrote:
> > > On 3/7/23 12:35, Mike Rapoport wrote:
> > > > Hi Conor,
> > > > 
> > > > Sorry for the delay, somehow this slipped between the cracks.
> > > > 
> > > > On Thu, Feb 02, 2023 at 10:01:26PM +0000, Conor Dooley wrote:
> > > > > Hullo Palmer, Mike & whoever else may read this,
> > > > > 
> > > > > Just reviving this thread from a little while ago as I have been in the
> > > > > area again recently...
> > > > TBH, I didn't really dig deep into the issues, but the thought I had was
> > > > what if DT was mapped via fixmap until the setup_vm_final() and then it
> > > > would be possible to call DT methods early.
> > > > 
> > > > Could be I'm shooting in the dark :)
> > > 
> > > I think I understand the issue now, it's because In riscv, we establish 2
> > > different virtual mappings and we map the device tree at 2 different virtual
> > > addresses, which is the problem.
> > > 
> > > So to me, the solution is:
> > > 
> > > - to revert your previous fix, that is calling
> > > early_init_fdt_scan_reserved_mem() before any call to memblock_alloc()
> > > (which could result in an allocation in the area you want to reserve)
> > > 
> > > - to map the device tree at the same virtual address, because
> > > early_init_fdt_scan_reserved_mem() initializes reserved_mem with the dtb
> > > mapping established in setup_vm() and uses reserved_mem with the new mapping
> > > from setup_vm_final (which is what Mike proposes, we should use the fixmap
> > > region to have the same virtual addresses)
> > > 
> > > Hope that makes sense: I'll come up with something this afternoon for you to
> > > test!
> > Sounds good. Please give me some ELI5 commit messages if you can,
> > explanations for this stuff (which I found took a lot of archaeology to
> > understand) would be very welcome next time we need to go back looking
> > at this stuff.
> 
> 
> Can you give it a try here:
> https://github.com/AlexGhiti/riscv-linux/commits/dev/alex/conor_dtb_fixmap_v1
> ?
> 
> That works for me but I need to carefully explain and check that's correct
> though, not upstreamable as is.

Hey Alex,

So I ended up being pretty sick & had to take a week off. I gave this an
initial spin today & it appears to work.
I'll take it for a longer test-drive when you send a "real" patch for
it, but I tested both the lookup by name & the situation that was
allocating in reserved memory and both were not an issue.

Thanks for working on this,
Conor.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

  reply	other threads:[~2023-03-20 12:12 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <8e10bf15-9fa9-fe90-1656-35bf3e87e7f8@microchip.com>
2022-08-16 20:41 ` RISC-V reserved memory problems Conor.Dooley
2022-08-18 14:32   ` Heinrich Schuchardt
2022-08-23  9:36     ` Conor.Dooley
2022-11-03 11:46   ` Evgenii Shatokhin
2022-11-03 12:07     ` Conor Dooley
2023-02-02 22:01   ` Conor Dooley
2023-03-07 11:35     ` Mike Rapoport
2023-03-09  9:14       ` Conor Dooley
2023-03-09 12:45       ` Alexandre Ghiti
2023-03-09 12:51         ` Conor Dooley
2023-03-09 15:12           ` Alexandre Ghiti
2023-03-20 12:11             ` Conor Dooley [this message]
2023-03-09 10:30   ` Alexandre Ghiti
2023-03-09 12:31     ` Alexandre Ghiti
2023-03-09 12:32     ` Conor Dooley

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e2203659-e1ac-4fbf-9b5d-2c561255b645@spud \
    --to=conor.dooley@microchip.com \
    --cc=Daire.McNamara@microchip.com \
    --cc=Valentina.FernandezAlanis@microchip.com \
    --cc=alex@ghiti.fr \
    --cc=aou@eecs.berkeley.edu \
    --cc=conor@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=frowand.list@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=mick@ics.forth.gr \
    --cc=palmer@dabbelt.com \
    --cc=paul.walmsley@sifive.com \
    --cc=robh+dt@kernel.org \
    --cc=rppt@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox