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

Re: [RFC PATCH v1 2/4] xen/arm: Discovering PCI devices and add the PCI devices in XEN.


  • To: Stefano Stabellini <sstabellini@xxxxxxxxxx>, Rahul Singh <rahul.singh@xxxxxxx>
  • From: Oleksandr Andrushchenko <Oleksandr_Andrushchenko@xxxxxxxx>
  • Date: Fri, 24 Jul 2020 07:14:32 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=epam.com; dmarc=pass action=none header.from=epam.com; dkim=pass header.d=epam.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-SenderADCheck; bh=uaPlPIsLFbKKSO8c+y8J4uKk+JzkywTrpPFdOKOwC/Q=; b=nvsbpIpli7HLQNy/2ybcXZfWDP4NhxLzS+x/fEw2qbF6BApTQ6PkI/23deBMvGy2F7cYQWJ1u2ga8gyOQDv+JmqRXCeSq5I7JrxBa8xsCrwtH7UFs60kOdaeJmYVPNBp5IQeT1fGaATzzO0u2bCOjmv0GOZ/SFr8+a8kYzIa7MeCpOROuyY/WXP/6JA2KMbadTcRYZ4e0QSQLtu3o3dZcGY0h0hR2hKpSx55BppLSDTSO3A0rwDWz/0f+eqXZCRmShIbPtiM8A84SFCMepbuU6HYbF49OobgNkiEBphNdlCp43DFeaskKxZ0KsaDLVk8M36xdEVORpEKFeV/qdLSrg==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=J6KLaYHbO0nBtXsX3j6xu8n2JpO3HOAi5ODDhj2CSKvck+XYd0M7jqVv2j4SkPCfQ7WJcEIl65HPXBi4PtT8g+blmplye05iS3+WQZg7VKkF+jqMMK6F6E/nFUjZ1+avEeFHeXWJLTdR7zIiY4s24Svo9+0gJGuUEHymi6uiResp3SlQZ3lYGpYSb0BJHtUTyU3012zDJ8kaRY7R4J55O4lD+OOZBqk5gzBzebtrxuX7MPDtIcfVRK1dltNN1g5lkOiSsWsb/Nr6pg4j22zN6f0iFairJd6TykK76V1g+wR5AQqeZ02EKT94Xgc4IkE/XVW+Q2blUmBxE8CyR5G/Jw==
  • Authentication-results: kernel.org; dkim=none (message not signed) header.d=none;kernel.org; dmarc=none action=none header.from=epam.com;
  • Cc: Julien Grall <julien@xxxxxxx>, "andrew.cooper3@xxxxxxxxxx" <andrew.cooper3@xxxxxxxxxx>, "Bertrand.Marquis@xxxxxxx" <Bertrand.Marquis@xxxxxxx>, "jbeulich@xxxxxxxx" <jbeulich@xxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, "nd@xxxxxxx" <nd@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, "roger.pau@xxxxxxxxxx" <roger.pau@xxxxxxxxxx>
  • Delivery-date: Fri, 24 Jul 2020 07:14:53 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHWYYoU5xC9fc1Hm02eNWNLg1aFFw==
  • Thread-topic: [RFC PATCH v1 2/4] xen/arm: Discovering PCI devices and add the PCI devices in XEN.

On 7/23/20 11:44 PM, Stefano Stabellini wrote:
> On Thu, 23 Jul 2020, Rahul Singh wrote:
>> Hardware domain is in charge of doing the PCI enumeration and will
>> discover the PCI devices and then will communicate to XEN via hyper
>> call PHYSDEVOP_pci_device_add to add the PCI devices in XEN.
>>
>> Change-Id: Ie87e19741689503b4b62da911c8dc2ee318584ac
> Same question about Change-Id
>
>
>> Signed-off-by: Rahul Singh <rahul.singh@xxxxxxx>
>> ---
>>   xen/arch/arm/physdev.c | 42 +++++++++++++++++++++++++++++++++++++++---
>>   1 file changed, 39 insertions(+), 3 deletions(-)
>>
>> diff --git a/xen/arch/arm/physdev.c b/xen/arch/arm/physdev.c
>> index e91355fe22..274720f98a 100644
>> --- a/xen/arch/arm/physdev.c
>> +++ b/xen/arch/arm/physdev.c
>> @@ -9,12 +9,48 @@
>>   #include <xen/errno.h>
>>   #include <xen/sched.h>
>>   #include <asm/hypercall.h>
>> -
>> +#include <xen/guest_access.h>
>> +#include <xsm/xsm.h>
>>   
>>   int do_physdev_op(int cmd, XEN_GUEST_HANDLE_PARAM(void) arg)
>>   {
>> -    gdprintk(XENLOG_DEBUG, "PHYSDEVOP cmd=%d: not implemented\n", cmd);
>> -    return -ENOSYS;
>> +    int ret = 0;
>> +
>> +    switch ( cmd )
>> +    {
>> +#ifdef CONFIG_HAS_PCI

In the cover letter you were saying "we are not enabling the HAS_PCI and 
HAS_VPCI flags for ARM".

Is this still valid?

>> +        case PHYSDEVOP_pci_device_add:
>> +            {
>> +                struct physdev_pci_device_add add;
>> +                struct pci_dev_info pdev_info;
>> +                nodeid_t node = NUMA_NO_NODE;
>> +
>> +                ret = -EFAULT;
>> +                if ( copy_from_guest(&add, arg, 1) != 0 )
>> +                    break;
>> +
>> +                pdev_info.is_extfn = !!(add.flags & XEN_PCI_DEV_EXTFN);
>> +                if ( add.flags & XEN_PCI_DEV_VIRTFN )
>> +                {
>> +                    pdev_info.is_virtfn = 1;
>> +                    pdev_info.physfn.bus = add.physfn.bus;
>> +                    pdev_info.physfn.devfn = add.physfn.devfn;
>> +                }
>> +                else
>> +                    pdev_info.is_virtfn = 0;
>> +
>> +                ret = pci_add_device(add.seg, add.bus, add.devfn,
>> +                                &pdev_info, node);
>> +
>> +                break;
>> +            }
>> +#endif
>> +        default:
>> +            gdprintk(XENLOG_DEBUG, "PHYSDEVOP cmd=%d: not implemented\n", 
>> cmd);
>> +            ret = -ENOSYS;
>> +    }
> I think we should make the implementation common between arm and x86 by
> creating xen/common/physdev.c:do_physdev_op as a shared entry point for
> PHYSDEVOP hypercalls implementations. See for instance:
>
> xen/common/sysctl.c:do_sysctl
>
> and
>
> xen/arch/arm/sysctl.c:arch_do_sysctl
> xen/arch/x86/sysctl.c:arch_do_sysctl
>
>
> Jan, Andrew, Roger, any opinions?
>
>
I think we can also have a look at [1] by Julien. That implementation,

IMO, had some thoughts on making Arm/x86 code common where possible


[1] 
https://xenbits.xen.org/gitweb/?p=people/julieng/xen-unstable.git;a=shortlog;h=refs/heads/dev-pci

 


Rackspace

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