On 6/21/21 11:15 AM, Philippe Mathieu-Daudé wrote: > On 6/21/21 10:44 AM, Thomas Huth wrote: >> On 17/06/2021 17.48, Philippe Mathieu-Daudé wrote: >> [...] >>> This works, but I'd rather use: >>> >>> if (sev_enabled()) { >>> sev_kernel_loader_calc_cmdline_hash(&sev_loader_context, >>> kernel_cmdline); >>> } >>> >>> And have sev_enabled() defined as: >>> >>> #ifdef CONFIG_SEV >>> bool sev_enabled(void); >>> #else >>> #define sev_enabled() false >>> #endif >>> >>> So the compiler could elide the statement if SEV is disabled, >>> and stub is not necessary. >>> >>> But that means we'd need to add "#include CONFIG_DEVICES" in >>> a sysemu/ header, which looks like an anti-pattern. >>> >>> Thomas / Paolo, what do you think? >> >> I'd only do that if you are very, very sure that the header file is >> only included from target-specific files. Otherwise this will of course >> cause more trouble than benefit.
Back to Paolo, I think the problem is we started to use target-specific features in Kconfig, which was designed for devices (not target-specific). We have the same problem (another thread) with the semihosting architectural feature. > Hmm it could be clearer to rearrange the target-specific sysemu/ > headers. For this example, eventually sysemu/i386/sev.h? > > Phil. >