I was trying to set memory type as Write combine because I want to use 'movntdqa' instructions.
I found the set_memory_wc() function in kernel code which take the memory address and size as argument.
In that function, It convert the logical address to physical address by using __pa() function.
As far as I know __pa() function is only valid when the address is kernel logical address space.
So I don't know the set_memory_wc() function is also can be called by user process.
I have implemented the custom system call which call set_memory_wc() function and used in user process but I generate error.
The error message was " CPA: called for zero pte.". I think this error is due to I am calling that function is user address space.
Then Is there any way to set memory type to write combine in address space??
Thank you in advance.
The WC memory type is typically only used for memory-mapped IO regions, not for system memory regions.
The MOVNTDQA instruction is intended to provide concurrent 64-Byte transfers from memory-mapped IO regions. This is not needed for system memory regions because the WriteBack memory type already provides 64-Byte transfers and concurrency.
The hardware should support using the WC type for system memory, but this is not a target that an operating system is likely to be set up for.