On Tue, Jun 10, 2008 at 10:02:45AM -0500, Anthony Liguori wrote:

> Why?  Wouldn't MMIO pages have to be mapped in the VT-d page table
> in order to support pass-through?  It certainly can't hurt, can it?

By MMIO pages we refer to pages which are mapped (or can mapped) to
device MMIO regions. In other words, they are only relevant for host
memory accesses. VT-d mappings are used for *device* memory
accesses. I can't think of a good reason for a device to try to DMA to
such a page (where would the DMA end? There is no backing RAM), hence
the principal of least surprise says that we shouldn't map such pages
in the IOMMU page tables so that *if* the device tries to DMA to them
we will take an IOMMU fault rather than fail silently or machine check
(I've seen both happen with DMAs to MMIO regions).

> At any rate, looking at the code again, the else clause is:
>
>> +                    printk(KERN_DEBUG "kvm_iommu_map_page:"
>> +                            "invalid pfn=%lx\n", pfn);
>> +                    return 0;
>
>
> Which looks like error handling to me. 

You are right, that snippet should be fixed to just skip non-RAM
gfns.

> I don't think it's at all safe to assume that a slot is either
> entirely MMIO or entirely RAM.  You could very easily construct a
> slot that's a mix of both so if this is an attempt to skip MMIO
> slots, it's broken.

How would suc a slot be constructed with the current code base? (Note
that you need Ben's direct MMIO patches to create an MMIO slot).

Cheers,
Muli
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to