From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Campbell Subject: Re: [PATCH v3 23/24] libxl: Add support for non-PCI passthrough Date: Mon, 23 Feb 2015 14:41:40 +0000 Message-ID: <1424702500.27930.124.camel@citrix.com> References: <1421159133-31526-1-git-send-email-julien.grall@linaro.org> <1421159133-31526-24-git-send-email-julien.grall@linaro.org> <54CA22A3.1040001@linaro.org> <54CA3AC8.4020405@linaro.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YPuDE-0004Hk-Gb for xen-devel@lists.xenproject.org; Mon, 23 Feb 2015 14:42:20 +0000 In-Reply-To: <54CA3AC8.4020405@linaro.org> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Julien Grall Cc: Wei Liu , Stefano Stabellini , Ian Jackson , tim@xen.org, stefano.stabellini@citrix.com, xen-devel@lists.xenproject.org List-Id: xen-devel@lists.xenproject.org On Thu, 2015-01-29 at 13:51 +0000, Julien Grall wrote: > On 29/01/15 12:31, Stefano Stabellini wrote: > > On Thu, 29 Jan 2015, Julien Grall wrote: > >> Hi Stefano, > >> > >> On 29/01/15 11:12, Stefano Stabellini wrote: > >>>> diff --git a/tools/libxl/libxl_create.c b/tools/libxl/libxl_create.c > >>>> index 029d2e2..b7ef528 100644 > >>>> --- a/tools/libxl/libxl_create.c > >>>> +++ b/tools/libxl/libxl_create.c > >>>> @@ -1430,6 +1430,16 @@ static void domcreate_attach_pci(libxl__egc *egc, libxl__multidev *multidev, > >>> > >>> I think you should at least rename domcreate_attach_pci to something > >>> more generic, like domcreate_attach_dev. > >> > >> Actually I was planning to add a domcreate_attach_dtdev but I forgot > >> about it. > >> > >> What the best approach for this? > > > > Either one would work. But don't add non-PCI passthrough code to a > > function named domcreate_attach_pci :-) > > Right, it was a quick & dirty implementation which I forgot to clean up. > > >>> > >>>> } > >>>> } > >>>> > >>>> + for (i = 0; i < d_config->num_dtdevs; i++) { > >>>> + > >>>> + ret = libxl__device_dt_add(gc, domid, &d_config->dtdevs[i]); > >>>> + if (ret < 0) { > >>>> + LIBXL__LOG(ctx, LIBXL__LOG_ERROR, > >>>> + "libxl__device_dt_add failed: %d\n", ret); > >>>> + goto error_out; > >>>> + } > >>>> + } > >>> > >>> You are allowed to call xc_* functions from here. The > >>> libxl__device_dt_add wrapper doesn't add much value. > >> > >> I would like to keep the wrapper. It's in sync with the PCI solution and > >> it will avoid refactoring later for add new code. > > > > But in the PCI case there is a lot of code in the function. > > Regardless if you think it is useful, keep it. > > If we plan to implement a proper platform device pass-through we will > have to add lots of code. > > Wei, Ian & Ian, do you have any opinions? A new function (e.g. domcreate_attach_dtdev) between domcreate_attach_pci and domcreate_console_available in the callback chain is the right answer, I think. Unless there is a lot more code to come then I'm not sure adding libxl_dtdev.c or the function in there is necessary -- just call xc_assign... from the new domcreate_attach function. It's up to you though. Ian.