Re: [PATCH v5 1/3] x86/sev: Add new dump_rmp parameter to snp_leak_pages() API

From: Tom Lendacky
Date: Tue Sep 16 2025 - 09:59:08 EST


On 9/16/25 08:12, Borislav Petkov wrote:
> On Mon, Sep 15, 2025 at 09:21:58PM +0000, Ashish Kalra wrote:
>> @@ -668,6 +673,7 @@ static inline int rmp_make_private(u64 pfn, u64 gpa, enum pg_level level, u32 as
>> return -ENODEV;
>> }
>> static inline int rmp_make_shared(u64 pfn, enum pg_level level) { return -ENODEV; }
>> +static inline void __snp_leak_pages(u64 pfn, unsigned int npages, bool dump_rmp) {}
>> static inline void snp_leak_pages(u64 pfn, unsigned int npages) {}
>
> I basically don't even have to build your patch to see that this can't build.
> See below.

Did the patch merge correctly? I can't see how it would fail since both
the original and new definitions are in separate parts of the #ifdef... It
should have failed even before given the way it was changed.

Maybe I'm missing something.

Thanks,
Tom

>
> When your patch touches code behind different CONFIG_ items, you must make
> sure it builds with both settings of each CONFIG_ item.
>
> In file included from arch/x86/boot/startup/gdt_idt.c:9:
> ./arch/x86/include/asm/sev.h:679:20: error: redefinition of ‘snp_leak_pages’
> 679 | static inline void snp_leak_pages(u64 pfn, unsigned int pages)
> | ^~~~~~~~~~~~~~
> ./arch/x86/include/asm/sev.h:673:20: note: previous definition of ‘snp_leak_pages’ with type ‘void(u64, unsigned int)’ {aka ‘void(long long unsigned int, unsigned int)’}
> 673 | static inline void snp_leak_pages(u64 pfn, unsigned int npages) {}
> | ^~~~~~~~~~~~~~
> make[4]: *** [scripts/Makefile.build:287: arch/x86/boot/startup/gdt_idt.o] Error 1
> make[3]: *** [scripts/Makefile.build:556: arch/x86/boot/startup] Error 2
> make[2]: *** [scripts/Makefile.build:556: arch/x86] Error 2
> make[2]: *** Waiting for unfinished jobs....
> In file included from drivers/iommu/amd/init.c:32:
> ./arch/x86/include/asm/sev.h:679:20: error: redefinition of ‘snp_leak_pages’
> 679 | static inline void snp_leak_pages(u64 pfn, unsigned int pages)
> | ^~~~~~~~~~~~~~
> ./arch/x86/include/asm/sev.h:673:20: note: previous definition of ‘snp_leak_pages’ with type ‘void(u64, unsigned int)’ {aka ‘void(long long unsigned int, unsigned int)’}
> 673 | static inline void snp_leak_pages(u64 pfn, unsigned int npages) {}
> | ^~~~~~~~~~~~~~
> make[5]: *** [scripts/Makefile.build:287: drivers/iommu/amd/init.o] Error 1
> make[4]: *** [scripts/Makefile.build:556: drivers/iommu/amd] Error 2
> make[4]: *** Waiting for unfinished jobs....
> make[3]: *** [scripts/Makefile.build:556: drivers/iommu] Error 2
> make[3]: *** Waiting for unfinished jobs....
> make[2]: *** [scripts/Makefile.build:556: drivers] Error 2
> make[1]: *** [/mnt/kernel/kernel/linux/Makefile:2011: .] Error 2
> make: *** [Makefile:248: __sub-make] Error 2
>