grub-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v4] efidisk: pass buffers with higher alignment


From: Daniel Kiper
Subject: Re: [PATCH v4] efidisk: pass buffers with higher alignment
Date: Mon, 6 Jun 2022 21:08:59 +0200
User-agent: NeoMutt/20170113 (1.7.2)

On Tue, May 31, 2022 at 06:10:42PM +0200, Heinrich Schuchardt wrote:
> On 5/31/22 17:53, Stefan Agner wrote:
> > Some devices report IoAlign values but seem to require buffers with
> > higher alignment.
> >
> > The UEFI specification is saying: "IoAlign values of 0 and 1 mean that
> > the buffer can be placed anywhere in memory. Otherwise, IoAlign must
> > be a power of 2, and the requirement is that the start address of a
> > buffer must be evenly divisible by IoAlign with no remainder."
> >
> > Some devices report IoAlign of 2, however seem to require 4 bytes
> > aligned buffers. It seems that this got misinterpreted by some vendors
> > assuming IoAlign is 2^IoAlign. There is also such a hint in an example
> > in earlier versions of the Driver Writer's Guide:
> > ScsiPassThruMode.IoAlign = 2; // Data must be alligned on 4-byte boundary
> >
> > Some devices report no alignment requirements at all but seem to read
> > corrupted data or report read errors when passing unaligned buffers.
> >
> > Work around by using an alignment of at least BlockSize (typically 512
> > bytes) in any case. If IoAlign (interpreted as per UEFI specification)
> > requests a higher alignment than BlockSize, follow IoAlign still.
> >
> > Note: The problem has only noticed with compressed squashfs. It seems
> > that ext4 (and presumably other file system drivers) pass buffers with
> > a higher alignment already.
> >
> > Signed-off-by: Stefan Agner <stefan@agner.ch>
>
> Acked-by: Heinrich Schuchardt <heinrich.schuchardt@canaonical.com>

Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>

Daniel



reply via email to

[Prev in Thread] Current Thread [Next in Thread]