mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Huang, Honglei" <honghuan@amd.com>
To: Dmitry Osipenko <dmitry.osipenko@collabora.com>
Cc: gurchetansingh@chromium.org, olvaffe@gmail.com,
	Ray.Huang@amd.com, dri-devel@lists.freedesktop.org,
	virtualization@lists.linux.dev, linux-kernel@vger.kernel.org,
	odaki@rsg.ci.i.u-tokyo.ac.jp, airlied@redhat.com,
	kraxel@redhat.com
Subject: Re: [RFC PATCH v9 3/4] drm/virtio: implement userptr resource support
Date: Tue, 13 Oct 2026 13:32:28 +0800	[thread overview]
Message-ID: <317cc6e9-8e15-462d-9e9c-2657011b7128@amd.com> (raw)
In-Reply-To: <efd5fa89-e888-469a-ac80-e6e605f9a015@collabora.com>



On 10/10/2026 8:50 PM, Dmitry Osipenko wrote:
> On 10/10/26 10:37, Huang, Honglei wrote:
>>
>>
>> On 10/10/2026 2:53 AM, Dmitry Osipenko wrote:
>>> 24.09.2026 12:55, Honglei Huang пишет:
>>>> +int virtio_gpu_userptr_create(struct virtio_gpu_device *vgdev,
>>>> +                  struct drm_file *file,
>>>> +                  struct virtio_gpu_object_params *params,
>>>> +                  struct virtio_gpu_object **bo_ptr)
>>>> +{
>>>> +    struct virtio_gpu_object_userptr *userptr;
>>>> +    struct virtio_gpu_mem_entry *ents = NULL;
>>>> +    struct sg_table *sgt;
>>>> +    struct mm_struct *mm;
>>>> +    unsigned long lock_limit;
>>>> +    unsigned long start;
>>>> +    unsigned long end;
>>>> +    s64 new_pinned;
>>>> +    unsigned int nents;
>>>> +    int ret;
>>>> +
>>>> +    *bo_ptr = NULL;
>>>> +
>>>> +    if (!params->size || !IS_ALIGNED(params->size, PAGE_SIZE) ||
>>>> +        params->userptr != (unsigned long)params->userptr)
>>>> +        return -EINVAL;
>>>> +
>>>> +    start = params->userptr;
>>>> +    if (!IS_ALIGNED(start, PAGE_SIZE) ||
>>>> +        check_add_overflow(start, (unsigned long)params->size, &end))
>>>> +        return -EINVAL;
>>>
>>> There is new vgdev->blob_alignment defining host page size as it may
>>> differ from guest's page. Will be good to validate both.
>>>
>>
>> Will add blob_alignment check in next version, thanks for the review.
> Missed that verify_blob() already should be validating the userptr
> blob_alignment. The patches look good.
> 
> BTW, previously the extra AMD KFD patches were needed on host kernel,
> did they land upstream?

According to KFD maintainer, they want to us to add those virtio 
specific feature into drm svm, a new SVM frame work based on drm svm 
helpers. We are working on it:
https://lore.kernel.org/amd-gfx/20260804094246.1719318-1-ray.huang@amd.com/

And the amdgpu VM maintainer has agreed that he will help to consider 
how to intergate the virtio requirements into the design of amdgpu drmsvm.

And for now we can use a user space method to replace the AMD KFD 
patches function, it is mremap, it also works, we tested it, but
it has some performance loss, I will update the whole thing when all the 
components code are ready.

Regards,
Honglei


> 


  reply	other threads:[~2026-10-13  5:32 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-24  9:55 [RFC PATCH v9 0/4] virtio-gpu: Add userptr support for compute workloads Honglei Huang
2026-09-24  9:55 ` [RFC PATCH v9 1/4] drm/virtio-gpu: Add VIRTIO_GPU_CAPSET_ROCM capability Honglei Huang
2026-09-24  9:55 ` [RFC PATCH v9 2/4] drm/virtgpu api: add blob userptr resource Honglei Huang
2026-09-24  9:55 ` [RFC PATCH v9 3/4] drm/virtio: implement userptr resource support Honglei Huang
2026-09-26 11:33   ` Akihiko Odaki
2026-09-28 16:22     ` Huang, Honglei
2026-09-28 17:25       ` Akihiko Odaki
2026-09-29  2:22         ` Huang, Honglei
2026-09-30  4:56           ` Akihiko Odaki
2026-09-30 13:32             ` Huang, Honglei
2026-10-09 18:32   ` Dmitry Osipenko
2026-10-10  7:36     ` Huang, Honglei
2026-10-09 18:38   ` Dmitry Osipenko
2026-10-09 18:46     ` Dmitry Osipenko
2026-10-10  7:36       ` Huang, Honglei
2026-10-09 18:53   ` Dmitry Osipenko
2026-10-10  7:37     ` Huang, Honglei
2026-10-10 12:50       ` Dmitry Osipenko
2026-10-13  5:32         ` Huang, Honglei [this message]
2026-10-13 22:12           ` Dmitry Osipenko
2026-09-24  9:55 ` [RFC PATCH v9 4/4] drm/virtio: wire blob ioctl creation to userptr objects Honglei Huang
2026-09-27  1:04   ` Akihiko Odaki
2026-09-28 16:23     ` Huang, Honglei

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=317cc6e9-8e15-462d-9e9c-2657011b7128@amd.com \
    --to=honghuan@amd.com \
    --cc=Ray.Huang@amd.com \
    --cc=airlied@redhat.com \
    --cc=dmitry.osipenko@collabora.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gurchetansingh@chromium.org \
    --cc=kraxel@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=odaki@rsg.ci.i.u-tokyo.ac.jp \
    --cc=olvaffe@gmail.com \
    --cc=virtualization@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®