[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>
  • From: Rahul Singh <Rahul.Singh@xxxxxxx>
  • Date: Mon, 27 Jul 2020 08:40:53 +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-SenderADCheck; bh=ME4pLc+Ysu5/OH8Oha0+sOISh6/ilN3IU5jCigmE1Pc=; b=M2cwFzxR0RX/tl7GtYESdK6gYfLTttc5Zuf+iD9ZmiCG9Jqe1yV+OcxKNa346hEfXcpV46eF0yM3R0fuZ3/xnR/bC+gsseOAQkap1cGXWW3113mF7fX1hbgePQIbJElnoUu/7aK074OaCr9M7heNn1nHLaEDJvvJKTiq4PX9IQRQ3mKaq7nKctD78sJiB/tFGT4WMyTMdbfIINWIAIs5NFR1Tu+ihhpXwY9ivTvWLtsx66XjuFUBWkGm1Gfs5ceVcdmrvfuo7UkTvwkSNoC6+vmG41ZHecquwBW8rFm6aVQfvRziUaMyLcbN84eGmiE6UDp6j1SkR+8V4UgnAKhp9A==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hVN17U3Psqs9Cr69d7PsKz3EBFLWi0GWjMUISIL+FXFPcREHC06DMMsQXnRq/T/zSEnHRO++ZbNvQxnF5iqqA2YYvfRnzjxUsbUnJubrf6pLR72z+qzBmna5gQ1BZBfWtI0ND/wO0RGzBk7EsvgmTlP73uRmFUkD/AJA4W1ZHOdp8lnb5sxdMk1qenYZ+lja/R5gvBoCFI3nHrs9huQM3Rh/gURVYydttu90yP8hcfDttJCCOf0R0rkpDIuone8bwpYmKPLN1u3axSFg+VxQxzw+2xcSCDC28Ni5DjhWm0uwifXs7rbkgUhKW+36uhG6Usn7Wq1PB3bCR7iVwj+kEQ==
  • 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>, "andrew.cooper3@xxxxxxxxxx" <andrew.cooper3@xxxxxxxxxx>, Bertrand Marquis <Bertrand.Marquis@xxxxxxx>, "jbeulich@xxxxxxxx" <jbeulich@xxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, nd <nd@xxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, "roger.pau@xxxxxxxxxx" <roger.pau@xxxxxxxxxx>
  • Delivery-date: Mon, 27 Jul 2020 08:41:17 +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: AQHWYPbP4iMQjZDQ906szkp+TjbuPqkVohKAgAV/RoA=
  • Thread-topic: [RFC PATCH v1 2/4] xen/arm: Discovering PCI devices and add the PCI devices in XEN.

Sorry for the late reply.

> On 23 Jul 2020, at 9:44 pm, Stefano Stabellini <sstabellini@xxxxxxxxxx> 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

I think by-mistake Gerrit Change-id is added in the patch series. I will remove 
the Change-Id in next version of the patch.
> 
> 
>> 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
>> +        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
> 

Ok sure I will check if we can create a common entry for ARM and x86 for 
do_physdev_op(). 

> Jan, Andrew, Roger, any opinions?




 


Rackspace

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