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

Re: [PATCH v6 3/8] vpci: Hide legacy capability when it fails to initialize


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: "Chen, Jiqian" <Jiqian.Chen@xxxxxxx>
  • Date: Thu, 19 Jun 2025 07:26: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=s4VKaBeGdc86MRbLrlgOPvn3xfUD8EuxN664Q06HNaY=; b=v4LyvarjOhqrchmwexbWKdEZkhJz+0lhrVyeH+wEm+8IoElnWWMXqjwg9O0itIJ9Z9KdrIFqavsXp7rADzDH/VMS3JVCnLqQphfBa3qa8DEI9NJowMuPOB1Gewxpy1Bt/gFKjPlOOSD+IpLV86zPZ+5mzKSGVO0d5IbEtrZc+rZ2H7XxnypAAOoeopkKnjRohi0hOQ16zm3kNEHWdshLWHoqLnCIrCYLB607cVyV3Iq4XQmK6fWbfMD5J3mzHjBQxHBUNt7G3IJK/VQOihQFYiCp+u/SWDTtH0aYZf90/YtXUG2hP70avifWLQPNRajPQOG/pfAG1UM5SjO2XEQpPA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=rrga4XHVaoDcsVfvNGjylfqDgPfeRxrO9ObTK+DaoiOMME0yDM8byxkXudj1EEaI2ooxDsVvNkPQstsgj2SWX2n/Mm0i9iEmin72AuXqfxbJx3yHQPzXagM1IT9+3tVKcGqtYu0TqLxBnHNkQ3eQj2SKQzVxS30h36yxQuZ5jjn3m0zJtANS6pCtxjy8rOB70ujFModsXBWTYjvjEV2d7PIputJ/cFGSA65Vyzjgh98pNmg4Z5EM3rSKP4k0dsIdSPyY34Q/B6tyPxE0Y+C0SjGsH5tk8k6b5Cpy+4b4u3UdOJws+d45Sv5Y/F78/Katu39aRFizPjy3JE2HMVBBuQ==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com;
  • Cc: "Huang, Ray" <Ray.Huang@xxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, "Chen, Jiqian" <Jiqian.Chen@xxxxxxx>
  • Delivery-date: Thu, 19 Jun 2025 07:27:05 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHb23ydSLPIKyE480C9STMPmN1Rl7QI/lUAgAGnEoA=
  • Thread-topic: [PATCH v6 3/8] vpci: Hide legacy capability when it fails to initialize

On 2025/6/18 22:09, Jan Beulich wrote:
> On 12.06.2025 11:29, Jiqian Chen wrote:
>> --- a/xen/drivers/vpci/vpci.c
>> +++ b/xen/drivers/vpci/vpci.c
>> @@ -83,6 +83,88 @@ static int assign_virtual_sbdf(struct pci_dev *pdev)
>>  
>>  #endif /* CONFIG_HAS_VPCI_GUEST_SUPPORT */
>>  
>> +static struct vpci_register *vpci_get_register(struct vpci *vpci,
>> +                                               unsigned int offset,
>> +                                               unsigned int size)
>> +{
>> +    struct vpci_register *r;
>> +
>> +    ASSERT(spin_is_locked(&vpci->lock));
>> +
>> +    list_for_each_entry ( r, &vpci->handlers, node )
>> +    {
>> +        if ( r->offset == offset && r->size == size )
>> +            return r;
>> +
>> +        if ( offset <= r->offset )
>> +            break;
>> +    }
>> +
>> +    return NULL;
>> +}
>> +
>> +static struct vpci_register *vpci_get_previous_cap_register(
>> +    struct vpci *vpci, unsigned int offset)
>> +{
>> +    uint32_t next;
>> +    struct vpci_register *r;
>> +
>> +    if ( offset < 0x40 )
>> +    {
>> +        ASSERT_UNREACHABLE();
>> +        return NULL;
>> +    }
>> +
>> +    for ( r = vpci_get_register(vpci, PCI_CAPABILITY_LIST, 1); r;
>> +          r = next >= 0x40 ? vpci_get_register(vpci,
>> +                                               next + PCI_CAP_LIST_NEXT, 1)
>> +                           : NULL )
>> +    {
>> +        next = (uint32_t)(uintptr_t)r->private;
>> +        ASSERT(next == (uintptr_t)r->private);
>> +        if ( next == offset )
>> +            break;
>> +    }
>> +
>> +    return r;
>> +}
>> +
>> +static int vpci_capability_hide(struct pci_dev *pdev, unsigned int cap)
> 
> I really only noticed it in the next patch, but the question applies equally
> here: Any reason the first parameter isn't pointer-to-const?
Will change the parameters to be const of my new functions in this and next 
patches.

> 
> Jan

-- 
Best regards,
Jiqian Chen.

 


Rackspace

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