Re: [PATCH 2/3] qemu-x86: Wire support for applying capsule updates to pflash

Elliot Berman <[email protected]> Mon, 3 Aug 2026 17:27:00 -0700
Newsgroups gmane.comp.boot-loaders.u-boot
Message-ID <[email protected]>
Hi Tom,

On Thu, Jul 30, 2026 at 04:12:08PM -0600, Tom Rini wrote:
> On Thu, Jul 30, 2026 at 12:37:46PM -0700, Elliot Berman wrote:
> 
> > Following the flow used for qemu-arm64, probe the pflash MTD device
> > and set dfu_alt_info/mtdparts for qemu-x86 and qemu-x86_64 so EFI
> > capsule updates can target the u-boot pflash partition.
> > 
> > Signed-off-by: Elliot Berman <[email protected]>
> [snip]
> > diff --git a/board/emulation/common/qemu_dfu.c b/board/emulation/common/qemu_dfu.c
> > index 8a59f5ade13..db7d8cbbb4e 100644
> > --- a/board/emulation/common/qemu_dfu.c
> > +++ b/board/emulation/common/qemu_dfu.c
> > @@ -51,11 +51,13 @@ void set_dfu_alt_info(char *interface, char *devstr)
> >  	memset(buf, 0, DFU_ALT_BUF_LEN);
> >  
> >  	/*
> > -	 * Currently dfu_alt_info is needed on Qemu ARM64 for
> > +	 * Currently dfu_alt_info is needed on Qemu ARM64/X86/X86_64 for
> >  	 * capsule updates
> 
> Here and later, we should stop enumerating the platforms because it'll
> just get expanded when say RISC-V is added by someone else down the
> line and just "on QEMU for capsule updates" is clear enough I think.
> 
> >  	*/
> >  	if (IS_ENABLED(CONFIG_EFI_CAPSULE_FIRMWARE_MANAGEMENT) &&
> > -	    IS_ENABLED(CONFIG_TARGET_QEMU_ARM_64BIT)) {
> > +	    (IS_ENABLED(CONFIG_TARGET_QEMU_ARM_64BIT) ||
> > +	     IS_ENABLED(CONFIG_TARGET_QEMU_X86) ||
> > +	     IS_ENABLED(CONFIG_TARGET_QEMU_X86_64))) {
> 
> Can we reasonably be CONFIG_EFI_CAPSULE_FIRMWARE_MANAGEMENT=y on a
> platform that *can't* support it? Again thinking to when someone
> supports this for say RISC-V it would I think make sense for it to then
> show up as "Oh, I forgot to map the MTD device in" as a run-time thing,
> rather than "Oh, I need to update a big conditional". And this too is a
> "here and later" question. Thanks!
> 

Yes, I can drop the target conditionals. I could also drop the
EFI_* config checks in this function as well. On QEMU, DFU can only
happen when those EFI_* configs options are enabled, so I believe it's a
little redundant. Does this make sense, too?

Thanks,
Elliot