Re: [Xen-devel] [PATCH] grant-table: don't set m2p override ifkmap_ops is not set

From: Ian Campbell
Date: Tue Nov 05 2013 - 10:08:34 EST


On Tue, 2013-11-05 at 16:01 +0100, Roger Pau Monnà wrote:
> On 05/11/13 15:56, Konrad Rzeszutek Wilk wrote:
> > On Tue, Nov 05, 2013 at 03:47:08PM +0100, Roger Pau Monnà wrote:
> >> On 05/11/13 13:36, David Vrabel wrote:
> >>> On 05/11/13 11:24, Roger Pau Monne wrote:
> >>>> IMHO there's no reason to set a m2p override if the mapping is done in
> >>>> kernel space, so only set the m2p override when kmap_ops is set.
> >>>
> >>> Can you provide a more detailed reasoning about why this is safe?
> >>
> >> To tell the truth, I don't understand why we need to use the m2p
> >> override for kernel space only mappings, my understanding is that this
> >> m2p override is needed for user space mappings only (where we actually
> >> end up doing two mappings, one in kernel space and one in user space).
> >> For kernel space I don't see why we need to do anything else than
> >> setting the right p2m translation.
> >
> > We needed the m2p when doing DMA operations. As the driver would
> > want the bus address (so p2m) and then when unmapping the DMA we
> > only get the bus address - so we needed to do a m2p lookup.
>
> OK, we need a m2p (that we already have in machine_to_phys_mapping),
> what I don't understand is why we need the m2p override.

The m2p is a host global table.

For a foreign page grant mapped into the current domain the m2p will
give you the foreign (owner) domain's p from the m, not the local one.

Ian.


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/