From mboxrd@z Thu Jan 1 00:00:00 1970 From: Anthony Liguori Subject: Re: pci: is reset incomplete? Date: Mon, 14 Sep 2009 17:54:36 -0500 Message-ID: <4AAEC9AC.6080309@codemonkey.ws> References: <20090914154822.GA3745@redhat.com> <4AAE7A31.9080600@codemonkey.ws> <20090914173625.GA3859@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Paul Brook , Avi Kivity , qemu-devel@nongnu.org, Carsten Otte , kvm@vger.kernel.org, Rusty Russell , virtualization@lists.linux-foundation.org, Christian Borntraeger , Gerd Hoffmann To: "Michael S. Tsirkin" Return-path: Received: from mail-yx0-f171.google.com ([209.85.210.171]:48737 "EHLO mail-yx0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757424AbZINWyi (ORCPT ); Mon, 14 Sep 2009 18:54:38 -0400 Received: by yxe1 with SMTP id 1so4532512yxe.21 for ; Mon, 14 Sep 2009 15:54:41 -0700 (PDT) In-Reply-To: <20090914173625.GA3859@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: Michael S. Tsirkin wrote: > On Mon, Sep 14, 2009 at 12:15:29PM -0500, Anthony Liguori wrote: > >> Michael S. Tsirkin wrote: >> >>> Hi! >>> pci bus reset does not seem to clear pci config registers, such as BAR >>> registers, or memory space enable, of the attached devices: it only >>> clears the interrupt state. >>> >>> This seems wrong, but easy to fix. >>> >>> >> I don't think most pci devices reset their config space in their reset >> callbacks. >> > > For things like BAR registers, they really must. > BARs should be registered via pci_register_bar so you should be able to centralize their reset. > class codes are read only registers. Your proposal might be correct for > some of these. But PCI registers that are reset, change as a result of > guest activity, and reset values are typically specified by guest spec. > So I don't think we should let users tweak these. > Well, I guess my general point was that it would be good to add more structure to how config space is initialized. I think a natural consequence of that is that it becomes easier to automatically fix the values on reset. Regards, Anthony Liguori