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

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


  • To: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • From: "Chen, Jiqian" <Jiqian.Chen@xxxxxxx>
  • Date: Fri, 14 Feb 2025 03:32:00 +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=olcr35nmC+u5NaTnoZ7W88hcNHKrwGGMOfzMDy3gzeo=; b=C6bR1z7Fv4F5kAP9JUgGKYCUuSoc3YoMe3hG7k3dHl+D/hukeDxPRWuqg+HITCmvNwILsBJDukfrDB7Fuohj42siPuIYJd5B8FpurxubazAXuQNTrPthSn1YOb+2XO5qdfpKTayi9GB9kpIuwvynaIUKZMA2BIrcYJxtrg+cvZIcxexkPSFaXUUn/3tw5QLcHEuPobnIR1TRqrpvNs6onTyJN4EXfQy53+jPjG2M+BGG14ZJ+5mpQxPuj6IKrbmv7Oj1K3QorPqF29+MnZUo8F1Ae1j5+4fqhYlDeW4TrVwfcYtieK0PQOCC3gWnYwtdzI2nEc+I1GR9VkXjOQlD4A==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=tIhrusg4aLvngjeV05EAwwdk7oyPFqnKc7HLVWrxWYTFs7nBDKLpSD0NWy/pcV2+zaaiAmr5xuw4OjmZ4+49jkpEQ8qxf18PZG8FXYInV8jnIRWl5Dxdygk5EoAXYzOh+sE0dCJ8118POvhK58b1q5Vh7FSDNtigUCx4GtUuaUFqLe6haBCAOmMtYnGDicK0e9meW6HyX1U0zgMfXR2pFM4h40t3OJcPjuq3fwj/6QCoZcMS46pdiCaEfxKDtHF+bp0HM0tUgTcQuPutBTHxsEr4N9ZBPLvts6TOx7Fdjux9I3Eg36c54oPbbGQ2jjmyzdYqZPo83FDK1ggL3RjDwQ==
  • 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>, "Huang, Ray" <Ray.Huang@xxxxxxx>, "Chen, Jiqian" <Jiqian.Chen@xxxxxxx>
  • Delivery-date: Fri, 14 Feb 2025 03:32:22 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHbfCv1LhGDvDdYvUG/cVOOSigHrrNB1FUAgAGqhwA=
  • Thread-topic: [PATCH v8] vpci: Add resizable bar support

On 2025/2/11 17:21, Roger Pau Monné wrote:
> On Tue, Feb 11, 2025 at 10:22:57AM +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@xxxxxxxxxx>
Thank you!
May I know whether this can be merged in Xen version 4.20?

> 
>> ---
>> Hi all,
>> v7->v8 changes:
>> * Modified commit message and some comments.
>> * Deleted unused function vpci_hw_write32.
>>
>> Best regards,
>> Jiqian Chen.
>> ---
>>  xen/drivers/vpci/Makefile  |   2 +-
>>  xen/drivers/vpci/rebar.c   | 131 +++++++++++++++++++++++++++++++++++++
>>  xen/include/xen/pci_regs.h |  15 +++++
>>  xen/include/xen/vpci.h     |   1 +
>>  4 files changed, 148 insertions(+), 1 deletion(-)
>>  create mode 100644 xen/drivers/vpci/rebar.c
>>
>> diff --git a/xen/drivers/vpci/Makefile b/xen/drivers/vpci/Makefile
>> index 1a1413b93e76..a7c8a30a8956 100644
>> --- a/xen/drivers/vpci/Makefile
>> +++ b/xen/drivers/vpci/Makefile
>> @@ -1,2 +1,2 @@
>> -obj-y += vpci.o header.o
>> +obj-y += vpci.o header.o rebar.o
>>  obj-$(CONFIG_HAS_PCI_MSI) += msi.o msix.o
>> diff --git a/xen/drivers/vpci/rebar.c b/xen/drivers/vpci/rebar.c
>> new file mode 100644
>> index 000000000000..794f1168adf8
>> --- /dev/null
>> +++ b/xen/drivers/vpci/rebar.c
>> @@ -0,0 +1,131 @@
>> +/* SPDX-License-Identifier: GPL-2.0-only */
>> +/*
>> + * Copyright (C) 2025 Advanced Micro Devices, Inc. All Rights Reserved.
>> + *
>> + * Author: Jiqian Chen <Jiqian.Chen@xxxxxxx>
>> + */
>> +
>> +#include <xen/sched.h>
>> +#include <xen/vpci.h>
>> +
>> +static void cf_check rebar_ctrl_write(const struct pci_dev *pdev,
>> +                                      unsigned int reg,
>> +                                      uint32_t val,
>> +                                      void *data)
>> +{
>> +    struct vpci_bar *bar = data;
>> +    const unsigned int index = bar - pdev->vpci->header.bars;
>> +    uint64_t size = PCI_REBAR_CTRL_SIZE(val);
> 
> Since you define index as const you could also do the same with size.
> Can adjust at commit, but I also don't have a strong opinion about
> it.
Got it.
If there aren't other comments, then I don't need to send a new version, right?

> 
> 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®.