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

Re: [PATCH v4 02/10] vpci/header: Emulate legacy capability list for dom0


  • To: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • From: "Chen, Jiqian" <Jiqian.Chen@xxxxxxx>
  • Date: Fri, 16 May 2025 02:33:12 +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=2ZqNs414xL42DZ7mgbjBvRRvoYPvUF7v77FMMIzldLQ=; b=TCIt4HQsFGYcoVpMH7IxW8y1oKvspmv/wTAd2Nswbar1GFW6MjSmIOLVLRBMqCgmPLLGu/oWqf/NGrbfAVP9lsxcCjlF/AbhZ9aNbiP4I79ebQNPPyHavrB0W8xBqU4y6e9PS3/QnbtV09CNW/vUaSMnzCMbAaXAZpmd6zPnVscFVcAd0nQ190/qhODOQxHA6AVyJ9JLJx+AUGxoshJv47excTTyHRYfmyabC6/KtppA/xqm5fIyRGyGDAw/5Uy3BbLUArx8hQpAw2R4dVX4Ra5iEdGLBl7SaPIkiTlaD+QW1ayyW8DnPepnio/x9Xq3HDmcMNxS6WqlaGw8oMd9Ug==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=c4QfWh27naPFYKhwhhV0fUv9rBAtEPZN+623FtsUUP20cT6NWDl1B5qlTFpKOaT/fv6R9cvKmoc07xsSeY/oYjVzaXFVmoTHFsO3Qkov6ztzq5DgVZJ7BgTaN/ECQcrsAqbDR5dnecpyR/rzfpRntOaI4zgqFc46y6KmFFVZoI6HO/qGvJOjx0HS5VN3SfsEaa/leCSNpPm7sOwRhgMLVq7rAiEbj973y61awB9WZq1vMiSZH6/vjW8yTJYnUwjeDnzTtY7e9wrTOL8Q8+doweNJDWMqGSLrJu5qM+r7HHVVuLnuSEM2MR2IQrT4mRtvHmMP0yvXS4zdzEr/1kUsWA==
  • 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: Fri, 16 May 2025 02:33:21 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHbwMGa1FMptcF6w0qNJxVZG2xD+7PT664AgAEtSIA=
  • Thread-topic: [PATCH v4 02/10] vpci/header: Emulate legacy capability list for dom0

On 2025/5/16 00:29, Roger Pau Monné wrote:
> On Fri, May 09, 2025 at 05:05:34PM +0800, Jiqian Chen wrote:
>> @@ -786,15 +792,18 @@ static int vpci_init_capability_list(struct pci_dev 
>> *pdev)
>>  
>>              next = pci_find_next_cap_ttl(pdev->sbdf,
>>                                           pos + PCI_CAP_LIST_NEXT,
>> -                                         supported_caps,
>> -                                         ARRAY_SIZE(supported_caps), &ttl);
>> +                                         supported_caps, n, &ttl);
>>  
>> -            rc = vpci_add_register(pdev->vpci, vpci_hw_read8, NULL,
>> -                                   pos + PCI_CAP_LIST_ID, 1, NULL);
>> -            if ( rc )
>> -                return rc;
>> +            if ( !is_hwdom )
>> +            {
>> +                rc = vpci_add_register(pdev->vpci, vpci_hw_read8, NULL,
>> +                                       pos + PCI_CAP_LIST_ID, 1, NULL);
>> +                if ( rc )
>> +                    return rc;
>> +            }
>>  
>> -            rc = vpci_add_register(pdev->vpci, vpci_read_val, NULL,
>> +            rc = vpci_add_register(pdev->vpci, vpci_read_val,
>> +                                   is_hwdom ? vpci_hw_write8 : NULL,
>>                                     pos + PCI_CAP_LIST_NEXT, 1,
>>                                     (void *)(uintptr_t)next);
>>              if ( rc )
>> @@ -805,13 +814,17 @@ static int vpci_init_capability_list(struct pci_dev 
>> *pdev)
>>      }
>>  
>>      /* Utilize rsvdp_mask to hide PCI_STATUS_CAP_LIST from the guest. */
>> -    return vpci_add_register_mask(pdev->vpci, vpci_hw_read16, 
>> vpci_hw_write16,
>> -                                  PCI_STATUS, 2, NULL,
>> -                                  PCI_STATUS_RO_MASK &
>> -                                    ~(mask_cap_list ? PCI_STATUS_CAP_LIST : 
>> 0),
>> -                                  PCI_STATUS_RW1C_MASK,
>> -                                  mask_cap_list ? PCI_STATUS_CAP_LIST : 0,
>> -                                  PCI_STATUS_RSVDZ_MASK);
>> +    return is_hwdom ? 0 : vpci_add_register_mask(pdev->vpci, vpci_hw_read16,
>> +                                                 vpci_hw_write16, 
>> PCI_STATUS,
>> +                                                 2, NULL,
>> +                                                 PCI_STATUS_RO_MASK &
>> +                                                    ~(mask_cap_list ?
>> +                                                        PCI_STATUS_CAP_LIST 
>> :
>> +                                                        0),
>> +                                                 PCI_STATUS_RW1C_MASK,
>> +                                                 mask_cap_list ?
>> +                                                    PCI_STATUS_CAP_LIST : 0,
>> +                                                 PCI_STATUS_RSVDZ_MASK);
> 
> Wow, that's a bit too much indentation for my taste.  Do you think you
> could do:
> 
> /* Return early for the hw domain, no masking of PCI_STATUS. */
> if ( is_hwdom )
>     return 0;
> ...
> 
> So that you don't have to touch the current return chunk?
It seems better.
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®.