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.

 Thomas


Reply via email to