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

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


  • To: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • From: "Chen, Jiqian" <Jiqian.Chen@xxxxxxx>
  • Date: Tue, 4 Mar 2025 02:18:06 +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=93XWpMAil8kZw/FJjXP+kEHfUlyZc3CtscelPwBcgc0=; b=hz9lCo04rmLJCJaJgyGBxo5yTP1o7QHN/2ObIcUD5N9TSgxmUWSg5hPtppVotUD/INNP/0XN8L8/N5O/sN6LjPxkVc4ct9OQDhp+IyMEA1Y6Mc/mm0EqfzejDBbI1wilounSiSCz3eVbbLXtSlQxogFpNrUmEa7R595RFQcuBSumFtew7Z7IhBbabShEKldtzXvKlUtBkq26iEnX4ytGtyFZmeyAHHq54aFGPYnS+pRNLckqz2/p3tj1IV+UfJ21U9BodLj6JW3vXNXAZDlQJOi3V1CTttSiIdWfHiwKMGK3gSZ1o9OQUcetn4mBs/QxmKD47t1C/2aM3wk5tyMEfA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=nOi7ZWGcvjKK9N6caXlkhQJvu+3VUbI4+33zelT5oMbrUwXrEnlTMO21IlkMQ+c1FPmw0KmF4TOOA4NzfyBwlv2HEcg1UZpKHyTlgSaem6IcqOuP2WPM+HBxIX2OgM41vEjq8YTLhP8I7ja7knys4YgFOi79YGXJA0ARJjSBM+GXZF0C7/yfBerdz4qRPkMIw5e4F1z4PUPsm1HVIv++NBXY9Ps8FsE4dxJBUMmJoQA+VWTp+vvAzm+g33sRD69dy/PUoHpcCSfVru3ynWrkMUxy/wjblvfTdSIF9LXwfT25LcL/W714AZ525ktlpBak70vL+f7wX6Gq1IGOMkybOA==
  • 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>, Jan Beulich <jbeulich@xxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, "Orzel, Michal" <Michal.Orzel@xxxxxxx>, "Huang, Ray" <Ray.Huang@xxxxxxx>, "Chen, Jiqian" <Jiqian.Chen@xxxxxxx>
  • Delivery-date: Tue, 04 Mar 2025 02:18:26 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHbhmvKPUvcbBS+pUu7/6jYBR9mPrNhfwoAgAFQkYA=
  • Thread-topic: [PATCH v9] vpci: Add resizable bar support

On 2025/3/3 22:09, Roger Pau Monné wrote:
> On Mon, Feb 24, 2025 at 11:24:33AM +0800, Jiqian Chen wrote:
>> Some devices, like AMDGPU, support resizable bar capability,
>> but vpci of Xen doesn't support this feature, so they fail
>> to resize bars and then cause probing failure.
>>
>> According to PCIe spec, each bar that supports resizing has
>> two registers, PCI_REBAR_CAP and PCI_REBAR_CTRL. So, add
>> handlers to support resizing the size of BARs.
>>
>> Note that Xen will only trap PCI_REBAR_CTRL, as PCI_REBAR_CAP
>> is read-only register and the hardware domain already gets
>> access to it without needing any setup.
>>
>> Signed-off-by: Jiqian Chen <Jiqian.Chen@xxxxxxx>
> 
> Reviewed-by: Roger Pau Monné <roger.pau@xxxxxxxxxxx>
> 
> Just one question below about a cosmetic adjustment.
> 
>> diff --git a/xen/include/xen/pci_regs.h b/xen/include/xen/pci_regs.h
>> index 250ba106dbd3..2f1d0d63e962 100644
>> --- a/xen/include/xen/pci_regs.h
>> +++ b/xen/include/xen/pci_regs.h
>> @@ -459,6 +459,7 @@
>>  #define PCI_EXT_CAP_ID_ARI  14
>>  #define PCI_EXT_CAP_ID_ATS  15
>>  #define PCI_EXT_CAP_ID_SRIOV        16
>> +#define PCI_EXT_CAP_ID_REBAR        21      /* Resizable BAR */
>>  
>>  /* Advanced Error Reporting */
>>  #define PCI_ERR_UNCOR_STATUS        4       /* Uncorrectable Error Status */
>> @@ -541,6 +542,20 @@
>>  #define  PCI_VNDR_HEADER_REV(x)     (((x) >> 16) & 0xf)
>>  #define  PCI_VNDR_HEADER_LEN(x)     (((x) >> 20) & 0xfff)
>>  
>> +/* Resizable BARs */
>> +#define PCI_REBAR_CAP(n)    (4 + 8 * (n))   /* capability register */
>> +#define  PCI_REBAR_CAP_SIZES_MASK   0xFFFFFFF0U     /* supported BAR sizes 
>> in CAP */
>> +#define PCI_REBAR_CTRL(n)   (8 + 8 * (n))   /* control register */
>> +#define  PCI_REBAR_CTRL_BAR_IDX             0x00000007      /* BAR index */
>> +#define  PCI_REBAR_CTRL_NBAR_MASK   0x000000E0      /* # of resizable BARs 
>> */
>> +#define  PCI_REBAR_CTRL_BAR_SIZE    0x00003F00      /* BAR size */
>> +#define  PCI_REBAR_CTRL_SIZES_MASK  0xFFFF0000U     /* supported BAR sizes 
>> in CTRL */
>> +
>> +#define PCI_REBAR_CTRL_SIZE_BIAS    20
>> +#define PCI_REBAR_CTRL_SIZE(v) \
>> +    (1ULL << (MASK_EXTR(v, PCI_REBAR_CTRL_BAR_SIZE) \
>> +                      + PCI_REBAR_CTRL_SIZE_BIAS))
> 
> I think this could fit on a single line if the indent was just 4
> spaces.  Would you mind me adjusting it at commit if it fits?
Certainly not, please adjust it if it fits, thank you very much!

> 
> Thanks, Roger.

-- 
Best regards,
Jiqian Chen.

 


Rackspace

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