On 18.06.2024 10:21, Oleksii K. wrote:
> On Fri, 2024-06-14 at 10:47 +0100, Andrew Cooper wrote:
>> On 11/06/2024 7:23 pm, Oleksii K. wrote:
>>> [OPTION 1] If we accepting of loosing 4 Gb of VA then we could
>>> implement mfn_to_page() and page_to_mfn() in the following way:
>>> ```
>>>    diff --git a/xen/arch/riscv/include/asm/mm.h
>>>    b/xen/arch/riscv/include/asm/mm.h
>>>    index cc4a07a71c..fdac7e0646 100644
>>>    --- a/xen/arch/riscv/include/asm/mm.h
>>>    +++ b/xen/arch/riscv/include/asm/mm.h
>>>    @@ -107,14 +107,11 @@ struct page_info
>>>    
>>>     #define frame_table ((struct page_info *)FRAMETABLE_VIRT_START)
>>>    
>>>    -/* PDX of the first page in the frame table. */
>>>    -extern unsigned long frametable_base_pdx;
>>>    -
>>>     /* Convert between machine frame numbers and page-info
>>> structures.
>>> */
>>>     #define
>>> mfn_to_page(mfn)                                          
>>> \
>>>    -    (frame_table + (mfn_to_pdx(mfn) - frametable_base_pdx))
>>>    +    (frame_table + mfn))
>>>     #define
>>> page_to_mfn(pg)                                           
>>> \
>>>    -    pdx_to_mfn((unsigned long)((pg) - frame_table) +
>>>    frametable_base_pdx)
>>>    +    ((unsigned long)((pg) - frame_table))
>>>    
>>>     static inline void *page_to_virt(const struct page_info *pg)
>>>     {
>>>    diff --git a/xen/arch/riscv/mm.c b/xen/arch/riscv/mm.c
>>>    index 9c0fd80588..8f6dbdc699 100644
>>>    --- a/xen/arch/riscv/mm.c
>>>    +++ b/xen/arch/riscv/mm.c
>>>    @@ -15,7 +15,7 @@
>>>     #include <asm/page.h>
>>>     #include <asm/processor.h>
>>>    
>>>    -unsigned long __ro_after_init frametable_base_pdx;
>>>     unsigned long __ro_after_init frametable_virt_end;
>>>    
>>>     struct mmu_desc {
>>> ```
>>
>> I firmly recommend option 1, especially at this point.
> Jan, as you gave your Acked before, don't you mind to define
> mfn_to_page() and page_to_mfn as mentioned above ( Option 1 )?

No, I don't mind. And please feel free to keep my ack if no other significant
changes are made.

Jan

Reply via email to