question about RMP table fixups for kexec

From: Dave Young
Date: Sat Sep 14 2024 - 07:08:54 EST


Hi Ashish,

I'm reading the code about E820 tables related code, I noticed with
below commit you updated all three e820 tabes including
e820_table_kexec and e820_table_firmware.
commit 400fea4b9651adf5d7ebd5d71e905f34f4e4e493
Author: Ashish Kalra <ashish.kalra@xxxxxxx>
Date: Fri Apr 26 00:43:18 2024 +0000

x86/sev: Add callback to apply RMP table fixups for kexec

...

+ if (e820__mapped_any(pa, pa + PMD_SIZE, E820_TYPE_RAM)) {
+ pr_info("Reserving start/end of RMP table on a 2MB
boundary [0x%016llx]\n", pa);
+ e820__range_update(pa, PMD_SIZE, E820_TYPE_RAM,
E820_TYPE_RESERVED);
+ e820__range_update_table(e820_table_kexec, pa,
PMD_SIZE, E820_TYPE_RAM, E820_TYPE_RESERVED);
+ e820__range_update_table(e820_table_firmware, pa,
PMD_SIZE, E820_TYPE_RAM, E820_TYPE_RESERVED);
+ }
+}

A question here is, have you tried only updating e820_table and
e820_table_firmware?

I do not know much about SEV, if you update e820_table, then the
memory range will be reserved in resouces, and kexec will not load
segments into the reserved ranges, during the 2nd kernel bootup your
code will be run again so I assume it is not necessary to pre-reserve
in e820_table_kexec and passing to 2nd kernel.

Could you confirm this question?

Thanks
Dave