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

Re: [PATCH v1 10/14] xen/arm: Discovering PCI devices and add the PCI devices in XEN.


  • To: Julien Grall <julien@xxxxxxx>
  • From: Rahul Singh <Rahul.Singh@xxxxxxx>
  • Date: Fri, 20 Aug 2021 13:05:50 +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=FqrVtcr6wLbX1KQ7cYlGpgqKPkszw2NQrxQhSgXwnYU=; b=bBqYajnTrtQQbSwQcud3NJlNGnOF74VIJuFlsArUwvDQK0v3jfGbYBmxKQ4jhSJCA6bmziTdcYDQJmkSkWOotnXtu7TJI6U3Gp6sYLC2nMYZcdDg2Mt6OuMCpn347t4X6k957DuDggX8tPJWxKetkHQIT3+/twMqSbIpiQpfkW3srjM5j60+jTD63LMmsHJxXyKGJHuzCzoeI/ZkCj2yXc7GqOZwrA+EF8tR6atjdv0m8vceY5AP8FRcEDn7ZP0WDtHrm2OAJAEn3xreOXLp8fXQncmbaqXqAhnBXNq0W1xIfw/DG+4CxXo6GxAOIIHZ9bVGKDI1vZcLd5nK2FsGwA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AaDbaOnGXrYYSVMoO4rjcotrW91ccUT3ttDqKN1DppgcREYdH0QFl4IpPZDv0GnneC5bmG1Dw5tvKvEQuw32stDSJIyw4V6wIEmIwEyWbSx4/sXx65ZBQWkg3g2hAWGSzB6vtdhOFIr1uhZve8atBi4TFwfkJrtBlZDnmpfItRW0bXHhKFm+KygP8BGGXTotiEWumyLVCD02/Fdx6FgCICB5SXp3369M2W2WnRMzXBlKU72dAaDzyxlJSCgb7PNDXH07BR3ScgR9HCZplSHJhcq1QmWMiQu5z35CktnAkmL1clW6P931K6DsCdecl1cgfsroL669C+ekNiQraNa1wg==
  • Authentication-results-original: xen.org; dkim=none (message not signed) header.d=none;xen.org; dmarc=none action=none header.from=arm.com;
  • Cc: xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Bertrand Marquis <Bertrand.Marquis@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Volodymyr Babchuk <Volodymyr_Babchuk@xxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>
  • Delivery-date: Fri, 20 Aug 2021 13:06:26 +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: AQHXlPLlKrcwY4kSPU6FlkOop/ITjqt6w4oAgAGawgA=
  • Thread-topic: [PATCH v1 10/14] xen/arm: Discovering PCI devices and add the PCI devices in XEN.

Hi Julien,

> On 19 Aug 2021, at 1:35 pm, Julien Grall <julien@xxxxxxx> wrote:
> 
> (+ Jan)
> 
> Hi Rahul,
> 
> On 19/08/2021 13:02, 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.
> 
> There are other PHYSDEVOP operations to add PCI devices. I think it is fine 
> to only implement the latest (CC Jan for some opinion and confirm this is the 
> latest). However, this ought to be explained in the commit message.

As per Jan comments I will add the PHYSDEVOP_pci_device_remove() in the next 
version.
> 
> Also, public/arch-arm.h will need to be updated as we now support the 
> PHYSDEVOP hypercall.

Ok.
> 
>> Signed-off-by: Rahul Singh <rahul.singh@xxxxxxx>
>> ---
>>  xen/arch/arm/physdev.c | 39 ++++++++++++++++++++++++++++++++++++---
>>  1 file changed, 36 insertions(+), 3 deletions(-)
>> diff --git a/xen/arch/arm/physdev.c b/xen/arch/arm/physdev.c
>> index e91355fe22..ccce8f0eba 100644
>> --- a/xen/arch/arm/physdev.c
>> +++ b/xen/arch/arm/physdev.c
>> @@ -9,12 +9,45 @@
>>  #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;
>> +    }
> 
> This is pretty much a copy of the x86 version without the NUMA bit. So I 
> think we want to move the implementation in common code.

Ok. Let me move the PHYSDEVOP_pci_device_* to common code.

Regards,
Rahul




 


Rackspace

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