Re: [PATCH v3 01/12] drm/bridge: Fix the stop condition of drm_bridge_chain_pre_enable()

2021-04-14 Thread Doug Anderson
Hi, On Sun, Apr 4, 2021 at 5:50 PM Laurent Pinchart wrote: > > Hi Doug, > > Thank you for the patch. > > On Fri, Apr 02, 2021 at 03:28:35PM -0700, Douglas Anderson wrote: > > The drm_bridge_chain_pre_enable() is not the proper opposite of > > drm_bridge_chain_post_disable(). It continues along th

Re: [PATCH v3 12/12] drm/panel: panel-simple: Use runtime pm to avoid excessive unprepare / prepare

2021-04-14 Thread Doug Anderson
Hi, On Wed, Apr 14, 2021 at 5:58 PM Laurent Pinchart wrote: > > Hi Doug, > > Thank you for the patch. > > On Fri, Apr 02, 2021 at 03:28:46PM -0700, Douglas Anderson wrote: > > Unpreparing and re-preparing a panel can be a really heavy > > operation. Panels datasheets often specify something on th

[PATCH 00/34] Add HMM-based SVM memory manager to KFD v5

2021-04-14 Thread Felix Kuehling
Updates since v4: - Rebased on upstream. - Added SPDX license headers and updated copyright on added files - Disabled XNACK on GFXv10 and later GPUs that don't support shader preemption on fault - Updated PTE flags for Aldebaran This series and the corresponding ROCm Thunk and KFDTest changes ar

[PATCH 01/34] drm/amdkfd: helper to convert gpu id and idx

2021-04-14 Thread Felix Kuehling
From: Alex Sierra svm range uses gpu bitmap to store which GPU svm range maps to. Application pass driver gpu id to specify GPU, the helper is needed to convert gpu id to gpu bitmap idx. Access through kfd_process_device pointers array from kfd_process. Signed-off-by: Alex Sierra Reviewed-by:

[PATCH 07/34] drm/amdkfd: validate svm range system memory

2021-04-14 Thread Felix Kuehling
From: Philip Yang Use HMM to get system memory pages address, which will be used to map to GPUs or migrate to vram. Signed-off-by: Philip Yang Reviewed-by: Felix Kuehling Signed-off-by: Felix Kuehling --- drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 116 ++- drivers/gpu/drm

[PATCH 03/34] drm/amdkfd: register svm range

2021-04-14 Thread Felix Kuehling
From: Philip Yang svm range structure stores the range start address, size, attributes, flags, prefetch location and gpu bitmap which indicates which GPU this range maps to. Same virtual address is shared by CPU and GPUs. Process has svm range list which uses both interval tree and list to store

[PATCH 04/34] drm/amdkfd: add svm ioctl GET_ATTR op

2021-04-14 Thread Felix Kuehling
From: Philip Yang Get the intersection of attributes over all memory in the given range Signed-off-by: Philip Yang Signed-off-by: Alex Sierra Reviewed-by: Felix Kuehling Signed-off-by: Felix Kuehling --- drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 164 +++ 1 file changed,

[PATCH 05/34] drm/amdgpu: add common HMM get pages function

2021-04-14 Thread Felix Kuehling
From: Philip Yang Move the HMM get pages function from amdgpu_ttm and to amdgpu_mn. This common function will be used by new svm APIs. Signed-off-by: Philip Yang Reviewed-by: Felix Kuehling Signed-off-by: Felix Kuehling --- drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c | 83 +++

[PATCH 08/34] drm/amdkfd: deregister svm range

2021-04-14 Thread Felix Kuehling
From: Philip Yang When application explicitly call unmap or unmap from mmput when application exit, driver will receive MMU_NOTIFY_UNMAP event to remove svm range from process svms object tree and list first, unmap from GPUs (in the following patch). Split the svm ranges to handle partial unmapp

[PATCH 06/34] drm/amdkfd: support larger svm range allocation

2021-04-14 Thread Felix Kuehling
From: Philip Yang For larger range allocation, if hmm_range_fault return -EBUSY, set retry timeout based on 1 second for every 512MB, this is safe timeout value. Signed-off-by: Philip Yang Reviewed-by: Felix Kuehling Signed-off-by: Felix Kuehling --- drivers/gpu/drm/amd/amdgpu/amdgpu_mn.c |

