Re: [PATCH] hpwdt: clean up set_memory_x call for 32 bit
From: Wim Van Sebroeck <hidden>
Date: 2012-01-24 20:37:43
Also in:
lkml
Hi Linus,
So I don't know who is supposed to be handling this (Wim?), but the patch itself looks suspicious.
I asked Tom to look at Maxim's patch and see what it does. Tom was going to look at the patch and I'm waiting on feedback from him first. (That's why I din't sent it upstream yet).
On Sun, Jan 15, 2012 at 8:02 PM, Maxim Uvarov [off-list ref] wrote:quoted
- � � � set_memory_x((unsigned long)bios32_entrypoint, (2 * PAGE_SIZE)); + � � � set_memory_x((unsigned long)bios32_entrypoint & PAGE_MASK, 2);If it wasn't page-aligned to begin with, then maybe it needs three pages now?quoted
- � � � � � � � � � � � � � � � set_memory_x((unsigned long)cru_rom_addr, cru_length); + � � � � � � � � � � � � � � � set_memory_x((unsigned long)cru_rom_addr & PAGE_MASK, cru_length >> PAGE_SHIFT);Same here. If we align the start address down, we should fix up the length. And should we not align the number of pages up? In general, a "start/length" conversion to a "page/nr" model needs to be roughly len += start & ~PAGE_MASK; start &= PAGE_MASK; nr_pages = (len + PAGE_SIZE - 1) >> PAGE_SHIFT; to do things right. But I don't know where those magic numbers come from. Maybe the "2" is already due to the code possibly traversing a page boundary, and has already been fixed up. Somebody who knows the driver and the requirements should take a look at this.
Valid comments indeed. Tom please take Linus comments with you when you look at the patch. Dan: I put you in Cc: also so that you can have a look at it also. Kind regards, Wim.