From mboxrd@z Thu Jan 1 00:00:00 1970 From: Julien Grall Subject: Re: [PATCH v2 20/21] libxl: Add support for non-PCI passthrough Date: Fri, 08 Aug 2014 15:15:45 +0100 Message-ID: <53E4DB91.7020208@linaro.org> References: <1406818852-31856-1-git-send-email-julien.grall@linaro.org> <1406818852-31856-21-git-send-email-julien.grall@linaro.org> <53E25CE8.7090104@linaro.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1XFkxU-0000e2-0z for xen-devel@lists.xenproject.org; Fri, 08 Aug 2014 14:15:52 +0000 Received: by mail-we0-f178.google.com with SMTP id w61so5621998wes.23 for ; Fri, 08 Aug 2014 07:15:50 -0700 (PDT) In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Stefano Stabellini Cc: Ian Jackson , xen-devel@lists.xenproject.org, tim@xen.org, ian.campbell@citrix.com, stefano.stabellini@citrix.com List-Id: xen-devel@lists.xenproject.org On 08/06/2014 05:58 PM, Stefano Stabellini wrote: > On Wed, 6 Aug 2014, Julien Grall wrote: >> Hi Stefano, >> >> On 08/06/2014 05:44 PM, Stefano Stabellini wrote: >>> On Thu, 31 Jul 2014, Julien Grall wrote: >>>> On ARM, every non-PCI device are described in the device tree. Each of them >>>> can be found via a path. >>>> >>>> This path will be used to retrieved the different informations about the >>>> device (compatible string, interrupts, MMIOs). Libxl will take care of: >>>> - Allocate the MMIOs regions for the device in the guest >>>> - Create the device node in the guest device tree >>>> - Map the IRQs and MMIOs range in the guest P2M >>>> >>>> Note, that the device node won't contains specific properties for the node. >>>> Only generic one (compatible, interrupts, regs) will be created by libxl. >>>> >>>> In the future, per-device properties will be added. Maybe via a configuration >>>> file listing what is needed. >>>> >>>> Signed-off-by: Julien Grall >>>> Cc: Ian Jackson >>>> Cc: Stefano Stabellini >>>> Cc: Ian Campbell >>>> >>>> --- >>>> Changes in v2: >>>> - Get DT infos earlier >>>> - Allocate/map IRQ in libxl__arch_domain_create rather than in >>>> libxl__device_dt_add >>> >>> I understand why you moved it earlier but if it is not too hard I would >>> suggest to try to keep mmio and irq mapping all together, because it >>> would make the code much easier to read and modify in the future, being >>> all in one place. >> >> I could fixup the device tree later. So we don't have to "map/retrieve" >> the IRQ earlier. >> >> But I don't much like this solution. > > Urgh, that's horrible. I'll leave it to Ian to decide what's best. FWIW, we already fix up the device later for the initrd node and the memory banks. Thinking a bit more to this solution and it won't be easily possible. The device tree is finalized and copy the guest memory in xc_dom_build_image which is called by libxl__build_pv. So unless we assign platform device very early (i.e between libxl_build_pre call and libxl__build_pv call in libxl__domain_build_pv), we will have to map/get the interrupt very early in a hackish way. This is because we have to get the virtual IRQ to create the DT node for the device. I'm open to any other ideas. Regards, -- Julien Grall