On 05.08.2024 17:34, oleksii.kuroc...@gmail.com wrote: > On Mon, 2024-08-05 at 17:13 +0200, oleksii.kuroc...@gmail.com wrote: >> On Mon, 2024-07-29 at 15:35 +0200, Jan Beulich wrote: >>>> + } >>>> + >>>> + BUG_ON(pte_is_valid(*pte)); >>>> + >>>> + tmp = paddr_to_pte(LINK_TO_LOAD((unsigned long)&xen_fixmap), >>>> PTE_TABLE); >>> >>> I'm a little puzzled by the use of LINK_TO_LOAD() (and >>> LOAD_TO_LINK() >>> a >>> little further up) here. Don't you have functioning __pa() and >>> __va()? >> Can __pa() and __va() be used in this case? >> >> According to comments for other architectures, these macros are used >> for converting between Xen heap virtual addresses (VA) and machine >> addresses (MA). I may have misunderstood what is meant by the Xen >> heap >> in this context, but I'm not sure if xen_fixmap[] and page tables are >> considered part of the Xen heap. > > One more thing: can we use __pa() and __va() in setup_fixmap()? > > As I understand it, to define __pa() and __va(), the DIRECTMAP mapping > should be mapped first. However, this requires information about RAM > banks, which is provided in the device tree file. But we can't map > device tree without fixmap. Am I missing something?
Depends on further plans. In principle VA <-> PA translation within the directmap range and within the Xen image range is purely arithmetic, not requiring any mappings to have been established. You don't access any of the referenced memory in the course of doing the translation, after all. Jan