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

Re: [PATCH v5] vpci: Add resizable bar support


  • To: Roger Pau Monné <roger.pau@xxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>
  • From: "Chen, Jiqian" <Jiqian.Chen@xxxxxxx>
  • Date: Tue, 21 Jan 2025 09:10:26 +0000
  • Accept-language: en-US
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=W/uidy0zt/6oRCT8NcuWjDEM2TIENa4DTDV8uP9OQCA=; b=xwEtBXCeDOhBG54dlAl8deXs/DY9aavjn0vPN4p9PTZwiLD9A8ROp8oOxJYhUoIUFV53Qhiy9CMwIrsK6J5YdpmvG2P/bV1im9NmI+CzY8hzc+Lv/mG8xH7V8oLJ/GBsT/P6xSmEtqbJ5fo/53lqeIwZxWI0Zptild2rzrDCSvJz2N2oU8C9nlcuSBDJNPhburg5Wt43hALVxQeNVmxlhLMKEETk6dSDVuESNHgbc/tg7KyWoZilUT2NT8PqaairOTgGEleS8RzUE0RBsgJfv//7Ki6G3pyASmtOnDfWTh/gh8Iwm/vWdFBQjfjUYyFNnJkXTOVQdbxLAHFJD6XbkQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=dCv+ticTYwbugWH9WgkivT5ixeZSOFXEPzuRD5YdUvNUuOmHiX0Dw1gKlxkP6v01s4guUtGAkacdxbGxFFey7pdRiq7iUR9PTbtsxdTCRXsffpUbyNomKRhKPDALTXNzI6BHN1s0H88yZeTr4lLLOiHyQC18FHOlIBsrN8R3XfCjdDD/PwOMhpA/8r2RZRdDD/AAREJ5RduVHEYzEVgiog6lDivg2fwbvx3iFew/HjW2b6eW1pDllPXmKCYLXYyM4LM66fId80IsSWR8RnZc1I+cT4+I/JLaGXMchDYOSLf5HSfHd3wPTA27DdAT+0uWyqn5BlJcWq117uqp/oSqBQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com;
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, "Huang, Ray" <Ray.Huang@xxxxxxx>, "Chen, Jiqian" <Jiqian.Chen@xxxxxxx>
  • Delivery-date: Tue, 21 Jan 2025 09:10:51 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHbZjRJ+4D0uojYEUmC9gRuRAux1rMg9ZEAgACK3YA=
  • Thread-topic: [PATCH v5] vpci: Add resizable bar support

On 2025/1/21 16:46, Roger Pau Monné wrote:
> On Tue, Jan 14, 2025 at 11:26:36AM +0800, Jiqian Chen wrote:
>> +    ctrl = pci_conf_read32(pdev->sbdf, rebar_offset + PCI_REBAR_CTRL(0));
>> +    nbars = MASK_EXTR(ctrl, PCI_REBAR_CTRL_NBAR_MASK);
>> +    for ( unsigned int i = 0; i < nbars; i++ )
>> +    {
>> +        int rc;
>> +        struct vpci_bar *bar;
>> +        unsigned int index;
>> +
>> +        ctrl = pci_conf_read32(pdev->sbdf, rebar_offset + 
>> PCI_REBAR_CTRL(i));
>> +        index = ctrl & PCI_REBAR_CTRL_BAR_IDX;
>> +        if ( index >= PCI_HEADER_NORMAL_NR_BARS )
>> +        {
>> +            printk(XENLOG_ERR "%pd %pp: too big BAR number %u in 
>> REBAR_CTRL\n",
>> +                   pdev->domain, &pdev->sbdf, index);
>> +            continue;
>> +        }
>> +
>> +        bar = &pdev->vpci->header.bars[index];
>> +        if ( bar->type != VPCI_BAR_MEM64_LO && bar->type != VPCI_BAR_MEM32 )
>> +        {
>> +            printk(XENLOG_ERR "%pd %pp: BAR%u is not in memory space\n",
>> +                   pdev->domain, &pdev->sbdf, index);
>> +            continue;
>> +        }
>> +
>> +        rc = vpci_add_register(pdev->vpci, vpci_hw_read32, vpci_hw_write32,
>> +                               rebar_offset + PCI_REBAR_CAP(i), 4, NULL);
>> +        if ( rc )
>> +        {
>> +            /*
>> +             * TODO: for failed pathes, need to hide ReBar capability
>> +             * from hardware domain instead of returning an error.
>> +             */
>> +            printk(XENLOG_ERR "%pd %pp: fail to add reg of REBAR_CAP 
>> rc=%d\n",
>> +                   pdev->domain, &pdev->sbdf, rc);
>> +            return rc;
>> +        }
>> +
>> +        rc = vpci_add_register(pdev->vpci, vpci_hw_read32, rebar_ctrl_write,
>> +                               rebar_offset + PCI_REBAR_CTRL(i), 4, bar);
>> +        if ( rc )
>> +        {
>> +            printk(XENLOG_ERR "%pd %pp: fail to add reg of REBAR_CTRL 
>> rc=%d\n",
>> +                   pdev->domain, &pdev->sbdf, rc);
>> +            return rc;
> 
> I think we said we wanted to attempt to continue here, rather than
> returning an error and thus removing all vPCI handlers from the
> device?
I thought the result of your discussion with Jan was that I only needed to 
change the above two error paths to be "continue".
If these two also need to be changed, I will modify them in the next version.


-- 
Best regards,
Jiqian Chen.

 


Rackspace

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