[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v5 10/11] arm/libxl: Emulated PCI device tree node in libxl


  • To: Stefano Stabellini <sstabellini@xxxxxxxxxx>
  • From: Rahul Singh <Rahul.Singh@xxxxxxx>
  • Date: Thu, 7 Oct 2021 15:31:22 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=arm.com; dmarc=pass action=none header.from=arm.com; dkim=pass header.d=arm.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Z3vr1TjeNbdwYM/J82wk/tF5Zbaky28uluXA1Eqz5Tg=; b=DsTayZkB1nky5W74DzkKPT/YVCE77Df0dvyr6Agf8vDb2z0BTh6iDoosKBz6bCYHHUOjfWKgcUmy3JtGPWsWFBOt2yqquuntoywcHQALYK1sIGwpra1RlO7f+k64VZ6Vt9gL8jbbrfXtmy/i+NxEa4matLB6qM8jXm1ySNqwByVeQN+gP7FKSFHe4CtYTOIhDJ16pCojcyctj6RU0oztmr0Aaa/aYEqprtJGvFzzFXhHVzVooQhLvIMuF0HxYuErJSQEz+msk4G1BmmFd3QNTUv8ylVhI/82LlMl+PLprwzJAgWK4JFrsj6xe9V+HHShYCrzyLEkotdzjs5vN+v4rQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=g2T7CjoXziitnV6ssDCzy3h5LrqSD/PiWaXbNQHCjqGccYjWWZgh3ia5Qx79JqF0Wxcme6OdQtN6g2lHPGaUZKCR2/OW16N8ZzienaMYXPKUVRprw1GU7oiGyFarnlo+OeU3Syo6xFYRNdmYRhDh898YCH4fZ98CRLYua0M/iToqMmnnNnNokKQp4C9fonNJaz6p/nZcE+nsLc2/mjj1vw9GFhwTxlBOH+W5OJfTj02nozhVvCoCxtDYSIbVOqJnttts/gHN6MRQPWDL65AL5tRbyChVf5RTq7YAF87fFzmUsUB8RRf0tpGUPpEsZkhZQJCXxQICKTtJgRgnDpxOLg==
  • Authentication-results-original: kernel.org; dkim=none (message not signed) header.d=none;kernel.org; dmarc=none action=none header.from=arm.com;
  • Cc: Julien Grall <julien@xxxxxxx>, Ian Jackson <iwj@xxxxxxxxxxxxxx>, xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Bertrand Marquis <Bertrand.Marquis@xxxxxxx>, Andre Przywara <Andre.Przywara@xxxxxxx>, Wei Liu <wl@xxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>
  • Delivery-date: Thu, 07 Oct 2021 15:31:48 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Original-authentication-results: kernel.org; dkim=none (message not signed) header.d=none;kernel.org; dmarc=none action=none header.from=arm.com;
  • Thread-index: AQHXutl6z4iIfi6+uESKx+Wr4ZB/gavGQpyAgABrjQCAAPznAA==
  • Thread-topic: [PATCH v5 10/11] arm/libxl: Emulated PCI device tree node in libxl

Hi Stefano,

> On 7 Oct 2021, at 1:26 am, Stefano Stabellini <sstabellini@xxxxxxxxxx> wrote:
> 
> On Wed, 6 Oct 2021, Julien Grall wrote:
>> Hi Rahul,
>> 
>> On 06/10/2021 19:40, Rahul Singh wrote:
>>> diff --git a/tools/libs/light/libxl_types.idl
>>> b/tools/libs/light/libxl_types.idl
>>> index 3f9fff653a..78b1ddf0b8 100644
>>> --- a/tools/libs/light/libxl_types.idl
>>> +++ b/tools/libs/light/libxl_types.idl
>>> @@ -644,6 +644,7 @@ libxl_domain_build_info = Struct("domain_build_info",[
>>>        ("arch_arm", Struct(None, [("gic_version", libxl_gic_version),
>>>                                 ("vuart", libxl_vuart_type),
>>> +                               ("vpci", libxl_defbool),
>> 
>> I have posted some comments regarding the field in v4. To summarize, AFAICT,
>> this option is meant to be only set by libxl but you still let the toolstack
>> (e.g. xl, libvirt) to set it.
>> 
>> If you still want to expose to the toolstack, then I think the option should
>> be outside of arch_arm. Otherwise, this should be moved in an internal
>> structure (Ian, do you have any suggestion?).
> 
> 
> First let me premise that the patch is much better already and Rahul
> addessed my request well. However, Julien's point about not wanting to
> make a potentially breaking ABI change in libxl is a good one. FYI we
> had a few libvirt breakages due to this kind of changes in the past and
> I would certainly be happier if we didn't cause another one. And in
> general, it is better to avoid changes to the libxl ABI if we can.
> 
> I think in this case we can: I looked at the patch and
> b_info.arch_arm.vpci is only used within tools/libs/light/libxl_arm.c.
> Also, we don't need b_info.arch_arm.vpci if we can access
> d_config->num_pcidevs given that the check is just based on
> d_config->num_pcidevs.
> 
> So the only issue is how to check on d_config->num_pcidevs in
> libxl__prepare_dtb. libxl__prepare_dtb takes libxl_domain_build_info as
> parameter but with container_of we can retrieve libxl_domain_config and
> from there check on num_pcidevs.
> 
> Something like the appended (untested). It doesn't need any libxl struct
> changes but it requires the introduction of container_of (which is a
> simple macro). Alternatively, it would be just as simple to change
> libxl__arch_domain_init_hw_description and libxl__prepare_dtb to take a
> libxl_domain_config *d_config parameter instead of a
> libxl_domain_build_info *info parameter.

Thanks for sharing the ideas to remove the arch_arm.vpci field. 
I am ok with any options, but I feel second option is simple and better to 
avoid  
introduction of container_of(). I tested the second option and is working fine.
If everyone agree that we don’t need vpci option I will send the patch for 
review
In next version.

Regards,
Rahul
> 
> Ian, any thoughts?
> 
> 
> diff --git a/tools/libs/light/libxl_arm.c b/tools/libs/light/libxl_arm.c
> index 2be208b99b..ee1176519c 100644
> --- a/tools/libs/light/libxl_arm.c
> +++ b/tools/libs/light/libxl_arm.c
> @@ -102,10 +102,8 @@ int libxl__arch_domain_prepare_config(libxl__gc *gc,
>     }
> 
>     /* Enable VPCI support. */
> -    if (d_config->num_pcidevs) {
> +    if (d_config->num_pcidevs)
>         config->flags |= XEN_DOMCTL_CDF_vpci;
> -        libxl_defbool_set(&d_config->b_info.arch_arm.vpci, true);
> -    }
> 
>     return 0;
> }
> @@ -976,6 +974,7 @@ static int libxl__prepare_dtb(libxl__gc *gc, 
> libxl_domain_build_info *info,
> 
>     const libxl_version_info *vers;
>     const struct arch_info *ainfo;
> +    libxl_domain_config *d_config = container_of(info, libxl_domain_config, 
> b_info);
> 
>     vers = libxl_get_version_info(CTX);
>     if (vers == NULL) return ERROR_FAIL;
> @@ -1076,7 +1075,7 @@ next_resize:
>         if (info->tee == LIBXL_TEE_TYPE_OPTEE)
>             FDT( make_optee_node(gc, fdt) );
> 
> -        if (libxl_defbool_val(info->arch_arm.vpci))
> +        if (d_config->num_pcidevs)
>             FDT( make_vpci_node(gc, fdt, ainfo, dom) );
> 
>         if (pfdt)


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.