From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?UTF-8?Q?C=c3=a9dric_Le_Goater?= Subject: Re: [PATCH 09/19] KVM: PPC: Book3S HV: add a SET_SOURCE control to the XIVE native device Date: Tue, 5 Feb 2019 14:39:28 +0100 Message-ID: <62898e33-81fd-b01f-e578-c753a30070d0@kaod.org> References: <20190107184331.8429-1-clg@kaod.org> <20190107184331.8429-10-clg@kaod.org> <20190204045751.GD1927@umbus.fritz.box> <40c8dc36-0d54-1e66-d766-5580c19ae8fd@kaod.org> <20190205053554.GI22661@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: David Gibson Return-path: In-Reply-To: <20190205053554.GI22661@umbus.fritz.box> 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 2/5/19 6:35 AM, David Gibson wrote: > On Mon, Feb 04, 2019 at 08:07:20PM +0100, Cédric Le Goater wrote: >> On 2/4/19 5:57 AM, David Gibson wrote: >>> On Mon, Jan 07, 2019 at 07:43:21PM +0100, Cédric Le Goater wrote: > [snip] >>>> + sb = kvmppc_xive_create_src_block(xive, irq); >>>> + if (!sb) { >>>> + pr_err("Failed to create block...\n"); >>>> + return -ENOMEM; >>>> + } >>>> + } >>>> + state = &sb->irq_state[idx]; >>>> + >>>> + if (get_user(val, ubufp)) { >>>> + pr_err("fault getting user info !\n"); >>>> + return -EFAULT; >>>> + } >>>> + >>>> + /* >>>> + * If the source doesn't already have an IPI, allocate >>>> + * one and get the corresponding data >>>> + */ >>>> + if (!state->ipi_number) { >>>> + state->ipi_number = xive_native_alloc_irq(); >>>> + if (state->ipi_number == 0) { >>>> + pr_err("Failed to allocate IRQ !\n"); >>>> + return -ENOMEM; >>>> + } >>> >>> Am I right in thinking this is the point at which a specific guest irq >>> number gets bound to a specific host irq number? >> >> yes. the XIVE IRQ state caches this information and 'state' should be >> protected before being assigned, indeed ... The XICS-over-XIVE device >> also has the same race issue. >> >> It's not showing because where initializing the KVM device sequentially >> from QEMU and only once. > > Ok. > > So, for the passthrough case, what's the point at which we know that a > particular guest interrupt needs to be bound to a specific real > hardware interrupt, rather than a generic IPI? when the guest driver requests MSIs, VFIO requests a mapping of the HW irqs in the guest IRQ space. This is very briefly said as VFIO is a huge framework. Patch 18 adds some initial support to handle the ESB pages but this should be done at the QEMU level. C.