Re: [PATCH] firmware: google: coreboot_table: skip no-map CBMEM entries

Tzung-Bi Shih <[email protected]> Fri, 17 Jul 2026 07:59:51 +0000
Newsgroups dev.linux.lists.chrome-platform,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
On Fri, Jul 17, 2026 at 03:23:30PM +0800, Hsin-Te Yuan wrote:
> On Thu, Jul 16, 2026 at 3:44 PM Tzung-Bi Shih <[email protected]> wrote:
> >
> > On Tue, Jul 14, 2026 at 09:19:18AM +0000, Hsin-Te Yuan wrote:
> > > @@ -147,6 +149,23 @@ static int coreboot_table_populate(struct device *dev, void *ptr, resource_size_
> > >
> > >               switch (device->entry.tag) {
> > >               case LB_TAG_CBMEM_ENTRY:
> > > +                     /*
> > > +                      * Skip entries that are not exclusively System RAM or
> > > +                      * Reserved memory.
> > > +                      * On ARM, no-map reserved regions are not System RAM.

To be specific,

   On ARM, no-map reserved regions are IORESOURCE_MEM.

> > > +                      * On x86, CBMEM often resides in IORES_DESC_RESERVED regions.
> > > +                      */
> > > +                     if (region_intersects(device->cbmem_entry.address,
> > > +                                           device->cbmem_entry.entry_size,
> > > +                                           IORESOURCE_SYSTEM_RAM,
> > > +                                           IORES_DESC_NONE) != REGION_INTERSECTS &&
> > > +                         region_intersects(device->cbmem_entry.address,
> > > +                                           device->cbmem_entry.entry_size,
> > > +                                           IORESOURCE_MEM,
> > > +                                           IORES_DESC_RESERVED) != REGION_INTERSECTS) {
> >
> > Per comments of region_intersects():
> >     Note that REGION_INTERSECTS is also returned in the case when the
> >     specified region overlaps RAM and undefined memory holes.
> >
> > Won't the check falsely be bypassed if the region overlaps SYSTEM_RAM
> > and `no-map` memory?
> 
> Just discussed this with Yidi Lin.
> It seems that 'no-map' region will be marked as IORESOURCE_MEM instead
> of undefined memory holes
> (See arch/arm64/kernel/setup.c:request_standard_resources). If a cbmem
> entry contains a real memory
> hole, it is likely a coreboot bug.

I see.

Please rephrase the commit message and code comment to be clear.  E.g.:
1. On ARM64, no-map regions are filtered out as they are IORESOURCE_MEM
   (See arch/arm64/kernel/setup.c:request_standard_resources).
2. On X86, standard reserved regions (IORES_DESC_RESERVED) ...

3. Mixed regions containing holes are safely skipped.
Remove it as this is inaccurate (the patch can't skip holes).