On Wed, Aug 22, 2018 at 10:45:34AM +0100, Wei Liu wrote:
> On Wed, Aug 22, 2018 at 09:51:58AM +0200, Roger Pau Monne wrote:
> > Returns all the memory types applicable to a page.
> > 
> > This function is unimplemented for ARM.
> > 
> > Signed-off-by: Roger Pau Monné <roger....@citrix.com>
> > Reviewed-by: Jan Beulich <jbeul...@suse.com>
> > ---
> > Changes since v5:
> >  - Return all types that apply to a page, since the types themselves
> >    are flags that can be or'ed together.
> > ---
> > Cc: Stefano Stabellini <sstabell...@kernel.org>
> > Cc: Julien Grall <julien.gr...@arm.com>
> > Cc: Andrew Cooper <andrew.coop...@citrix.com>
> > Cc: George Dunlap <george.dun...@eu.citrix.com>
> > Cc: Ian Jackson <ian.jack...@eu.citrix.com>
> > Cc: Jan Beulich <jbeul...@suse.com>
> > Cc: Konrad Rzeszutek Wilk <konrad.w...@oracle.com>
> > Cc: Tim Deegan <t...@xen.org>
> > Cc: Wei Liu <wei.l...@citrix.com>
> > ---
> >  xen/arch/x86/mm.c    | 42 ++++++++++++++++++++++++++++++++++++++++++
> >  xen/include/xen/mm.h |  3 +++
> >  2 files changed, 45 insertions(+)
> > 
> > diff --git a/xen/arch/x86/mm.c b/xen/arch/x86/mm.c
> > index 8ac4412554..fcf4bb0afc 100644
> > --- a/xen/arch/x86/mm.c
> > +++ b/xen/arch/x86/mm.c
> > @@ -430,6 +430,48 @@ int page_is_ram_type(unsigned long mfn, unsigned long 
> > mem_type)
> >      return 0;
> >  }
> >  
> > +unsigned int page_get_ram_type(unsigned long mfn)
> 
> It would be better if you can use type-safe mfn_t here.
> 
> 
> > +{
> > +    uint64_t last = 0, maddr = pfn_to_paddr(mfn);
> 
> And then
> 
>     maddr = mfn_to_maddr(mfn);
> 
> The rest looks good to me.

OK, I haven't done it before because the only caller already uses
unsigned long to deal with mfns, and the function itself will also
end up translating the mfn into unsigned long, so it seemed to me
quite pointless to add this extra translation that doesn't seem to
benefit either the caller or the function itself, but will change it
now.

Thanks, Roger.

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

Reply via email to