Re: [PATCH] powerpc/8xx: Fix clearing of bits 20-23 in ITLB miss
From: Leonardo Bras <hidden>
Date: 2020-02-20 21:53:30
Also in:
lkml
Attachments
- signature.asc [application/pgp-signature] 833 bytes
From: Leonardo Bras <hidden>
Date: 2020-02-20 21:53:30
Also in:
lkml
On Tue, 2020-02-11 at 01:28 -0300, Leonardo Bras wrote:
Looks a valid change. rlwimi r10, r10, 0, 0x0f00 means: r10 = ((r10 << 0) & 0x0f00) | (r10 & ~0x0f00) which ends up being r10 = r10 On ISA, rlwinm is recommended for clearing high order bits. rlwinm r10, r10, 0, ~0x0f00 means: r10 = (r10 << 0) & ~0x0f00 Which does exactly what the comments suggests. FWIW: Reviwed-by: Leonardo Bras [off-list ref]
Sorry, I just realized the above was not very clear on my part. What I meant to say was: I think your change is correct, as it correctly fixes this line. I would suggest adding the text bellow to your commit message, making it easier to understand why rlwimi is not the right instruction clear bytes 20-23, and why rlwinm is. The current instruction can be translated to C as: rlwimi r10, r10, 0, 0x0f00 r10 = ((r10 << 0) & 0x0f00) | (r10 & ~0x0f00) -> r10 = (r10 & 0x0f00) | (r10 & ~0x0f00) -> r10 = r10 The new proposed instruction can be translated to C as: rlwinm r10, r10, 0, ~0x0f00 -> r10 = (r10 << 0) & ~0x0f00 Which clears bits 20-23 as comment on code states. Best regards, Leonardo Bras