From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Auger Subject: Re: [PATCH] KVM: arm/arm64: vgic: add init entry to VGIC KVM device Date: Tue, 02 Dec 2014 18:54:30 +0100 Message-ID: <547DFCD6.3000406@linaro.org> References: <1417541251-20761-1-git-send-email-eric.auger@linaro.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Cc: eric.auger@st.com, Christoffer Dall , Marc Zyngier , arm-mail-list , "kvmarm@lists.cs.columbia.edu" , kvm-devel , Alex Williamson , Alexander Graf , "gleb@kernel.org" , Paolo Bonzini , lkml - Kernel Mailing List , Patch Tracking To: Peter Maydell Return-path: Received: from mail-wi0-f170.google.com ([209.85.212.170]:38288 "EHLO mail-wi0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751916AbaLBRzw (ORCPT ); Tue, 2 Dec 2014 12:55:52 -0500 Received: by mail-wi0-f170.google.com with SMTP id bs8so30797354wib.5 for ; Tue, 02 Dec 2014 09:55:51 -0800 (PST) In-Reply-To: Sender: kvm-owner@vger.kernel.org List-ID: On 12/02/2014 06:50 PM, Peter Maydell wrote: > On 2 December 2014 at 17:27, Eric Auger wrote: >> Since the advent of dynamic initialization of VGIC, this latter is >> initialized very late, on the first vcpu run. This initialization >> could be initiated much earlier by the user, as soon as it has >> provided the requested dimensioning parameters: >> - number of IRQs and number of vCPUs, >> - DIST and CPU interface base address. >> >> One motivation behind being able to initialize the VGIC sooner is >> related to the setup of IRQ injection in VFIO use case. The VFIO >> signaling, especially when used along with irqfd must be set *after* >> vgic initialization to prevent any virtual IRQ injection before >> VGIC initialization. If virtual IRQ injection occurs before the VGIC >> init, the IRQ cannot be injected and subsequent injection is blocked >> due to VFIO completion mechanism (unmask/mask or forward/unforward). > > This implies that you're potentially injecting virtual IRQs > (and changing the state of the VGIC) before we actually > start running the VM (ie before userspace calls KVM_RUN). > Is that right? It seems odd, but maybe vfio works that way? Hi Peter, as soon as VFIO signaling is set up (the device IRQ index is linked to an eventfd, the physical IRQ VFIO handler is installed and the physical IRQ is enabled at interrupt controller level), virtual IRQs are likely to be injected. With current QEMU code, we setup this VFIO signaling *before* the vgic readiness (either on machine init done or reset notifier) and we face that issue of early injection. QEMU related patches to follow ... Best Regards Eric > > -- PMM >