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

Re: [PATCH v2 1/1] vpci: Add resizable bar support


  • To: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • From: "Chen, Jiqian" <Jiqian.Chen@xxxxxxx>
  • Date: Wed, 11 Dec 2024 09:44:25 +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=P7x0wzU8pbPNe3Kl4q9awbFtWXBJVc4ESh/0VCrA5QA=; b=FCIXdF9TJ0flKte2yCH8WCVXXBZgr510vwWqlvY0vzAWXMSKWq93wF0WwQi2PgYey8UY8F8X8Y4WrViB1XOcIRBvIffoXpEj58kf8VIatmOw9yA3Vj++FnWijuDCtCfxP0ljLR/rjc31q+xG0cS4E+UMWjvxDbZbtOXY2lSVYuKNwk6igD6/GdKvzCkP4kKbWUfkM0tV4kVIHPtuI5HG0oP3NntGcpO1O9uA1y4nqmrKLL35HmwqVwVFO6AczlRV7oFcT2SD3u3oezGWf0Pm09tVbQefgJNGTYvAyme3NE6YlVS+ULxbR2BMZRyVeBuf2IE2ZXoGgCt1npQy3Gn1Ug==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=n8XiTdAtYyAKPuipMt4HGbCZ2PKPo92s/2EwtUFDCumDLMgYVCnaATR6P22ETBwXFPfH9yos6nL6+gK0mMjqxgGUVO2TG1Q/MnbT/4zU4CntRp2m22uC3gwt2keg80/wL/EPl0tJTeNN9904fPOw8a5fCSgUD0mf5qbuNA5BMgWMGvV3nqtrr2h17zCh6w0I9AHrvkIJNPbFCBUc3ewXh4Wu+sTOjzCige+Lcd4b13fVx6dFN01xRrklj5bUTT8ZsfVODjsKt9Aw9EqmxQ8H9+nWVCdOtRRNBnGU64AAUmbxfGBeDc/T9xJzV9S48xS0IDA+ZY4qHmeh4zj7C8M1pg==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com;
  • Cc: Jan Beulich <jbeulich@xxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, "Huang, Ray" <Ray.Huang@xxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, "Chen, Jiqian" <Jiqian.Chen@xxxxxxx>
  • Delivery-date: Wed, 11 Dec 2024 09:44:40 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHbRIDgGHZ3ofHO0UuqqXvn+EZCabLd/CGAgAGXh4D//4qBgIAAiieA//+hwICAABlHgIAB3TaA//+HM4AAEuLWgA==
  • Thread-topic: [PATCH v2 1/1] vpci: Add resizable bar support

On 2024/12/11 16:40, Roger Pau Monné wrote:
> On Wed, Dec 11, 2024 at 07:57:29AM +0000, Chen, Jiqian wrote:
>> On 2024/12/10 19:25, Roger Pau Monné wrote:
>>> On Tue, Dec 10, 2024 at 10:54:43AM +0100, Jan Beulich wrote:
>>>> On 10.12.2024 08:57, Chen, Jiqian wrote:
>>>>> On 2024/12/10 15:17, Jan Beulich wrote:
>>>>>> On 10.12.2024 08:07, Chen, Jiqian wrote:
>>>>>>> On 2024/12/9 21:59, Jan Beulich wrote:
>>>>>>>> On 02.12.2024 07:09, Jiqian Chen wrote:
>>>>>>>>> +        if ( rc )
>>>>>>>>> +        {
>>>>>>>>> +            printk("%pp: add register for PCI_REBAR_CAP failed 
>>>>>>>>> (rc=%d)\n",
>>>>>>>>> +                   &pdev->sbdf, rc);
>>>>>>>>> +            break;
>>>>>>>>> +        }
>>>>>>>>> +
>>>>>>>>> +        rc = vpci_add_register(pdev->vpci, vpci_hw_read32, 
>>>>>>>>> rebar_ctrl_write,
>>>>>>>>> +                               rebar_offset + PCI_REBAR_CTRL, 4,
>>>>>>>>> +                               pdev->vpci->header.bars);
>>>>>>>>> +        if ( rc )
>>>>>>>>> +        {
>>>>>>>>> +            printk("%pp: add register for PCI_REBAR_CTRL failed 
>>>>>>>>> %d\n",
>>>>>>>>> +                   &pdev->sbdf, rc);
>>>>>>>>> +            break;
>>>>>>>>
>>>>>>>> Is it correct to keep the other handler installed? After all ...
>>>>>>> Will change to "return rc;" here and above in next version.
>>>>>>
>>>>>> I'm not convinced this is what we want, as per ...
>>>>>>
>>>>>>>>> +        }
>>>>>>>>> +    }
>>>>>>>>> +
>>>>>>>>> +    return 0;
>>>>>>>>
>>>>>>>> ... you - imo sensibly - aren't communicating the error back up (to 
>>>>>>>> allow
>>>>>>>> the device to be used without BAR resizing.
>>>>>>
>>>>>> ... what I said here.
>>>>> Sorry, I didn’t understand.
>>>>> Do you mean it is not enough to return error code once a handler failed 
>>>>> to be installed, I need to remove the already installed handlers?
>>>>
>>>> No, if you return an error here, nothing else needs doing. However, I
>>>> question that returning an error here is good or even necessary. In
>>>> the event of an error, the device ought to still be usable, just
>>>> without the BAR-resizing capability.
>>>
>>> So you suggest that the capability should be hidden in that case?  We
>>> have logic to hide capabilities, just not used for the hardware
>>> domain.  It would need some extra wiring to be capable of hiding
>>> failed capabilities.
>> Can you give me a guidance on how to hide a failed capability?
>> What codes are current logic to hide capabilities?
> 
> This was done by Stewart for the legacy PCI capabilities, but not
> exactly to hide the capabilities that fail to init.  Take a look at
> commit:
> 
> d830b0a7bc7e xen/vpci: header: filter PCI capabilities
> 
> However that was designed to expose a fixed set of capabilities,
> always known when init_header() is executed.  If we want to hide
> capabilities on failure we will need a bit more flexible interface I
> think.
> 
> Ideally we would like to tie this to initialization hooks themselves,
> so that in vpci_assign_device() an init function failing automatically
> triggers the hiding of the failing capability.  That would need an
> interface similar to:
> 
> #define REGISTER_VPCI_INIT(<capability id>, <function>, <priority>,
> <pcie?>)
> 
> REGISTER_VPCI_INIT(PCI_CAP_ID_MSI, init_msi, VPCI_PRIORITY_LOW,
> false);
> 
> And then in vpci_assign_device() any init function that has a
> capability ID different than 0 and fails to initialize would lead to
> the capability being masked.
> 
> It would be great to have an interface like this in place, because the
> current error handling in vPCI is not great.  For the hardware domain
> init functions failing will just lead to the device being fully
> accessible by dom0 without any mediation.
> 
> Anyway, we don't do any of this for dom0 at the moment when MSI or
> MSI-X fail to init, so I'm not sure it's fair to ask that you do this
> for ReBAR.  It would be great if you want to, but it's not a trivial
> amount of work.
Thanks!
It sounds like not easy to do.
But I will try to implement this if I have time.

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