[PATCH 14/34] drm/amdkfd: add ioctl to configure and query xnack retries

2021-04-14 Thread Felix Kuehling
From: Alex Sierra Xnack retries are used for page fault recovery. Some AMD chip families support continuously retry while page table entries are invalid. The driver must handle the page fault interrupt and fill in a valid entry for the GPU to continue. This ioctl allows to enable/disable XNACK r

[PATCH 11/34] drm/amdkfd: svm range eviction and restore

2021-04-14 Thread Felix Kuehling
HMM interval notifier callback notify CPU page table will be updated, stop process queues if the updated address belongs to svm range registered in process svms objects tree. Scheduled restore work to update GPU page table using new pages address in the updated svm range. The restore worker flushe

[PATCH 15/34] drm/amdkfd: register HMM device private zone

2021-04-14 Thread Felix Kuehling
From: Philip Yang Register vram memory as MEMORY_DEVICE_PRIVATE type resource, to allocate vram backing pages for page migration. Signed-off-by: Philip Yang Reviewed-by: Felix Kuehling Signed-off-by: Felix Kuehling --- drivers/gpu/drm/amd/amdkfd/Kconfig | 2 + drivers/gpu/drm/amd/amd

[PATCH 13/34] drm/amdkfd: add xnack enabled flag to kfd_process

2021-04-14 Thread Felix Kuehling
From: Alex Sierra XNACK mode controls the SQ RETRY_DISABLE setting that determines, whether recoverable page faults can be supported on GFXv9 hardware. Only on Aldebaran we can support different processes running with different XNACK modes. On older chips all processes must use the same RETRY_DIS

[PATCH 09/34] drm/amdgpu: export vm update mapping interface

2021-04-14 Thread Felix Kuehling
From: Philip Yang It will be used by kfd to map svm range to GPU, because svm range does not have amdgpu_bo and bo_va, cannot use amdgpu_bo_update interface, use amdgpu vm update interface directly. Signed-off-by: Philip Yang Reviewed-by: Felix Kuehling Signed-off-by: Felix Kuehling --- driv

[PATCH 19/34] drm/amdkfd: HMM migrate ram to vram

2021-04-14 Thread Felix Kuehling
Register svm range with same address and size but perferred_location is changed from CPU to GPU or from GPU to CPU, trigger migration the svm range from ram to vram or from vram to ram. If svm range prefetch location is GPU with flags KFD_IOCTL_SVM_FLAG_HOST_ACCESS, validate the svm range on ram f

[PATCH 16/34] drm/amdkfd: validate vram svm range from TTM

2021-04-14 Thread Felix Kuehling
If svm range perfetch location is not zero, use TTM to alloc amdgpu_bo vram nodes to validate svm range, then map vram nodes to GPUs. Use offset to sub allocate from the same amdgpu_bo to handle overlap vram range while adding new range or unmapping range. svm_bo has ref count to trace the shared

[PATCH 18/34] drm/amdkfd: copy memory through gart table

2021-04-14 Thread Felix Kuehling
From: Philip Yang Use sdma linear copy to migrate data between ram and vram. The sdma linear copy command uses kernel buffer function queue to access system memory through gart table. Use reserved gart table window 0 to map system page address, and vram page address is direct mapping. Use the sa

[PATCH 17/34] drm/amdkfd: support xgmi same hive mapping

2021-04-14 Thread Felix Kuehling
From: Philip Yang amdgpu_gmc_get_vm_pte use bo_va->is_xgmi same hive information to set pte flags to update GPU mapping. Add local structure variable bo_va, and update bo_va.is_xgmi, pass it to mapping->bo_va while mapping to GPU. Assuming xgmi pstate is hi after boot. Signed-off-by: Philip Yan

[PATCH 24/34] drm/amdkfd: SVM API call to restore page tables

2021-04-14 Thread Felix Kuehling
From: Alex Sierra Use SVM API to restore page tables when retry fault and compute context are enabled. Signed-off-by: Alex Sierra Reviewed-by: Felix Kuehling Signed-off-by: Felix Kuehling --- drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 20 +++- 1 file changed, 15 insertions(+),

