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

Re: [XEN PATCH v13 1/6] xen/pci: Add hypercall to support reset of pcidev


  • To: "Hildebrand, Stewart" <Stewart.Hildebrand@xxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>
  • From: "Chen, Jiqian" <Jiqian.Chen@xxxxxxx>
  • Date: Mon, 26 Aug 2024 05:58:19 +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=Oz9l8B7Cl1KzTHi7R6Qr23XDXWSi1KxdvVbzFE6z+qk=; b=HIf428zI9lcokfzbMcfFQQIhUOdQI2VNTX1ezK9a/y8gaZFZNWgcCkoJyJuMH47gjlmU+YlfuymowdzV/1WA04WLzibl/HTYkd2DRofM6fu5UacdQzD2fHneps48Fidi/b45Z1p9iWnNgJqu8bDGIpkenjXp/x4YO97xlNHh2brLk3MhTKui+LMFxBDT5H7TS4/HHz7Hurl1q5YD9pEwl5FmWonmidDIyIixnxFwKxhzuQEHfp8veZoIJ0fBcIId/70Qh0lTNK/pVHstgdnoI98vr5ga41AJc+dzZoR5LqsgLMNLXpJCATGlQGLexv6+JoIlZQVLA0rGs9XpzyRtsw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=PAPio0fuTgrGbUqzTAMeGvCZDj3+kbl2nQWX6tzFbv5nChpmlOLw03Pbf04o/jq0uaZZqRc37vNlofnqwTpsWlY7Ty1ILQUPWZ7/pqFTJCIlxEVQgtgw6gQH2AcL/xdzXYsAms8Qq+t5eX8e4K7RjaI3UvJ9JKPKvje9dVTtD49VtxPo/0gMQCX1njh5Ury7OY9pOBGEJvbTArvaunuorEWIOsZ4jWFxVPD7KSL5I4YHu9idO6U0hXOHkSda5kEmGrT1wuPl0wav25CCL6I4coFjIouCw/EFOd6MWi8XVVCgu3HASVhV3YSMVp5Kx9Zw2RFKAT0TDnJgJSXuECCi1g==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com;
  • Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>, Andrew Cooper <andrew.cooper3@xxxxxxxxxx>, Roger Pau Monné <roger.pau@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, George Dunlap <gwd@xxxxxxxxxxxxxx>, Anthony PERARD <anthony@xxxxxxxxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>, Julien Grall <julien@xxxxxxx>, "Daniel P . Smith" <dpsmith@xxxxxxxxxxxxxxxxxxxx>, "Huang, Ray" <Ray.Huang@xxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, "Orzel, Michal" <Michal.Orzel@xxxxxxx>, Oleksii Kurochko <oleksii.kurochko@xxxxxxxxx>, Rahul Singh <Rahul.Singh@xxxxxxx>, Bertrand Marquis <bertrand.marquis@xxxxxxx>, "Chen, Jiqian" <Jiqian.Chen@xxxxxxx>
  • Delivery-date: Mon, 26 Aug 2024 05:58:36 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHa78yrMx2rme7kLk2Lfq5OhJcOzrIuThwAgAGubYD//8GBAIAA9fyAgAjrwgA=
  • Thread-topic: [XEN PATCH v13 1/6] xen/pci: Add hypercall to support reset of pcidev

On 2024/8/21 05:42, Stewart Hildebrand wrote:
> On 8/20/24 03:01, Jan Beulich wrote:
>> On 20.08.2024 08:00, Chen, Jiqian wrote:
>>> On 2024/8/19 17:04, Jan Beulich wrote:
>>>> On 16.08.2024 13:08, Jiqian Chen wrote:
>>>>> @@ -67,6 +68,57 @@ ret_t pci_physdev_op(int cmd, 
>>>>> XEN_GUEST_HANDLE_PARAM(void) arg)
>>>>>          break;
>>>>>      }
>>>>>  
>>>>> +    case PHYSDEVOP_pci_device_reset:
>>>>> +    {
>>>>> +        struct pci_device_reset dev_reset;
>>>>> +        struct pci_dev *pdev;
>>>>> +        pci_sbdf_t sbdf;
>>>>> +
>>>>> +        ret = -EOPNOTSUPP;
>>>>> +        if ( !is_pci_passthrough_enabled() )
>>>>> +            break;
>>>>
>>>> It occurs to me (only now, sorry): Does this case really need to be an
>>>> error? I.e. do we really need to bother callers by having them find out
>>>> whether pass-through is supported in the underlying Xen?
>>> I am not sure, but for x86, passthrough is always true, it doesn't matter.
>>> For arm, this hypercall is also used for passthrough devices for now, so it 
>>> is better to keep the same behavior as other PHYSDEVOP_pci_device_* 
>>> operation?
>>
>> Despite seeing that I did ack the respective change[1] back at the time, I
>> (now) view this as grossly misnamed, at best. Imo it makes pretty little
>> sense for that predicate helper to return true when there are no IOMMUs in
>> use. Even more so that on an Arm/PCI system without IOMMUs one can use the
>> command line option and then execution will make it past this check.
>>
>> I further question the related part of [2]: Why did the stub need moving?
>> I'm not even sure that part of the change fell under the Suggested-by:
>> there, but I also can't exclude it (I didn't bother trying to find where
>> the suggestion was made).
>>
>> In any event - with [1] PHYSDEVOP_*pci* ended up inconsistent on x86,
>> even if right now only on the surface. Yet as soon as this predicate is
>> changed to take IOMMUs into account, the latent inconsistency would
>> become a real one.
>>
>> An alternative to changing how the function behaves would be to rename it,
>> for name and purpose to actually match - is_pci_passthrough_permitted()
>> maybe?
>>
>> Thoughts anyone, Arm / SMMU maintainers in particular?
>>
>> Finally, as to the change here: On an Arm/PCI system where pass-through
>> isn't enabled, the hypervisor will still need to know about resets when
>> vPCI is in use for Dom0. IOW I'd like to refine my earlier comment into
>> suggesting that the conditional be dropped altogether.
> 
> I agree on removing the condition for the reason you mentioned. I'd
> like to remove the other instances of the condition in this file as
> well, but that is the subject of a separate patch in the works [3].
> 
> [3] 
> https://lore.kernel.org/xen-devel/20231109182716.367119-9-stewart.hildebrand@xxxxxxx/
Thanks Stewart and Jan, I will remove this check from my patch in next version.

> 
>>
>> Jan
>>
>> [1] 15517ed61f55 xen/arm: Add cmdline boot option "pci-passthrough = 
>> <boolean>"
>> [2] dec9e02f3190 xen: avoid generation of stub <asm/pci.h> header
> 

-- 
Best regards,
Jiqian Chen.

 


Rackspace

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