xen/riscv: implement put_page()

Implement put_page(), as it will be used by  p2m_put_*-related code.

Although CONFIG_STATIC_MEMORY has not yet been introduced for RISC-V,
a stub for PGC_static is added to avoid cluttering the code of
put_page() with #ifdefs.

Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
This commit is contained in:
Oleksii Kurochko authored and Jan Beulich committed 2025-12-18 14:25:50 +01:00
1 parent 72a516613f
commit 71fc690ee7
2 files changed
+26 -5

No files matched your search

+7
View File
@@ -264,6 +264,13 @@ static inline bool arch_mfns_in_directmap(unsigned long mfn, unsigned long nr)
/* Page is Xen heap? */
#define _PGC_xen_heap PG_shift(2)
#define PGC_xen_heap PG_mask(1, 2)
#ifdef CONFIG_STATIC_MEMORY
/* Page is static memory */
#define _PGC_static PG_shift(3)
#define PGC_static PG_mask(1, 3)
#else
#define PGC_static 0
#endif
/* Page is broken? */
#define _PGC_broken PG_shift(7)
#define PGC_broken PG_mask(1, 7)
+19 -5
View File
@@ -362,11 +362,6 @@ unsigned long __init calc_phys_offset(void)
return phys_offset;
}
void put_page(struct page_info *page)
{
BUG_ON("unimplemented");
}
void arch_dump_shared_mem_info(void)
{
BUG_ON("unimplemented");
@@ -627,3 +622,22 @@ void flush_page_to_ram(unsigned long mfn, bool sync_icache)
if ( sync_icache )
invalidate_icache();
}
void put_page(struct page_info *page)
{
unsigned long nx, x, y = page->count_info;
do {
ASSERT((y & PGC_count_mask) >= 1);
x = y;
nx = x - 1;
} while ( unlikely((y = cmpxchg(&page->count_info, x, nx)) != x) );
if ( unlikely((nx & PGC_count_mask) == 0) )
{
if ( unlikely(nx & PGC_static) )
free_domstatic_page(page);
else
free_domheap_page(page);
}
}
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.