[PATCH 23/34] drm/amdkfd: page table restore through svm API

2021-04-14 Thread Felix Kuehling
Page table restore implementation in SVM API. This is called from the fault handler at amdgpu_vm. To update page tables through the page fault retry IH. Signed-off-by: Alex Sierra Signed-off-by: Philip Yang Reviewed-by: Felix Kuehling Signed-off-by: Felix Kuehling --- drivers/gpu/drm/amd/amdk

[PATCH 02/34] drm/amdkfd: add svm ioctl API

2021-04-14 Thread Felix Kuehling
From: Philip Yang Add svm (shared virtual memory) ioctl data structure and API definition. The svm ioctl API is designed to be extensible in the future. All operations are provided by a single IOCTL to preserve ioctl number space. The arguments structure ends with a variable size array of attrib

[PATCH 10/34] drm/amdkfd: map svm range to GPUs

2021-04-14 Thread Felix Kuehling
Use amdgpu_vm_bo_update_mapping to update GPU page table to map or unmap svm range system memory pages address to GPUs. Signed-off-by: Philip Yang Signed-off-by: Alex Sierra Reviewed-by: Felix Kuehling Signed-off-by: Felix Kuehling --- drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 473 ++

[PATCH 21/34] drm/amdkfd: invalidate tables on page retry fault

2021-04-14 Thread Felix Kuehling
GPU page tables are invalidated by unmapping prange directly at the mmu notifier, when page fault retry is enabled through amdgpu_noretry global parameter. The restore page table is performed at the page fault handler. If xnack is on, we update GPU mappings after migration to avoid unnecessary GPU

[PATCH 28/34] drm/amdgpu: svm bo enable_signal call condition

2021-04-14 Thread Felix Kuehling
From: Alex Sierra [why] To support svm bo eviction mechanism. [how] If the BO crated has AMDGPU_AMDKFD_CREATE_SVM_BO flag set, enable_signal callback will be called inside amdgpu_evict_flags. This also causes gutting of the BO by removing all placements, so that TTM won't actually do an eviction

[PATCH 12/34] drm/amdgpu: Enable retry faults unconditionally on Aldebaran

2021-04-14 Thread Felix Kuehling
This is needed to allow per-process XNACK mode selection in the SQ when booting with XNACK off by default. Signed-off-by: Felix Kuehling Reviewed-by: Philip Yang Tested-by: Alex Sierra --- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 3 ++- drivers/gpu/drm/amd/amdgpu/gfxhub_v1_0.c | 8 ++--

[PATCH 20/34] drm/amdkfd: HMM migrate vram to ram

2021-04-14 Thread Felix Kuehling
If CPU page fault happens, HMM pgmap_ops callback migrate_to_ram start migrate memory from vram to ram in steps: 1. migrate_vma_pages get vram pages, and notify HMM to invalidate the pages, HMM interval notifier callback evict process queues 2. Allocate system memory pages 3. Use svm copy memory t

[PATCH 27/34] drm/amdkfd: add svm_bo eviction mechanism support

2021-04-14 Thread Felix Kuehling
svm_bo eviction mechanism is different from regular BOs. Every SVM_BO created contains one eviction fence and one worker item for eviction process. SVM_BOs can be attached to one or more pranges. For SVM_BO eviction mechanism, TTM will start to call enable_signal callback for every SVM_BO until VRA

[PATCH 22/34] drm/amdgpu: enable 48-bit IH timestamp counter

2021-04-14 Thread Felix Kuehling
From: Alex Sierra By default this timestamp is 32 bit counter. It gets overflowed in around 10 minutes. Signed-off-by: Alex Sierra Reviewed-by: Felix Kuehling Signed-off-by: Philip Yang --- drivers/gpu/drm/amd/amdgpu/vega10_ih.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/gpu

[PATCH 26/34] drm/amdgpu: add param bit flag to create SVM BOs

2021-04-14 Thread Felix Kuehling
From: Alex Sierra Add CREATE_SVM_BO define bit for SVM BOs. Another define flag was moved to concentrate these KFD type flags in one include file. Signed-off-by: Alex Sierra Reviewed-by: Felix Kuehling Signed-off-by: Felix Kuehling --- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gpuvm.c | 7 ++-

[PATCH 25/34] drm/amdkfd: add svm_bo reference for eviction fence

2021-04-14 Thread Felix Kuehling
From: Alex Sierra [why] As part of the SVM functionality, the eviction mechanism used for SVM_BOs is different. This mechanism uses one eviction fence per prange, instead of one fence per kfd_process. [how] A svm_bo reference to amdgpu_amdkfd_fence to allow differentiate between SVM_BO or regula

[PATCH 31/34] drm/amdkfd: add svm range validate timestamp

2021-04-14 Thread Felix Kuehling
With xnack on, add validate timestamp in order to handle GPU vm fault from multiple GPUs. If GPU retry fault need migrate the range to the best restore location, use range validate timestamp to record system timestamp after range is restored to update GPU page table. Because multiple pages of sam

[PATCH 29/34] drm/amdgpu: add svm_bo eviction to enable_signal cb

2021-04-14 Thread Felix Kuehling
From: Alex Sierra Add to amdgpu_amdkfd_fence.enable_signal callback, support for svm_bo fence eviction. Signed-off-by: Alex Sierra Reviewed-by: Felix Kuehling Signed-off-by: Felix Kuehling --- drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_fence.c | 11 --- 1 file changed, 8 insertions(+),

[PATCH 34/34] drm/amdkfd: Add CONFIG_HSA_AMD_SVM

2021-04-14 Thread Felix Kuehling
Control whether to build SVM support into amdgpu with a Kconfig option. This makes it easier to disable it in production kernels if this new feature causes problems in production environments. Use "depends on" instead of "select" for DEVICE_PRIVATE, as is recommended for visible options. Reviewed

[PATCH 30/34] drm/amdkfd: refine migration policy with xnack on

2021-04-14 Thread Felix Kuehling
With xnack on, GPU vm fault handler decide the best restore location, then migrate range to the best restore location and update GPU mapping to recover the GPU vm fault. Signed-off-by: Philip Yang Signed-off-by: Alex Sierra Reviewed-by: Felix Kuehling Signed-off-by: Felix Kuehling --- drivers

[PATCH 32/34] drm/amdkfd: multiple gpu migrate vram to vram

2021-04-14 Thread Felix Kuehling
If prefetch range to gpu with acutal location is another gpu, or GPU retry fault restore pages to migrate the range with acutal location is gpu, then migrate from one gpu to another gpu. Use system memory as bridge because sdma engine may not able to access another gpu vram, use sdma of source gpu

[PATCH 33/34] drm/amdkfd: Add SVM API support capability bits

2021-04-14 Thread Felix Kuehling
From: Philip Yang SVMAPISupported property added to HSA_CAPABILITY, the value match HSA_CAPABILITY defined in Thunk spec: SVMAPISupported: it will not be supported on older kernels that don't have HMM or on systems with GFXv8 or older GPUs without support for 48-bit virtual addresses. CoherentH

Re: [PATCH v3 12/12] drm/panel: panel-simple: Use runtime pm to avoid excessive unprepare / prepare

2021-04-14 Thread Laurent Pinchart
Hi Doug, On Wed, Apr 14, 2021 at 06:22:57PM -0700, Doug Anderson wrote: > On Wed, Apr 14, 2021 at 5:58 PM Laurent Pinchart wrote: > > On Fri, Apr 02, 2021 at 03:28:46PM -0700, Douglas Anderson wrote: > > > Unpreparing and re-preparing a panel can be a really heavy > > > operation. Panels datasheet

[PATCH] drm/bridge: Centralize error message when bridge attach fails

2021-04-14 Thread Laurent Pinchart
Being informed of a failure to attach a bridge is useful, and many drivers prints an error message in that case. Move the message to drm_bridge_attach() to avoid code duplication. Suggested-by: Stephen Boyd Signed-off-by: Laurent Pinchart --- drivers/gpu/drm/bridge/analogix/analogix_dp_core.c |

Re: [PATCH v3 01/12] drm/bridge: Fix the stop condition of drm_bridge_chain_pre_enable()

