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

Re: [PATCH v4 13/14] arm/libxl: Emulated PCI device tree node in libxl


  • To: Julien Grall <julien@xxxxxxx>
  • From: Rahul Singh <Rahul.Singh@xxxxxxx>
  • Date: Thu, 7 Oct 2021 08:46:40 +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=vzwrjXhO4vzIE2eN1xn7sIV5wV9FYbP9LVTo7KNN3K4=; b=QtdXxlUThlxY0oqNiIgEW9N1QRDXFkk6vKI0q/+WTCtIuve3U5S8obm/NL6H/HuaLXOofrZzAXbayCSv/SldlYw0uH4Oci/MivatQxKlwjm1aOau9pXxUdfgTf3G+JH+7SH21jr80GFgz846afWyUr9aLBXNCakjK+LHygKT2R8YE4lFVblsx9Oiz8iVFRgwiJNPq1kgZtz8Gf5/Owj5lpkhss7KDb5rYZEjyacl+zsZqCkSRv2dAFOSQuRG5UpBx4uPzZ5SxKMarT3R4T6ISKptmgqu2l7dR0XkGBzRx7VBXAAT5RNjTZ2s4RCwxWk1rp/bNgFS6rhkC3nzquU9YA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=H3OO78jcQH16R/aO/GYoRd8LpCbmg4adOxAZQWKoENVB5BhSr/BmOQuYyjIlSpGbAtOsNNaZ62jI9QmJoN+cDUEsUw+jNhpQ/jMxDaegZIRmZm6yNzoKHGhSMc7I0w+gW/SnEtCmiaBIHZu+Av/pzldbOUH8M/iBwiJbKJo6zgCJlHNPPUgCQ5/k8WHsmKZXoAa+jNp2g/uwedBQAMcQf2GW+UFxOkXpypmGEfnFFiFEi97TNcBIpX30f9rTaCGlgQBoQk2iSqExsHloBK8hi6STZ72TKWQMS9hlduMotWBBKxBlyd0ul0wTRVpWT8hrqXLfTOcjzr/wG0Jej3s2bg==
  • Authentication-results-original: xen.org; dkim=none (message not signed) header.d=none;xen.org; dmarc=none action=none header.from=arm.com;
  • Cc: Ian Jackson <iwj@xxxxxxxxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, 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 08:47:06 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Nodisclaimer: true
  • Original-authentication-results: xen.org; dkim=none (message not signed) header.d=none;xen.org; dmarc=none action=none header.from=arm.com;
  • Thread-index: AQHXuRciClWhjFX7R0aQhsW/aixhyqvDkJEAgACf3oCAAL5hgIAAzJaAgAAXDgCAAALtgIAABFYAgABk+ICAAAU6gIAA+ZkA
  • Thread-topic: [PATCH v4 13/14] arm/libxl: Emulated PCI device tree node in libxl

Hi Julien,

> On 6 Oct 2021, at 6:53 pm, Julien Grall <julien@xxxxxxx> wrote:
> 
> Hi Rahul,
> 
> On 06/10/2021 19:34, Rahul Singh wrote:
>>> On 6 Oct 2021, at 12:33 pm, Ian Jackson <iwj@xxxxxxxxxxxxxx> wrote:
>>> 
>>> Rahul Singh writes ("Re: [PATCH v4 13/14] arm/libxl: Emulated PCI device 
>>> tree node in libxl"):
>>>> Hi Ian     
>>>>> What is wrong with putting it in
>>>>> libxl__arch_domain_build_info_setdefault
>>>>> which I think exists precisely for this kind of thing ?
>>>> 
>>>> As we have to set the arch_arm.vpci to false for x86 and ARM I
>>>> thought it is right to move the code to common code to avoid
>>>> duplication.
>>>> 
>>>> Are you suggesting to put "
>>>> libxl_defbool_setdefault(&b_info->arch_arm.vpci, false)ïżœin
>>>> libxl__arch_domain_build_info_setdefault() for x86 and ARM
>>>> differently.
>>> 
>>> I've gone back and reread the whole thread, which I probably should
>>> have done to start with....
>>> 
>>> So:
>>> 
>>>>>> #if defined(__arm__) || defined(__aarch64__)
>>>>>>   /*
>>>>>>    * Enable VPCI support for ARM. VPCI support for DOMU guests is not
>>>>>>    * supported for x86.
>>>>>>    */
>>>>>>   if (d_config->num_pcidevs)
>>>>>>     libxl_defbool_set(&b_info->arch_arm.vpci, true);
>>>>>> #endif
>>> 
>>> I think this logic probably ought to be in libxl, not in xl.
>> I will move the code to "libxl_arm.c"to avoid #ifdef in common code and also 
>>  to avoid setting the vpci for x86
>> diff --git a/tools/libs/light/libxl_arm.c b/tools/libs/light/libxl_arm.c
>> index e3140a6e00..2be208b99b 100644
>> --- a/tools/libs/light/libxl_arm.c
>> +++ b/tools/libs/light/libxl_arm.c
>> @@ -101,6 +101,12 @@ int libxl__arch_domain_prepare_config(libxl__gc *gc,
>>          return ERROR_FAIL;
>>      }
>>  +    /* Enable VPCI support. */
>> +    if (d_config->num_pcidevs) {
>> +        config->flags |= XEN_DOMCTL_CDF_vpci;
>> +        libxl_defbool_set(&d_config->b_info.arch_arm.vpci, true);
>> +    }
>> +
>>      return 0;
>>  }
>>>  We try
>>> to make the libxl API "do the right thing" by default.  In this case I
>>> think that means to enable VPCI (i) on platforms where it's available
>>> (ii) if the guest has PCI passthrough devices.  Is that right ?
>> Yes you are right VPCI will be enabled for guest when guest has PCI 
>> passthrough device
>> assigned and VPCI support is available.
>>> 
>>> Sorry to ask these question now, and please forgive my ignorance:
>>> 
>>> Is VPCI inherently an ARM-specific ABI or protocol ?
>> As of now VPCI for DOMU guests is only implemented  for ARM.
> 
> We need to differentiate between what it is currently implemented and how it 
> can be used in the future.
> 
> In particular, the layout of b_info is exposed to external toolstack (e.g. 
> libvirt). So we can't easily remove an option. In other word, if we end up to 
> need it for an other arch then we will have to keep some compat code.
> 
> In this case, I think this option is not arm specific. So the field ought to 
> be outside of arch_arm.

As we are discussing whether we need this field or not If we reach to the 
conclusion the we need this field I will move this outside of arch_arm.
> 
>>  
>>>  When might an
>>> admin want to turn it on explicitly ?
>> It will be enabled dynamically when admin assign any PCI device to guest.
>>> 
>>> How does this all relate to the (non-arch-specific) "passthrough"
>>> option ?
>> VPCI will be enabled only when there is any PCI device assigned to guest 
>> therefore I used
>> "d_config->num_pcidevs” to enable VPCI.
> 
> Ok. So we don't expect 'xl' or another toolstack to effectively touch the 
> field for the time being. Is that correct?

Yes it is correct. Only use of this field is used to create the DOMU emulated 
PCI device tree node when PCI device is assigned to guest ( 
d_config->num_pcidevs != NULL )
> 
> If so, then I think this option should be hidden from external toolstack 
> until we see a use.

Stefano suggested in another email how we can remove this field. I will work on 
to remove this field.

Regards,
Rahul 
> 
> Cheers,
> 
> -- 
> Julien Grall


 


Rackspace

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