From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58749) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZopQg-0006pJ-OL for qemu-devel@nongnu.org; Wed, 21 Oct 2015 05:11:31 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZopQc-0005pD-IQ for qemu-devel@nongnu.org; Wed, 21 Oct 2015 05:11:30 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60083) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZopQc-0005p2-DJ for qemu-devel@nongnu.org; Wed, 21 Oct 2015 05:11:26 -0400 Date: Wed, 21 Oct 2015 12:11:22 +0300 From: "Michael S. Tsirkin" Message-ID: <20151021115514-mutt-send-email-mst@redhat.com> References: <1444725695-27517-1-git-send-email-caoj.fnst@cn.fujitsu.com> <20151013114852-mutt-send-email-mst@redhat.com> <561CF0DF.80506@cn.fujitsu.com> <20151013160807-mutt-send-email-mst@redhat.com> <56274D91.7080406@cn.fujitsu.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <56274D91.7080406@cn.fujitsu.com> Subject: Re: [Qemu-devel] [PATCH v3 0/2] PCI-e device multi-function hot-add support List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Cao jin Cc: izumi.taku@jp.fujitsu.com, alex.williamson@redhat.com, qemu-devel@nongnu.org On Wed, Oct 21, 2015 at 04:32:17PM +0800, Cao jin wrote: > Hello Michael > > On 10/13/2015 09:10 PM, Michael S. Tsirkin wrote: > >On Tue, Oct 13, 2015 at 07:54:07PM +0800, Cao jin wrote: > >> > >> > >>On 10/13/2015 04:49 PM, Michael S. Tsirkin wrote: > >>>On Tue, Oct 13, 2015 at 04:41:33PM +0800, Cao jin wrote: > >>>>Support PCI-e device hot-add multi-function via device_add, just ensure > >>>>add the function 0 is added last. While allow user to roll back in the > >>>>middle via device_del, in case user regret. > >>> > >>>This patch doesn't seem to account of AIR though. > >>> > >> > >>Yes, but the AIR function seems never be used(nobody calls the function > >>pcie_ari_init()), so I am a little confused about should it be consindered? > > > >Yes please - we'll likely use that in the future. Pls add an API > >that takes ari into account. > > > after analysed the code and read the spec, but still a little confused about > "add an API that takes ari into account". what is new API for? Could you > give a detailed description? You are assuming PCI_FUNC == 0 means function 9. But the real rule is: for an express device associated with an upstream port, it's devfn == 0. For any other device (non express or not connected to an upstream port) - PCI_FUNC == 0. I think a reasonable API could be e.g. bool pci_is_function_0() with a comment explaining the issues. > AFAICT now, taking ari into account will affect the "addr" property of PCI > device(maybe also need a new prop of "ari=on" to enable ari). > > >>>>changelog: > >>>>1. Flag device as unexposed when func 0 doesn`t exist, via return 0xFF > >>>> in case of gratuitous pci bus scan. > >>>>2. Since device is unexposed to guest, can remove function individually, > >>>> without interaction with the guest. > >>>> > >>>>Cao jin (2): > >>>> enable multi-function hot-add > >>>> remove function during multi-function hot-add > >>>> > >>>> hw/pci/pci.c | 10 ++++++++++ > >>>> hw/pci/pci_host.c | 6 +++++- > >>>> hw/pci/pcie.c | 38 +++++++++++++++++++++++++------------- > >>>> 3 files changed, 40 insertions(+), 14 deletions(-) > >>>> > >>>>-- > >>>>2.1.0 > >>>. > >>> > >> > >>-- > >>Yours Sincerely, > >> > >>Cao Jin > >. > > > > -- > Yours Sincerely, > > Cao Jin