[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] vpci: Add resizable bar support
- To: Roger Pau Monné <roger.pau@xxxxxxxxxx>
- From: "Chen, Jiqian" <Jiqian.Chen@xxxxxxx>
- Date: Wed, 20 Nov 2024 02:30:33 +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=4jPBUrTd06Wur0MXGVdCn8qfBtXDMUIBvpmPwnvCJAo=; b=lWo3+7E9cyC7/lwkJD3RVx95GZ3sLtMSBeilMptHpTWnx4t/MZ1BURDbMYosu2HkpAG1PWxhqnEAUq88fnzsoxhX7INtFs+SwGQnZu3AhjQsQgW/k/+V7HjrQrLONMNzek4aOCYXwyczW6ma0L4l4xc3uXJ7Mfvrd/lBmhEhocZ25jkXYP8QupQQtniCDRsWZsZWyfFzCOPVvBOIC2pf8sm1FqutemSUx0YYLX1N5iVSuAv96aCuj8DWvWhTTxrfJ58wvDwO/1JmcTLzmiRM12FD5gtuEDGxmFyoF79wbiaX507fuGZIHYyPM6jXzmYFPqjyX27q5OnxWVDfsp7CMA==
- Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=m6Y6GO7HzzK96TdXmVy5v/H0j+d0Gvexg3Skx8d4l90gPJWGGeqfDERFdHZwhQjegX1FTuswht7dqOFDuzAUO2xsiogy/KYuNc9Pu/9JZSULYWL95J5+Tborjeoz3XsULiQ8SIlvsy8mA9LRQtOHH4uwB1ukfV8ixzziblUQ1ILEXllck+sR7x6GpuaZTE0sDwxvtkJMbDOysOUiHU1zyyO4XmfoldUkdj8ZmTRu3VqdNoyKAL+Eu3/pdVUyPPfLYhrNwFNdhRlwmDiCwK6djk/FJ5Fd5oUCwviI8etI4mm/bmdVazJwEcMkjTHrWHVH9Iu2y4welMCW0mDbUo09Uw==
- 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>, "Chen, Jiqian" <Jiqian.Chen@xxxxxxx>
- Delivery-date: Wed, 20 Nov 2024 02:30:42 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
- Thread-index: AQHbNaIlMxf8mJcywkeNRFmHEai1qbK+mCKAgAFqAAA=
- Thread-topic: [PATCH] vpci: Add resizable bar support
On 2024/11/19 20:51, Roger Pau Monné wrote:
> On Wed, Nov 13, 2024 at 04:00:27PM +0800, Jiqian Chen wrote:
>> +static void cf_check rebar_ctrl_write(const struct pci_dev *pdev,
>> + unsigned int reg,
>> + uint32_t val,
>> + void *data)
>> +{
>> + uint32_t ctrl, index;
>> + struct vpci_bar *bars = pdev->vpci->header.bars;
>> +
>> + ctrl = pci_conf_read32(pdev->sbdf, reg);
>> + if ( ctrl == val )
>> + return;
>> +
>> + ctrl &= ~PCI_REBAR_CTRL_BAR_SIZE;
>> + if ( ctrl != ( val & ~PCI_REBAR_CTRL_BAR_SIZE ) )
>> + return;
>> +
>> + index = ctrl & PCI_REBAR_CTRL_BAR_IDX;
>> + bars[index].size = (1 << ((val & PCI_REBAR_CTRL_BAR_SIZE) >>
>> + PCI_REBAR_CTRL_BAR_SHIFT)) *
>> + PCI_REBAR_CTRL_BAR_UNIT;
>
> One further comment: you also need to reset addr and guest_addr here
> (possibly by reading them from the BAR register), as the specification
> states that:
How about just set them to 0, since the addr will be re-assigned by system and
the addr of BAR register is also out of date.
>
> "After writing the BAR Size field, the contents of the corresponding
> BAR are undefined"
>
> Hence the cached addr and guest_addr are stale after a write to the
> control register.
>
> Thanks, Roger.
--
Best regards,
Jiqian Chen.
|