Re: [PATCH Part1 RFC v4 24/36] x86/compressed/acpi: move EFI config table access to common code

Borislav Petkov
2021-08-19T17:09:11Z

On Thu, Aug 19, 2021 at 09:58:31AM -0500, Michael Roth wrote:
> Not sure what you mean here. All the interfaces introduced here are used
> by acpi.c. There is another helper added later (efi_bp_find_vendor_table())
> in "enable SEV-SNP-validated CPUID in #VC handler", since it's not used
> here by acpi.c.

Maybe I got confused by the amount of changes in a single patch. I'll
try harder with your v5. :)

> There is the aforementioned efi_bp_find_vendor_table() that does the
> simple iteration, but I wasn't sure how to build the "find one of these,
> but this one is preferred" logic into it in a reasonable way.

Instead of efi_foreach_conf_entry() you simply do a bog-down simple
loop and each time you stop at a table, you examine it and overwrite
pointers, if you've found something better.

With "overwrite pointers" I mean you cache the pointers to those conf
tables you iterate over and dig out so that you don't have to do it a
second time. That is, *if* you need them a second time. I believe you
call at least efi_bp_get_conf_table() twice... you get the idea.

> I could just call it once for each of these GUIDs though. I was
> hesitant to do so since it's less efficient than existing code, but if
> it's worth it for the simplification then I'm all for it.

Yeah, this is executed once during boot so I don't think you can make it
more efficient than a single iteration over the config table blobs.

I hope that makes more sense.

--
Regards/Gruss,
Boris.