2021-04-14 Thread Laurent Pinchart
Hi Doug, On Wed, Apr 14, 2021 at 06:19:13PM -0700, Doug Anderson wrote: > On Sun, Apr 4, 2021 at 5:50 PM Laurent Pinchart wrote: > > On Fri, Apr 02, 2021 at 03:28:35PM -0700, Douglas Anderson wrote: > > > The drm_bridge_chain_pre_enable() is not the proper opposite of > > > drm_bridge_chain_post_d

[PATCH v2 1/3] drm/amdkfd: Use drm_priv to pass VM from KFD to amdgpu

2021-04-14 Thread Felix Kuehling
amdgpu_amdkfd_gpuvm_alloc_memory_of_gpu needs the drm_priv to allow mmap to access the BO through the corresponding file descriptor. The VM can also be extracted from drm_priv, so drm_priv can replace the vm parameter in the kfd2kgd interface. Signed-off-by: Felix Kuehling --- drivers/gpu/drm/am

[PATCH v2 3/3] drm/amdgpu: Remove verify_access shortcut for KFD BOs

2021-04-14 Thread Felix Kuehling
This shortcut is no longer needed with access managed properly by KFD. Signed-off-by: Felix Kuehling Reviewed-by: Philip Yang --- drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 7 --- 1 file changed, 7 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c b/drivers/gpu/drm/amd/amdg

[PATCH v2 2/3] drm/amdkfd: Allow access for mmapping KFD BOs

2021-04-14 Thread Felix Kuehling
DRM render node file handles are used for CPU mapping of BOs using mmap by the Thunk. It uses the DRM render node of the GPU where the BO was allocated. DRM allows mmap access automatically when it creates a GEM handle for a BO. KFD BOs don't have GEM handles, so KFD needs to manage access manuall

Re: [PATCH v4 2/3] drm/msm: add support to take dpu snapshot

2021-04-14 Thread Rob Clark
On Wed, Apr 14, 2021 at 5:16 PM Dmitry Baryshkov wrote: > > On 15/04/2021 02:11, Abhinav Kumar wrote: > > Add the msm_disp_snapshot module which adds supports to dump dpu > > registers and capture the drm atomic state which can be used in > > case of error conditions. > > > > changes in v4: > >

Re: [PATCH] drm/bridge: Centralize error message when bridge attach fails

2021-04-14 Thread Tomi Valkeinen
On 15/04/2021 04:47, Laurent Pinchart wrote: Being informed of a failure to attach a bridge is useful, and many drivers prints an error message in that case. Move the message to drm_bridge_attach() to avoid code duplication. Suggested-by: Stephen Boyd Signed-off-by: Laurent Pinchart --- driv

Re: [PATCH 16/18] drm/vc4: hdmi: Support HDMI YUV output

2021-04-14 Thread Thomas Zimmermann
Am 17.03.21 um 16:43 schrieb Maxime Ripard: The HDMI controllers in the BCM2711 support YUV444 and YUV420 outputs, let's add support for it. Signed-off-by: Maxime Ripard --- drivers/gpu/drm/vc4/vc4_hdmi.c | 73 +++-- drivers/gpu/drm/vc4/vc4_hdmi_regs.h | 6 +++

linux-next: manual merge of the vfio tree with the drm tree

2021-04-14 Thread Stephen Rothwell
Hi all, Today's linux-next merge of the vfio tree got a conflict in: drivers/gpu/drm/i915/gvt/gvt.c between commit: 9ff06c385300 ("drm/i915/gvt: Remove references to struct drm_device.pdev") from the drm tree and commit: 383987fd15ba ("vfio/gvt: Use mdev_get_type_group_id()") from the

Re: [PATCH v2 04/10] drm/aperture: Add infrastructure for aperture ownership

2021-04-14 Thread Thomas Zimmermann
Hi Am 09.04.21 um 11:22 schrieb Daniel Vetter: Is it that easy? simepldrm's detach function has code to synchronize with concurrent hotplug removals. If we can use drm_dev_unplug() for everything, I'm all for it. Uh, I should have looked at the code instead of just asking silly questions :-)

<    1   2