Re: [PATCH] firmware: google: coreboot_table: skip no-map CBMEM entries
From: Hsin-Te Yuan
Date: Fri Jul 17 2026 - 03:25:55 EST
On Thu, Jul 16, 2026 at 3:44 PM Tzung-Bi Shih <tzungbi@xxxxxxxxxx> 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.
> > + * 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.