The physical address is computed from the machine frame number, so
checking if the physical address is page aligned is pointless.
Furthermore, directly assigned the MFN to the corresponding field in the
entry rather than converting to a physical address and orring the value.
It will avoid to rely on the field position and make the code clearer.
Signed-off-by: Julien Grall <julien.grall@arm.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
*/
static inline lpae_t mfn_to_xen_entry(unsigned long mfn, unsigned attr)
{
- paddr_t pa = ((paddr_t) mfn) << PAGE_SHIFT;
lpae_t e = (lpae_t) {
.pt = {
.valid = 1, /* Mappings are present */
break;
}
- ASSERT(!(pa & ~PAGE_MASK));
- ASSERT(!(pa & ~PADDR_MASK));
+ ASSERT(!(pfn_to_paddr(mfn) & ~PADDR_MASK));
- /* XXX shifts */
- e.bits |= pa;
+ e.pt.base = mfn;
return e;
}