On 02/11/2024 5:25 pm, Daniel P. Smith wrote:
> This commit introduces module types for the types of boot modules that may be
> passed to Xen. These include xen, kernel, ramdisk, microcode, and xsm policy.
> This reduces the need for hard coded order assumptions and global variables to
> be used by consumers of boot modules, such as domain construction.
>
> Signed-off-by: Daniel P. Smith <dpsm...@apertussolutions.com>

Reviewed-by: Andrew Cooper <andrew.coop...@citrix.com>, albeit it with
one extra suggestion.

> ---
> Changes since v7:
> - merged the addition of microcode and xsm boot mod types
>
> Changes since v5:
> - added guard around initrd type assignment
> - removed a missed rebase artifact
> ---
>  xen/arch/x86/cpu/microcode/core.c   |  1 +
>  xen/arch/x86/include/asm/bootinfo.h | 12 ++++++++++++
>  xen/arch/x86/setup.c                |  4 ++++
>  xen/xsm/xsm_policy.c                |  1 +
>  4 files changed, 18 insertions(+)
>
> diff --git a/xen/arch/x86/cpu/microcode/core.c 
> b/xen/arch/x86/cpu/microcode/core.c
> index 1fa6cbf3d364..f46464241557 100644
> --- a/xen/arch/x86/cpu/microcode/core.c
> +++ b/xen/arch/x86/cpu/microcode/core.c

@@ -831,6 +831,10 @@ static int __init early_microcode_load(struct
boot_info *bi)
                 continue;
             }
 
+            /*
+             * Do not alter this boot module's type.  We're most likely
+             * peeking at dom0's initrd.
+             */
             data = cd.data;
             size = cd.size;
             goto found;


To make it absolutely crystal clear that ...


> @@ -845,6 +845,7 @@ static int __init early_microcode_load(struct boot_info 
> *bi)
>              printk(XENLOG_WARNING "Microcode: Chosen module %d already 
> used\n", idx);
>              return -ENODEV;
>          }
> +        bi->mods[idx].type = BOOTMOD_MICROCODE;

... this is deliberately not done on the scan path.

~Andrew

Reply via email to