Skip to contentSkip to conversation

ioremap_xxx() with EXEC enabled

DISCUSSION Huang, Ying 4 participants 8 messages Jan 30, 2008

lore
Share & tools
lore
#0 lore raw

Hi,

On i386, EFI may need to map EFI runtime code area as EXEC enabled with ioremap(). But, I found that the memory are mapped as EXEC disabled when mapped with ioremap() now. I think we may need a method to map memory area as EXEC enabled with ioremap_xxx(). Some possible interface schemes for mapping as EXEC enabled are as follow:

- Interface scheme 1:

ioremap_cache_exec()
ioremap_uncache_exec()

- Interface scheme 2:

enum ioremap_mode {
IOR_MODE_UNCACHED,
IOR_MODE_CACHED,
};

enum ioremap_xmode {
IOR_XMODE_UNEXEC,
IOR_XMODE_EXEC,
};

void __iomem *__ioremap(unsigned long phys_addr, unsigned long size,

			enum ioremap_mode mode,
			enum ioremap_xmode xmode);

Which one do you think is better? Or we should use some other interface or method?

Best Regards,
Huang Ying

#1 lore raw
Quoted 7 lines · Ying

Hi,

On i386, EFI may need to map EFI runtime code area as EXEC enabled with ioremap(). But, I found that the memory are mapped as EXEC disabled when mapped with ioremap() now. I think we may need a method to map memory area as EXEC enabled with ioremap_xxx(). Some possible interface schemes for mapping as EXEC enabled are as follow:

Does __ioremap(..., PAGE_KERNEL_EXEC) not work?

-Andi

#2 lore raw
Quoted 10 lines · Andi Kleen
Quoted 7 lines · Ying

Hi,

On i386, EFI may need to map EFI runtime code area as EXEC enabled with ioremap(). But, I found that the memory are mapped as EXEC disabled when mapped with ioremap() now. I think we may need a method to map memory area as EXEC enabled with ioremap_xxx(). Some possible interface schemes for mapping as EXEC enabled are as follow:

Does __ioremap(..., PAGE_KERNEL_EXEC) not work?

The the last parameter of the current implementation of __ioremap() in x86 git is enum ioremap_mode (IOR_MODE_UNCACHED and IOR_MODE_CACHED), not the flags like before. So this does not work.

Best Regards,
Huang Ying

#3 lore raw
Quoted 4 lines

The the last parameter of the current implementation of __ioremap() in x86 git is enum ioremap_mode (IOR_MODE_UNCACHED and IOR_MODE_CACHED), not the flags like before. So this does not work.

Ah you're right sorry. Looks like a design flaw in the recent git-x86 changes.

-Andi

#4 lore raw
In reply to Huang, Ying
Quoted 9 lines · Ying

Hi,

On i386, EFI may need to map EFI runtime code area as EXEC enabled with ioremap(). But, I found that the memory are mapped as EXEC disabled when mapped with ioremap() now. I think we may need a method to map memory area as EXEC enabled with ioremap_xxx(). Some possible interface schemes for mapping as EXEC enabled are as follow:

- Interface scheme 1:

scheme 3:

set_memory_x(... )

#5 lore raw
Quoted 11 lines · Arjan van de Ven
Quoted 8 lines · Ying

Hi,

On i386, EFI may need to map EFI runtime code area as EXEC enabled with ioremap(). But, I found that the memory are mapped as EXEC disabled when mapped with ioremap() now. I think we may need a method to map memory area as EXEC enabled with ioremap_xxx(). Some possible interface schemes for mapping as EXEC enabled are as follow:

Quoted 5 lines
Quoted 1 line

- Interface scheme 1:

scheme 3:

set_memory_x(... )

On i386 EFI is unlikely to be in the direct mapping ...

-Andi

#6 lore raw
Quoted 13 lines · On Wed, 30 Jan 2008 18:30:48 +0100 Andi Kleen <[email protected]> wrote:
Quoted 12 lines · Arjan van de Ven
Quoted 9 lines · Ying

Hi,

On i386, EFI may need to map EFI runtime code area as EXEC enabled with ioremap(). But, I found that the memory are mapped as EXEC disabled when mapped with ioremap() now. I think we may need a method to map memory area as EXEC enabled with ioremap_xxx(). Some possible interface schemes for mapping as EXEC enabled are as follow:

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

- Interface scheme 1:

scheme 3:

set_memory_x(... )

On i386 EFI is unlikely to be in the direct mapping ...

1) 32 bit EFI is totally irrelevant.
2) set_memory_ and set_pages_ API is not restricted to direct mapping. That's why they take a virtual address / struct page

Quoted 3 lines

-Andi

Signature · 3 lines
If you want to reach me at my work email, use [email protected]
For development, discussion and tips for power savings, 
visit http://www.lesswatts.org
#7 lore raw
Quoted 2 lines

1) 32 bit EFI is totally irrelevant.

Apparently not to the original poster. And some Apple x86 users might also disagree.

On x86-64 BTW while they could still rely on end_pfn_mapped and it being direct mapped Venki's PAT patchkit removes that so ioremap would be needed there too

Quoted 2 lines

2) set_memory_ and set_pages_ API is not restricted to direct mapping. That's why they take a virtual address / struct page

If there is no direct mapping what page tables should they change? Surely you're not suggesting they should walk all vmalloc areas and switch them over. I don't think this is correct.

-Andi