[PATCH] x86/boot: Fix edd=off to skip mbr

Jason Andryuk posted 1 patch 2 weeks, 2 days ago
Patches applied successfully (tree, apply log)
git fetch https://gitlab.com/xen-project/patchew/xen tags/patchew/20251013211139.8750-1-jason.andryuk@amd.com
xen/arch/x86/boot/edd.S | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
[PATCH] x86/boot: Fix edd=off to skip mbr
Posted by Jason Andryuk 2 weeks, 2 days ago
When the fixes commit re-arranged the code, it made edd=off jump to the
mbr code instead of returning from the function.  Previously edd_done
was immediately before ret and skipped the MBR check.

Replace edd_done with .Ledd_mbr_sig for the start of the MBR checking,
and replace .Ledd_mbr_sig_skip with .Ledd_done to exit from the function.

edd=off jumps to .Ledd_done to return from the function, and internal
jumps go to .Ledd_mbr_sig to check edd=skipmbr.

Fixes: 5ec164fd61bd ("x86/boot: re-arrange how/when we do disk I/O")
Signed-off-by: Jason Andryuk <jason.andryuk@amd.com>
---
 xen/arch/x86/boot/edd.S | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/xen/arch/x86/boot/edd.S b/xen/arch/x86/boot/edd.S
index 3df712bce1..02437511b2 100644
--- a/xen/arch/x86/boot/edd.S
+++ b/xen/arch/x86/boot/edd.S
@@ -25,7 +25,7 @@
 
 get_edd:
         cmpb    $2, bootsym(opt_edd)            # edd=off ?
-        je      edd_done
+        je      .Ledd_done
 
 # Do the BIOS Enhanced Disk Drive calls
 # This consists of two calls:
@@ -48,7 +48,7 @@ edd_check_ext:
         movb    $0x41, %ah                      # 0x41 Check Extensions Present
         movw    $0x55AA, %bx                    # magic
         int     $0x13                           # make the call
-        jc      edd_done                        # no more BIOS devices
+        jc      .Ledd_mbr_sig                   # no more BIOS devices
 
         cmpw    $0xAA55, %bx                    # is magic right?
         jne     edd_next                        # nope, next...
@@ -96,13 +96,13 @@ edd_legacy_done:
 
 edd_next:
         incb    %dl                             # increment to next device
-        jz      edd_done
+        jz      .Ledd_mbr_sig
         cmpb    $EDD_INFO_MAX,bootsym(boot_edd_info_nr)
         jb      edd_check_ext
 
-edd_done:
+.Ledd_mbr_sig:
         cmpb    $1, bootsym(opt_edd)            # edd=skipmbr ?
-        je      .Ledd_mbr_sig_skip
+        je      .Ledd_done
 
 # Read the first sector of each BIOS disk device and store the 4-byte signature
 .Ledd_mbr_sig_start:
@@ -160,7 +160,7 @@ edd_done:
         jb      .Ledd_mbr_sig_read
 .Ledd_mbr_sig_done:
         popw    %es
-.Ledd_mbr_sig_skip:
+.Ledd_done:
         ret
 
 GLOBAL(boot_edd_info_nr)
-- 
2.51.0
Re: [PATCH] x86/boot: Fix edd=off to skip mbr
Posted by Oleksii Kurochko 2 weeks, 1 day ago
On 10/13/25 11:11 PM, Jason Andryuk wrote:
> When the fixes commit re-arranged the code, it made edd=off jump to the
> mbr code instead of returning from the function.  Previously edd_done
> was immediately before ret and skipped the MBR check.
>
> Replace edd_done with .Ledd_mbr_sig for the start of the MBR checking,
> and replace .Ledd_mbr_sig_skip with .Ledd_done to exit from the function.
>
> edd=off jumps to .Ledd_done to return from the function, and internal
> jumps go to .Ledd_mbr_sig to check edd=skipmbr.
>
> Fixes: 5ec164fd61bd ("x86/boot: re-arrange how/when we do disk I/O")
> Signed-off-by: Jason Andryuk<jason.andryuk@amd.com>

Release-Acked-By: Oleksii Kurochko<oleksii.kurochko@gmail.com>

Thanks.

~ Oleksii

> ---
>   xen/arch/x86/boot/edd.S | 12 ++++++------
>   1 file changed, 6 insertions(+), 6 deletions(-)
>
> diff --git a/xen/arch/x86/boot/edd.S b/xen/arch/x86/boot/edd.S
> index 3df712bce1..02437511b2 100644
> --- a/xen/arch/x86/boot/edd.S
> +++ b/xen/arch/x86/boot/edd.S
> @@ -25,7 +25,7 @@
>   
>   get_edd:
>           cmpb    $2, bootsym(opt_edd)            # edd=off ?
> -        je      edd_done
> +        je      .Ledd_done
>   
>   # Do the BIOS Enhanced Disk Drive calls
>   # This consists of two calls:
> @@ -48,7 +48,7 @@ edd_check_ext:
>           movb    $0x41, %ah                      # 0x41 Check Extensions Present
>           movw    $0x55AA, %bx                    # magic
>           int     $0x13                           # make the call
> -        jc      edd_done                        # no more BIOS devices
> +        jc      .Ledd_mbr_sig                   # no more BIOS devices
>   
>           cmpw    $0xAA55, %bx                    # is magic right?
>           jne     edd_next                        # nope, next...
> @@ -96,13 +96,13 @@ edd_legacy_done:
>   
>   edd_next:
>           incb    %dl                             # increment to next device
> -        jz      edd_done
> +        jz      .Ledd_mbr_sig
>           cmpb    $EDD_INFO_MAX,bootsym(boot_edd_info_nr)
>           jb      edd_check_ext
>   
> -edd_done:
> +.Ledd_mbr_sig:
>           cmpb    $1, bootsym(opt_edd)            # edd=skipmbr ?
> -        je      .Ledd_mbr_sig_skip
> +        je      .Ledd_done
>   
>   # Read the first sector of each BIOS disk device and store the 4-byte signature
>   .Ledd_mbr_sig_start:
> @@ -160,7 +160,7 @@ edd_done:
>           jb      .Ledd_mbr_sig_read
>   .Ledd_mbr_sig_done:
>           popw    %es
> -.Ledd_mbr_sig_skip:
> +.Ledd_done:
>           ret
>   
>   GLOBAL(boot_edd_info_nr)
Re: [PATCH] x86/boot: Fix edd=off to skip mbr
Posted by Jan Beulich 2 weeks, 1 day ago
On 13.10.2025 23:11, Jason Andryuk wrote:
> When the fixes commit re-arranged the code, it made edd=off jump to the
> mbr code instead of returning from the function.  Previously edd_done
> was immediately before ret and skipped the MBR check.

Hmm, bad me.

> Replace edd_done with .Ledd_mbr_sig for the start of the MBR checking,
> and replace .Ledd_mbr_sig_skip with .Ledd_done to exit from the function.
> 
> edd=off jumps to .Ledd_done to return from the function, and internal
> jumps go to .Ledd_mbr_sig to check edd=skipmbr.
> 
> Fixes: 5ec164fd61bd ("x86/boot: re-arrange how/when we do disk I/O")
> Signed-off-by: Jason Andryuk <jason.andryuk@amd.com>

Reviewed-by: Jan Beulich <jbeulich@suse.com>