On Tue, Feb 26, 2019 at 01:52:39PM +0100, Paolo Bonzini wrote: > 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 > >> > >> 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. :) Ok, cool. Given that, do you want to merge directly - since this looks sound enough, even though the rest of the series needs some polish? Or would you prefer it to come in via Paulus' tree? -- David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson