<div dir="ltr">Hey,<div><br></div><div>Understood. Thanks a lot and sorry for any inconvenience.</div><div><br></div><div>Mohamed</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, May 13, 2024 at 11:28 PM Danilo Krummrich <<a href="mailto:dakr@redhat.com">dakr@redhat.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi Mohamed,<br>
<br>
Thank you for fixing this up!<br>
<br>
On 5/9/24 22:43, Mohamed Ahmed wrote:<br>
> Allows PTE kind and tile mode on BO create with VM_BIND,<br>
> and adds a GETPARAM to indicate this change. This is needed to support<br>
<br>
It's usually better to use imperative verb form for commit messages. No<br>
need to send a new version though.<br>
<br>
> modifiers in NVK and ensure correctness when dealing with the nouveau<br>
> GL driver.<br>
> <br>
> The userspace modifiers implementation this is for can be found here:<br>
> <a href="https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24795" rel="noreferrer" target="_blank">https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24795</a><br>
> <br>
> Fixes: b88baab82871 ("drm/nouveau: implement new VM_BIND uAPI")<br>
> Signed-off-by: Mohamed Ahmed <<a href="mailto:mohamedahmedegypt2001@gmail.com" target="_blank">mohamedahmedegypt2001@gmail.com</a>><br>
<br>
Applied to drm-misc-next-fixes.<br>
<br>
Generally, please make sure to use scripts/<a href="http://get_maintainer.pl" rel="noreferrer" target="_blank">get_maintainer.pl</a> before sending<br>
patches.<br>
<br>
- Danilo<br>
<br>
> ---<br>
> drivers/gpu/drm/nouveau/nouveau_abi16.c | 3 ++<br>
> drivers/gpu/drm/nouveau/nouveau_bo.c | 44 +++++++++++--------------<br>
> include/uapi/drm/nouveau_drm.h | 7 ++++<br>
> 3 files changed, 29 insertions(+), 25 deletions(-)<br>
> <br>
> diff --git a/drivers/gpu/drm/nouveau/nouveau_abi16.c b/drivers/gpu/drm/nouveau/nouveau_abi16.c<br>
> index 80f74ee0f..47e53e17b 100644<br>
> --- a/drivers/gpu/drm/nouveau/nouveau_abi16.c<br>
> +++ b/drivers/gpu/drm/nouveau/nouveau_abi16.c<br>
> @@ -272,6 +272,9 @@ nouveau_abi16_ioctl_getparam(ABI16_IOCTL_ARGS)<br>
> getparam->value = (u64)ttm_resource_manager_usage(vram_mgr);<br>
> break;<br>
> }<br>
> + case NOUVEAU_GETPARAM_HAS_VMA_TILEMODE:<br>
> + getparam->value = 1;<br>
> + break;<br>
> default:<br>
> NV_PRINTK(dbg, cli, "unknown parameter %lld\n", getparam->param);<br>
> return -EINVAL;<br>
> diff --git a/drivers/gpu/drm/nouveau/nouveau_bo.c b/drivers/gpu/drm/nouveau/nouveau_bo.c<br>
> index db8cbf615..186add400 100644<br>
> --- a/drivers/gpu/drm/nouveau/nouveau_bo.c<br>
> +++ b/drivers/gpu/drm/nouveau/nouveau_bo.c<br>
> @@ -241,28 +241,28 @@ nouveau_bo_alloc(struct nouveau_cli *cli, u64 *size, int *align, u32 domain,<br>
> }<br>
> <br>
> nvbo->contig = !(tile_flags & NOUVEAU_GEM_TILE_NONCONTIG);<br>
> - if (!nouveau_cli_uvmm(cli) || internal) {<br>
> - /* for BO noVM allocs, don't assign kinds */<br>
> - if (cli->device.info.family >= NV_DEVICE_INFO_V0_FERMI) {<br>
> - nvbo->kind = (tile_flags & 0x0000ff00) >> 8;<br>
> - if (!nvif_mmu_kind_valid(mmu, nvbo->kind)) {<br>
> - kfree(nvbo);<br>
> - return ERR_PTR(-EINVAL);<br>
> - }<br>
> <br>
> - nvbo->comp = mmu->kind[nvbo->kind] != nvbo->kind;<br>
> - } else if (cli->device.info.family >= NV_DEVICE_INFO_V0_TESLA) {<br>
> - nvbo->kind = (tile_flags & 0x00007f00) >> 8;<br>
> - nvbo->comp = (tile_flags & 0x00030000) >> 16;<br>
> - if (!nvif_mmu_kind_valid(mmu, nvbo->kind)) {<br>
> - kfree(nvbo);<br>
> - return ERR_PTR(-EINVAL);<br>
> - }<br>
> - } else {<br>
> - nvbo->zeta = (tile_flags & 0x00000007);<br>
> + if (cli->device.info.family >= NV_DEVICE_INFO_V0_FERMI) {<br>
> + nvbo->kind = (tile_flags & 0x0000ff00) >> 8;<br>
> + if (!nvif_mmu_kind_valid(mmu, nvbo->kind)) {<br>
> + kfree(nvbo);<br>
> + return ERR_PTR(-EINVAL);<br>
> + }<br>
> +<br>
> + nvbo->comp = mmu->kind[nvbo->kind] != nvbo->kind;<br>
> + } else if (cli->device.info.family >= NV_DEVICE_INFO_V0_TESLA) {<br>
> + nvbo->kind = (tile_flags & 0x00007f00) >> 8;<br>
> + nvbo->comp = (tile_flags & 0x00030000) >> 16;<br>
> + if (!nvif_mmu_kind_valid(mmu, nvbo->kind)) {<br>
> + kfree(nvbo);<br>
> + return ERR_PTR(-EINVAL);<br>
> }<br>
> - nvbo->mode = tile_mode;<br>
> + } else {<br>
> + nvbo->zeta = (tile_flags & 0x00000007);<br>
> + }<br>
> + nvbo->mode = tile_mode;<br>
> <br>
> + if (!nouveau_cli_uvmm(cli) || internal) {<br>
> /* Determine the desirable target GPU page size for the buffer. */<br>
> for (i = 0; i < vmm->page_nr; i++) {<br>
> /* Because we cannot currently allow VMM maps to fail<br>
> @@ -304,12 +304,6 @@ nouveau_bo_alloc(struct nouveau_cli *cli, u64 *size, int *align, u32 domain,<br>
> }<br>
> nvbo->page = vmm->page[pi].shift;<br>
> } else {<br>
> - /* reject other tile flags when in VM mode. */<br>
> - if (tile_mode)<br>
> - return ERR_PTR(-EINVAL);<br>
> - if (tile_flags & ~NOUVEAU_GEM_TILE_NONCONTIG)<br>
> - return ERR_PTR(-EINVAL);<br>
> -<br>
> /* Determine the desirable target GPU page size for the buffer. */<br>
> for (i = 0; i < vmm->page_nr; i++) {<br>
> /* Because we cannot currently allow VMM maps to fail<br>
> diff --git a/include/uapi/drm/nouveau_drm.h b/include/uapi/drm/nouveau_drm.h<br>
> index cd84227f1..5402f77ee 100644<br>
> --- a/include/uapi/drm/nouveau_drm.h<br>
> +++ b/include/uapi/drm/nouveau_drm.h<br>
> @@ -68,6 +68,13 @@ extern "C" {<br>
> */<br>
> #define NOUVEAU_GETPARAM_VRAM_USED 19<br>
> <br>
> +/*<br>
> + * NOUVEAU_GETPARAM_HAS_VMA_TILEMODE<br>
> + *<br>
> + * Query whether tile mode and PTE kind are accepted with VM allocs or not.<br>
> + */<br>
> +#define NOUVEAU_GETPARAM_HAS_VMA_TILEMODE 20<br>
> +<br>
> struct drm_nouveau_getparam {<br>
> __u64 param;<br>
> __u64 value;<br>
<br>
</blockquote></div>