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

Re: [PATCH v1 1/3] vpci: Hide capability when it fails to initialize


  • To: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • From: "Chen, Jiqian" <Jiqian.Chen@xxxxxxx>
  • Date: Tue, 1 Apr 2025 09:17:40 +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=m05oKeqOmUwBWuc8B5wEYGYklrb7uaZ6HRfWR+nH6r0=; b=Wql0SfYuqdv6Mfvp0XX49irV1UzV3Cx4Pf02eG1xeltzZLCGT1DI/nEVLS0pcXZwswz+WZSLOV6EjUIzsIo30IpzOuf8frSInuo3qWOu7ZAxHSHzKJRsNRQ7qKTwXvXV/BEDpAxlh6SY7n7ktEcxK1JMsT/AR9hTsba9oaEdkmwwFusvZWb+rG1jd+N7qOtAsEB5g78YTIau6YQLkbEeqvAbXwx6fWbqQQ5gWm2Nt6SB03qUSjrtBI2kIgObNomlPsnO7Jkah9RS80qfvILECoEH8tAR4qj6eNH8wrF4eP6L/9l6ELI8EaeFtQo5FaAWC9pHPx7jwe0pxDqvsteE6g==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=V7Xva29WQPHc1UDrH4oZpwJv7nHB/zIE/vJcIq17VyXb9Wta2YM0uvMlfYNwFtYkSC7Ugm2bQZpqilUwmsF7uODVmXOeuzEP0G8i4r2XIwSphgSZeM9gqcE0bfxqAMpz0ea/rHPFgepjoM6tQTv4/wypBpG9UFIhMV938JPNODFw5mXQJYIqVprbxOHC/sFwoZ1qG5AawJzrGfVYQwjAgYEa6GUEylJHKjCvFdb/1hXQ58NToGk1+dC4hBSfW2DLAC3ODzMoGXbodoDSxTNAQpHcKeWg2yf1Zm3LmM/p2bp4IE8MvqZL2WEfJmDIEU/ks8pqTj94WvzUsTUxm3ioZQ==
  • 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>, "Huang, Ray" <Ray.Huang@xxxxxxx>, "Chen, Jiqian" <Jiqian.Chen@xxxxxxx>
  • Delivery-date: Tue, 01 Apr 2025 09:17:53 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHbnup9DfRmpRg4a0apmzEwGKAL0LOGtpyAgAamp4D//5bVAIAAjtkA//+YpgCAAfg2AA==
  • Thread-topic: [PATCH v1 1/3] vpci: Hide capability when it fails to initialize

On 2025/3/31 19:04, Roger Pau Monné wrote:
> On Mon, Mar 31, 2025 at 09:32:02AM +0000, Chen, Jiqian wrote:
>> So, I need to refactor the emulating PCI capability list codes of 
>> init_header() to serve
>> for all domain(dom0+domUs) firstly, since current codes only emulate PCI 
>> capability list for domUs, right?
> 
> Yes, that would be my understanding.  The current logic in
> init_header() needs to be expanded/generalized so it can be used for
> masking random PCI capabilities, plus adapted to work with PCIe
> capabilities also.
OK, I will try to refactor the logic in next version.
Hoping the next version will be more in line with your ideas.
Thanks!
> 
>>>
>>>>
>>>>>
>>>>>> +    /*
>>>>>> +     * Capabilities with high priority like MSI-X need to
>>>>>> +     * be initialized before header
>>>>>> +     */
>>>>>> +    rc = vpci_init_cap_with_priority(pdev, VPCI_PRIORITY_HIGH);
>>>>>> +    if ( rc )
>>>>>> +        goto out;
>>>>>
>>>>> I understand this is not introduced by this change, but I wonder if
>>>>> there could be a way to ditch the priority stuff for capabilities,
>>>>> specially now that we only have two "priorities": before or after PCI
>>>>> header initialization.
>>>> I have an idea, but it seems like a hake.
>>>> Can we add a flag(maybe name it "msix_initialized") to struct vpci{}?
>>>> Then in vpci_make_msix_hole(), we can first check that flag, if it is 
>>>> false, we return an error to let modify_decoding() directly return in the 
>>>> process of init_header.
>>>> And in the start of init_msix(), to set msix_initialized=true, in the end 
>>>> of init_msix(), to call modify_decoding() to setup p2m.
>>>> Then we can remove the priorities.
>>>
>>> Maybe the initialization of the MSI-X capability could be done after
>>> the header, and call vpci_make_msix_hole()?  There's a bit of
>>> redundancy here in that the BAR is first fully mapped, and then a hole
>>> is punched in place of the MSI-X related tables.  Seems like the
>>> easier option to break the depedency of init_msix() in being called
>>> ahead of init_header().
>> You mean the sequence should be:
>> vpci_init_header()
>> vpci_init_capability() // all capabilities
>> vpci_make_msix_hole()
>>
>> Right?
> 
> Yes, I think that would be my preference.  The call to
> vpci_make_msix_hole() should be inside of init_msix().
Got it, will do in next version.

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