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

Re: [RFC XEN PATCH v2 1/3] xen/vpci: Clear all vpci status of device


  • To: Roger Pau Monné <roger.pau@xxxxxxxxxx>
  • From: "Chen, Jiqian" <Jiqian.Chen@xxxxxxx>
  • Date: Thu, 30 Nov 2023 11:55:04 +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=arcselector9901; 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=VK8jh57ZRVky3g8Sp0CiWc1G9eVKpDaeqj3HOOtK5W4=; b=JCY3UbmTKMWHFxiEUmZDYArAjD1vb66qwhaFCv9yVfZzfhs9G5NJzq3u+YpuQTgeOQWEbApFawcRkXQ1aKcQj5h5K9uKiFHJr70wuNJsRNGGhU8Rkh8GqE63CcbaCEPY6arOQHv9bnlcnkLed2D0i3eDSii4oQVeOnUwwD9YY9D7i88VKYYH0oDegGV6+UxNU7RIGOxHOPyMI7gI8YlArOc8rAMPG4O/D98af85z+1NwYx7Bzvar8N41cB+MHXGHxHY8Z+DaBSkcnppwl+vrHC8RgagXhygoL05zBlbb9JFCxtbT5T4fOMNNzqofYtQxH85E3ajlELE9UJ5gSECxdA==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=idxY3OfhTOVGWHwkK/SWDLfxZDKLyqQ9l1zs6JoULxUQwJXfAfSym9NcDC+LByU7YID8et4xCOOvCgs+u55DrovrnQm1N9MhOf2tUcX8LV1TCTHG3F3UIcnMjPqTmg985hoB87omq4fNTX6ud/CYcjrIa1cAR2ym8RHxh8St7QetP/e8tTH+jc7i7uLAeAeW+zecI0S7RiMXq3Nxb/qLGt7JuuyZtJp4FLqQwyiN+plsyyQ60/29j3R6/MjTDaTZ+gQFrHg8Csn/5S7YOQP6cxinyr+tdFiz84XuvtnNDDPsUzcyPF0YC91wjP5iBLlIPf6HAyx0+Pp3x4r9k7lXIw==
  • Authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com;
  • Cc: "Daniel P. Smith" <dpsmith@xxxxxxxxxxxxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, Wei Liu <wl@xxxxxxx>, Anthony PERARD <anthony.perard@xxxxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, "Hildebrand, Stewart" <Stewart.Hildebrand@xxxxxxx>, "Deucher, Alexander" <Alexander.Deucher@xxxxxxx>, "Ragiadakou, Xenia" <Xenia.Ragiadakou@xxxxxxx>, "Stabellini, Stefano" <stefano.stabellini@xxxxxxx>, "Huang, Ray" <Ray.Huang@xxxxxxx>, "Huang, Honglei1" <Honglei1.Huang@xxxxxxx>, "Zhang, Julia" <Julia.Zhang@xxxxxxx>, "Chen, Jiqian" <Jiqian.Chen@xxxxxxx>
  • Delivery-date: Thu, 30 Nov 2023 11:55:16 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
  • Thread-index: AQHaHsLfq+dfGUvRWUqPIEH3O9fXrbCPyyeAgAMgFYD//96BAIAAhr4A
  • Thread-topic: [RFC XEN PATCH v2 1/3] xen/vpci: Clear all vpci status of device

On 2023/11/30 19:52, Roger Pau Monné wrote:
> On Thu, Nov 30, 2023 at 06:22:28AM +0000, Chen, Jiqian wrote:
>> Hi Roger and Daniel P. Smith,
>>
>> On 2023/11/28 22:08, Roger Pau Monné wrote:
>>> On Fri, Nov 24, 2023 at 06:41:34PM +0800, Jiqian Chen wrote:
>>>> When a device has been reset on dom0 side, the vpci on Xen
>>>> side won't get notification, so the cached state in vpci is
>>>> all out of date compare with the real device state.
>>>> To solve that problem, this patch add new hypercall to clear
>>>> all vpci device state. And when reset device happens on dom0
>>>> side, dom0 can call this hypercall to notify vpci.
>>>>
>>>> Signed-off-by: Jiqian Chen <Jiqian.Chen@xxxxxxx>
>>>> Signed-off-by: Huang Rui <ray.huang@xxxxxxx>
>>>> ---
>>>>  xen/arch/x86/hvm/hypercall.c  |  1 +
>>>>  xen/drivers/passthrough/pci.c | 21 +++++++++++++++++++++
>>>>  xen/drivers/pci/physdev.c     | 14 ++++++++++++++
>>>>  xen/drivers/vpci/vpci.c       |  9 +++++++++
>>>>  xen/include/public/physdev.h  |  2 ++
>>>>  xen/include/xen/pci.h         |  1 +
>>>>  xen/include/xen/vpci.h        |  6 ++++++
>>>>  7 files changed, 54 insertions(+)
>>>>
>>>> diff --git a/xen/arch/x86/hvm/hypercall.c b/xen/arch/x86/hvm/hypercall.c
>>>> index eeb73e1aa5..6ad5b4d5f1 100644
>>>> --- a/xen/arch/x86/hvm/hypercall.c
>>>> +++ b/xen/arch/x86/hvm/hypercall.c
>>>> @@ -84,6 +84,7 @@ long hvm_physdev_op(int cmd, 
>>>> XEN_GUEST_HANDLE_PARAM(void) arg)
>>>>      case PHYSDEVOP_pci_mmcfg_reserved:
>>>>      case PHYSDEVOP_pci_device_add:
>>>>      case PHYSDEVOP_pci_device_remove:
>>>> +    case PHYSDEVOP_pci_device_state_reset:
>>>>      case PHYSDEVOP_dbgp_op:
>>>>          if ( !is_hardware_domain(currd) )
>>>>              return -ENOSYS;
>>>> diff --git a/xen/drivers/passthrough/pci.c b/xen/drivers/passthrough/pci.c
>>>> index 04d00c7c37..f871715585 100644
>>>> --- a/xen/drivers/passthrough/pci.c
>>>> +++ b/xen/drivers/passthrough/pci.c
>>>> @@ -824,6 +824,27 @@ int pci_remove_device(u16 seg, u8 bus, u8 devfn)
>>>>      return ret;
>>>>  }
>>>>  
>>>> +int pci_reset_device_state(u16 seg, u8 bus, u8 devfn)
>>>
>>> You could use pci_sbdf_t here instead of 3 parameters.
>> Will change in next version, thank you.
>>
>>>
>>> I'm however unsure whether we really need this helper just to fetch
>>> the pdev and call vpci_reset_device_state(), I think you could place
>>> this logic directly in pci_physdev_op().  Unless there are plans to
>>> use such logic outside of pci_physdev_op().
>> If I place the logic of pci_reset_device_state directly in pci_physdev_op. I 
>> think I need to declare vpci_reset_device_state in pci.h? If it is suitable, 
>> I will change in next version.
> 
> Just include xen/vpci.h in drivers/pci/physdev.c AFAICT.
Ok, I will change it in next version. Thanks.

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