From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paolo Bonzini Subject: Re: [PATCH v2 11/16] KVM: introduce a 'mmap' method for KVM devices Date: Tue, 26 Feb 2019 13:52:39 +0100 Message-ID: References: <20190222112840.25000-1-clg@kaod.org> <20190222112840.25000-12-clg@kaod.org> <20190225033309.GO7668@umbus.fritz.box> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit Cc: kvm@vger.kernel.org, kvm-ppc@vger.kernel.org, Paul Mackerras , linuxppc-dev@lists.ozlabs.org To: =?UTF-8?Q?C=c3=a9dric_Le_Goater?= , David Gibson Return-path: In-Reply-To: Content-Language: en-US List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linuxppc-dev-bounces+glppe-linuxppc-embedded-2=m.gmane.org@lists.ozlabs.org Sender: "Linuxppc-dev" List-Id: kvm.vger.kernel.org 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. :) Paolo From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paolo Bonzini Date: Tue, 26 Feb 2019 12:52:39 +0000 Subject: Re: [PATCH v2 11/16] KVM: introduce a 'mmap' method for KVM devices Message-Id: List-Id: References: <20190222112840.25000-1-clg@kaod.org> <20190222112840.25000-12-clg@kaod.org> <20190225033309.GO7668@umbus.fritz.box> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable To: =?UTF-8?Q?C=c3=a9dric_Le_Goater?= , David Gibson Cc: kvm@vger.kernel.org, kvm-ppc@vger.kernel.org, Paul Mackerras , linuxppc-dev@lists.ozlabs.org On 25/02/19 11:57, C=E9dric Le Goater wrote: > Hello Paolo, >=20 > On 2/25/19 4:33 AM, David Gibson wrote: >> On Fri, Feb 22, 2019 at 12:28:35PM +0100, C=E9dric 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=E9dric 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? =20 >=20 > Not yet. >=20 >> We'll need some core KVM buy in to merge this. >=20 > Here is an extension of the KVM device to allow special mappings. > Something we would need for the support of the POWER9 XIVE interrupt=20 > controller. >=20 > There are two MMIOs we need to expose to the guest :=20 >=20 > 1. HW MMIO controlling of the interrupt presenter registers (TIMA) > 2. HW MMIO of the interrupt sources for interrupt management (ESB) >=20 > 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=20 > chose to use directly the KVM device fd for that. Is that ok ?=20 >=20 > 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.=20 It's okay, it's a natural extension to dev_ops - but thanks for asking anyway. :) Paolo