On 25/02/19 11:57, Cédric Le Goater wrote: > Hello Paolo, > > On 2/25/19 4:33 AM, David Gibson wrote: >> On Fri, Feb 22, 2019 at 12:28:35PM +0100, Cédric Le Goater wrote: >>> Some KVM devices will want to handle special mappings related to the >>> underlying HW. For instance, the XIVE interrupt controller of the >>> POWER9 processor has MMIO pages for thread interrupt management and >>> for interrupt source control that need to be exposed to the guest when >>> the OS has the required support. >>> >>> Signed-off-by: Cédric Le Goater <clg@xxxxxxxx> >> >> Ah, when I suggested mmap() on the base device fd, I hadn't realized >> there wasn't a facility for that yet. >> >> Have you discussed this with Paolo? > > Not yet. > >> We'll need some core KVM buy in to merge this. > > Here is an extension of the KVM device to allow special mappings. > Something we would need for the support of the POWER9 XIVE interrupt > controller. > > There are two MMIOs we need to expose to the guest : > > 1. HW MMIO controlling of the interrupt presenter registers (TIMA) > 2. HW MMIO of the interrupt sources for interrupt management (ESB) > > The TIMA could have been exposed with a page offset in the vCPU mapping > but as it only makes sense when the XIVE interrupt mode is active, we > chose to use directly the KVM device fd for that. Is that ok ? > > An alternate solution is to use a device ioctl to allocate an anon fd > and do the mapping, but that seems like extra fuss for the same result. It's okay, it's a natural extension to dev_ops - but thanks for asking anyway. :) Paolo