[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [PATCH v2 5/8] xen/riscv: introduce asm/pmap.h header
On Mon, 2024-07-22 at 14:54 +0200, Jan Beulich wrote: > On 12.07.2024 18:22, Oleksii Kurochko wrote: > > --- /dev/null > > +++ b/xen/arch/riscv/include/asm/pmap.h > > @@ -0,0 +1,28 @@ > > +#ifndef __ASM_PMAP_H__ > > +#define __ASM_PMAP_H__ > > + > > +#include <xen/bug.h> > > +#include <xen/mm.h> > > + > > +#include <asm/fixmap.h> > > + > > +static inline void arch_pmap_map(unsigned int slot, mfn_t mfn) > > +{ > > + pte_t *entry = &xen_fixmap[slot]; > > + pte_t pte; > > + > > + ASSERT(!pte_is_valid(*entry)); > > + > > + pte = mfn_to_xen_entry(mfn, PAGE_HYPERVISOR_RW); > > + pte.pte |= PTE_LEAF_DEFAULT; > > + write_pte(entry, pte); > > +} > > + > > +static inline void arch_pmap_unmap(unsigned int slot) > > +{ > > + pte_t pte = {}; > > + > > + write_pte(&xen_fixmap[slot], pte); > > +} > > Why are these not using set_fixmap() / clear_fixmap() respectively? They haven't been introduced yet. And I thought that these fucntion are used only in pmap_{un}map() and that is the reason why I decided to not introduce them. But while writing the answer on another comment, I found other places where set_fixmap() / clear_fixmap() are used, so I will introduce them and reuse here. > > > --- a/xen/arch/riscv/mm.c > > +++ b/xen/arch/riscv/mm.c > > @@ -370,3 +370,17 @@ int map_pages_to_xen(unsigned long virt, > > BUG_ON("unimplemented"); > > return -1; > > } > > + > > +static inline pte_t mfn_to_pte(mfn_t mfn) > > This name suggests (to me) that you're getting _the_ (single) PTE for > a given MFN. However, what the function is doing is make a PTE using > the given MFN. On x86 at least the common way to name such a function > would be pte_from_mfn(). If it is a common way then I will rename it. Thanks. ~ Oleksii > > > +{ > > + unsigned long pte = mfn_x(mfn) << PTE_PPN_SHIFT; > > + return (pte_t){ .pte = pte}; > > Nit: Blank missing. > > Jan
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |