Re: [PATCH v2 02/24] EDAC, ghes: Fix grain calculation

From: Robert Richter
Date: Mon Aug 12 2019 - 08:06:26 EST


On 12.08.19 09:32:22, Borislav Petkov wrote:
> On Mon, Aug 12, 2019 at 06:42:00AM +0000, Robert Richter wrote:

> > With the grain_bits calculation the mask is rounded up to the next
> > power of 2 value.
>
> mask = 0xffffffffff00ff00

grain = ~mask + 1

> ~mask = 0x0000000000ff00ff
> ~mask + 1 = 0x0000000000ff0100

grain_bits = fls_long(e->grain - 1);
grain_bits = 24

grain = 1 << grain_bits
grain = 0x1000000

So for masks in the range from 0xffffffffff000000 to
0xffffffffff7fffff we have grain_bits set to 24, which corresponds to
a grain of 0x1000000. Looks good to me.

>
> Your "trick" of adding a 1 to get to the most significant bit simply
> doesn't work here. Thus:
>
> "I guess we can leave it like that for now until some "inventive"
> firmware actually does it."

Fine to me.

-Robert