What is the difference between these two functions: `ioremap_uc()` and `set_memory_uc`?
Asked Answered
C

1

6

When I want to mark memory region as Write Combined (to disable cacheable and use BIU) or Uncacheable through set PAT(Page attribute table - 7bit in PTE), then what do I must to use, and what is the difference between two these functions?

Taken from: http://lwn.net/Articles/278994/

Why can't I use the same single function both for PCI BARs and RAM ranges?

Clarification: Does ioremap_uc() get physical address and return virtual address with setting Uncacheable, versus set_memory_uc() which get already virtual address and set Uncacheable for these pages?

Are these codes equal?

void* virt_ptr = ioremap_uc(phys_ptr, size);

and

void* virt_ptr = ioremap(phys_ptr, size);
const int page_size = 4096;
set_memory_uc(virt_ptr, size/page_size);
Cedell answered 6/11, 2013 at 11:43 Comment(1)
Did you find anything further or get an answer to this elsewhere?Herron
J
0

Notes from the lwm article:

-- in the above table mean "Not suggested usage for the API". Some of the --'s are strictly enforced by the kernel. Some others are not really enforced today, but may be enforced in future.

It's pretty clear you shouldn't use them for anything other than RAM.

Using ioremap*() is also wrong since there is a specific API for PCI, which is pci_iomap*(). Mainteners will only make sure the right the API is working for the right intents.

Just answered 25/7, 2023 at 7:24 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.