mbox series

[0/3] virtgpu: check if P2P is possiable or not

Message ID 20241207105023.542399-1-julia.zhang@amd.com (mailing list archive)
Headers show
Series virtgpu: check if P2P is possiable or not | expand

Message

Zhang, Julia Dec. 7, 2024, 10:50 a.m. UTC
To implement dGPU prime feature, virtgpu needs to import/export buffer
between virtio iGPU and passthrough dGPU. Before that, virtgpu should
check if P2P is possible or not. But calling function pci_p2pdma_distance
in guest VM will only get virtual p2pdma_distance instead of real physical
p2pdma_distance.
 
So this series introduce an implementation of virtgpu device_attach
callback to get p2pdma_distance. And also adds a new virtgpu command to
pass PCI notations from guest to host and a new xen privcmd to get physical
p2pdma_distance according to the PCI notations in host.

Julia Zhang (3):
  xen:get p2pdma_distance
  virtgpu: get p2pdma_distance
  drm/virtio: Implement device_attach

 drivers/gpu/drm/virtio/virtgpu_drv.h   | 17 ++++++++
 drivers/gpu/drm/virtio/virtgpu_prime.c | 59 +++++++++++++++++++++++++-
 drivers/gpu/drm/virtio/virtgpu_vq.c    | 53 +++++++++++++++++++++++
 drivers/xen/privcmd.c                  | 42 ++++++++++++++++++
 include/uapi/linux/virtio_gpu.h        | 19 +++++++++
 include/uapi/xen/privcmd.h             | 12 ++++++
 6 files changed, 201 insertions(+), 1 deletion(-)

Comments

Jürgen Groß Dec. 12, 2024, 7:43 a.m. UTC | #1
On 07.12.24 11:50, Julia Zhang wrote:
> To implement dGPU prime feature, virtgpu needs to import/export buffer
> between virtio iGPU and passthrough dGPU. Before that, virtgpu should
> check if P2P is possible or not. But calling function pci_p2pdma_distance
> in guest VM will only get virtual p2pdma_distance instead of real physical
> p2pdma_distance.
>   
> So this series introduce an implementation of virtgpu device_attach
> callback to get p2pdma_distance. And also adds a new virtgpu command to
> pass PCI notations from guest to host and a new xen privcmd to get physical
> p2pdma_distance according to the PCI notations in host.

It is hard to review this series without having a clear picture how
this all is coming together.

I guess the virtgpu frontend will send a p2pdma_distance request to
the backend, which is running in user mode of dom0. This backend will
then call into the privcmd driver to obtain the needed information and
sends it back to the frontend.

Can you please confirm my suspicion is correct?


Juergen
Zhang, Julia Dec. 13, 2024, 9:58 a.m. UTC | #2
On 2024/12/12 15:43, Juergen Gross wrote:
> On 07.12.24 11:50, Julia Zhang wrote:
>> To implement dGPU prime feature, virtgpu needs to import/export buffer
>> between virtio iGPU and passthrough dGPU. Before that, virtgpu should
>> check if P2P is possible or not. But calling function 
>> pci_p2pdma_distance
>> in guest VM will only get virtual p2pdma_distance instead of real 
>> physical
>> p2pdma_distance.
>>   So this series introduce an implementation of virtgpu device_attach
>> callback to get p2pdma_distance. And also adds a new virtgpu command to
>> pass PCI notations from guest to host and a new xen privcmd to get 
>> physical
>> p2pdma_distance according to the PCI notations in host.
>
> It is hard to review this series without having a clear picture how
> this all is coming together.
>
> I guess the virtgpu frontend will send a p2pdma_distance request to
> the backend, which is running in user mode of dom0. This backend will
> then call into the privcmd driver to obtain the needed information and
> sends it back to the frontend.
>
> Can you please confirm my suspicion is correct?

Yes, you are right.

Julia

>
>
> Juergen