Re: [PATCH v5 1/3] x86/sev: Add new dump_rmp parameter to snp_leak_pages() API
From: Kalra, Ashish
Date: Tue Sep 16 2025 - 11:42:00 EST
On 9/16/2025 8:12 AM, 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.
>
> When your patch touches code behind different CONFIG_ items, you must make
> sure it builds with both settings of each CONFIG_ item.
>
I have done the builds with both CONFIG_KVM_AMD_SEV and !CONFIG_KVM_AMD_SEV and the builds are done
without any errors.
And i don't understand how can snp_leak_pages() have this redefinition, as one of them is under
#ifdef CONFIG_KVM_AMD_SEV and the other one is the #else part of it.
Thanks,
Ashish
> 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
>