From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH v2] kvm: Disable MSI/MSI-X in assigned device reset path Date: Sun, 08 Apr 2012 18:50:27 +0300 Message-ID: <4F81B3C3.6020204@redhat.com> References: <20120408131710.GA13997@redhat.com> <4F819025.30407@redhat.com> <20120408132126.GD13997@redhat.com> <4F81917B.5050805@redhat.com> <20120408133016.GA14136@redhat.com> <4F819587.5050103@redhat.com> <20120408135324.GA14166@redhat.com> <4F819A40.1010806@redhat.com> <20120408144221.GA14689@redhat.com> <4F81AE24.7000901@redhat.com> <20120408154647.GA14914@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Cc: Alex Williamson , kvm@vger.kernel.org, jan.kiszka@siemens.com, jbaron@redhat.com To: "Michael S. Tsirkin" Return-path: Received: from mx1.redhat.com ([209.132.183.28]:10185 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754743Ab2DHPuc (ORCPT ); Sun, 8 Apr 2012 11:50:32 -0400 In-Reply-To: <20120408154647.GA14914@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On 04/08/2012 06:46 PM, Michael S. Tsirkin wrote: > > > > > > > > I'm thinking about this flow: > > > > > > > > FLR the device > > > > for each emulated register > > > > read it from the hardware > > > > if different from emulated register: > > > > update the internal model (for example, disabling MSI in kvm if > > > > needed) > > > > > > If we do it this way we get back the problem this patch > > > is trying to solve: MSIX assigned while device > > > memory is disabled would cause unsupported request errors. > > > > Why is that? FLR would presumably disable MSI in the device, and this > > line would disable it in kvm as well. > > The bug is that device memory is disabled (FLR would do that) > while MSI is enabled in kvm. The fix is to > disable MSI in kvm first. Yes, no need to repeat. My question is whether my pseudo-code does the same and whether or not if it is better (when applied to all emulated config space). > > > Doing this in kernel seems more robust, otherwise > > > we risk losing the device if qemu gets killed > > > before it has restored the registers. > > > > Doesn't the driver have to enable MSIX if it attaches to the device at > > that point, anyway? > > Yes. I'm talking about things like enabling memory, setting up irq register, > etc though. Most of this setup is done by bios. I see. So should we have a pci_reset_function() variant that limits itself to restoring just those bits? -- error compiling committee.c: too many arguments to function