Re: [PATCH 1/1] direct mmio for passthrough - kernel part

Avi Kivity
2008-04-01T17:05:01Z

Anthony Liguori wrote:
>>
>> Regardless of whether we can use /dev/mem, I think we should
>> introduce a new char device anyway. We only need to mmap() MMIO
>> regions which are mapped by the PCI bus, presumably, the kernel
>> should know about these mappings. The driver should only allow
>> mappings that are valid for a particular PCI device such that it
>> cannot be abused to map arbitrary regions of memory into a guest.
>> Bonus points if it can validate that there isn't a valid Linux driver
>> loaded for the given PCI device.
>
> Which is apparently entirely unnecessary as we already have
> /sys/bus/pci/.../region. It's just a matter of checking if a vma is
> VM_IO and then dealing with the subsequent reference counting issues
> as Avi points out.
>

From idea to working implementation in 38 minutes. Congrats.

--
Any sufficiently difficult bug is indistinguishable from a feature.