Re: [PATCH v3 2/2] drm/amdgpu: update kernel vcn ring test
On 2023-07-10 16:19, Liu, Leo wrote: [AMD Official Use Only - General] [AMD Official Use Only - General] -Original Message- From: Jamadar, Saleemkhan Sent: Monday, July 10, 2023 12:54 PM To: Jamadar, Saleemkhan ; amd-gfx@lists.freedesktop.org; Liu, Leo ; Gopalakrishnan, Veerabadhran (Veera) ; Sundararaju, Sathishkumar Cc: Koenig, Christian ; Rao, Srinath Subject: [PATCH v3 2/2] drm/amdgpu: update kernel vcn ring test add session context buffer to decoder ring test fro vcn v1 to v3. v3 - correct the cmd for sesssion ctx buf v2 - add the buffer into IB (Leo liu) Signed-off-by: Saleemkhan Jamadar --- drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 14 ++ 1 file changed, 14 insertions(+) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c index 76e9a2418286..4ee5f933e420 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c @@ -521,6 +521,7 @@ static int amdgpu_vcn_dec_send_msg(struct amdgpu_ring *ring, struct dma_fence **fence) { u64 addr = AMDGPU_GPU_PAGE_ALIGN(ib_msg->gpu_addr); + uint64_t session_ctx_buf_gaddr = AMDGPU_GPU_PAGE_ALIGN(ib_msg->gpu_addr + 8192); struct amdgpu_device *adev = ring->adev; struct dma_fence *f = NULL; struct amdgpu_job *job; @@ -546,6 +547,19 @@ static int amdgpu_vcn_dec_send_msg(struct amdgpu_ring *ring, } ib->length_dw = 16; This line above can be removed. With that the patch is: Reviewed-by: Leo Liu I think we should rework the lines above of this line for msg buffer, put the session ctx buffer right behind it, and no need fill the nop command in between, so make the code cleaner. Regards, Leo + ib->ptr[ib->length_dw++] = PACKET0(adev->vcn.internal.data0, 0); + ib->ptr[ib->length_dw++] = lower_32_bits(session_ctx_buf_gaddr); + ib->ptr[ib->length_dw++] = PACKET0(adev->vcn.internal.data1, 0); + ib->ptr[ib->length_dw++] = upper_32_bits(session_ctx_buf_gaddr); + /* session ctx buffer cmd */ + ib->ptr[ib->length_dw++] = PACKET0(adev->vcn.internal.cmd, 0xa); + ib->ptr[ib->length_dw++] = 0; + for (i = ib->length_dw; i < 32; i += 2) { + ib->ptr[i] = PACKET0(adev->vcn.internal.nop, 0); + ib->ptr[i+1] = 0; + } + ib->length_dw = 32; + r = amdgpu_job_submit_direct(job, ring, ); if (r) goto err_free; -- 2.25.1
[PATCH v3] drm/amdgpu/vkms: relax timer deactivation by hrtimer_try_to_cancel
In below thousands of screen rotation loop tests with virtual display enabled, a CPU hard lockup issue may happen, leading system to unresponsive and crash. do { xrandr --output Virtual --rotate inverted xrandr --output Virtual --rotate right xrandr --output Virtual --rotate left xrandr --output Virtual --rotate normal } while (1); NMI watchdog: Watchdog detected hard LOCKUP on cpu 1 ? hrtimer_run_softirq+0x140/0x140 ? store_vblank+0xe0/0xe0 [drm] hrtimer_cancel+0x15/0x30 amdgpu_vkms_disable_vblank+0x15/0x30 [amdgpu] drm_vblank_disable_and_save+0x185/0x1f0 [drm] drm_crtc_vblank_off+0x159/0x4c0 [drm] ? record_print_text.cold+0x11/0x11 ? wait_for_completion_timeout+0x232/0x280 ? drm_crtc_wait_one_vblank+0x40/0x40 [drm] ? bit_wait_io_timeout+0xe0/0xe0 ? wait_for_completion_interruptible+0x1d7/0x320 ? mutex_unlock+0x81/0xd0 amdgpu_vkms_crtc_atomic_disable It's caused by a stuck in lock dependency in such scenario on different CPUs. CPU1 CPU2 drm_crtc_vblank_off hrtimer_interrupt grab event_lock (irq disabled) __hrtimer_run_queues grab vbl_lock/vblank_time_block amdgpu_vkms_vblank_simulate amdgpu_vkms_disable_vblank drm_handle_vblank hrtimer_cancel grab dev->event_lock So CPU1 stucks in hrtimer_cancel as timer callback is running endless on current clock base, as that timer queue on CPU2 has no chance to finish it because of failing to hold the lock. So NMI watchdog will throw the errors after its threshold, and all later CPUs are impacted/blocked. So use hrtimer_try_to_cancel to fix this, as disable_vblank callback does not need to wait the handler to finish. And also it's not necessary to check the return value of hrtimer_try_to_cancel, because even if it's -1 which means current timer callback is running, it will be reprogrammed in hrtimer_start with calling enable_vblank to make it works. v2: only re-arm timer when vblank is enabled (Christian) and add a Fixes tag as well v3: drop warn printing (Christian) Fixes: 84ec374bd580("drm/amdgpu: create amdgpu_vkms (v4)") Cc: sta...@vger.kernel.org Suggested-by: Christian König Signed-off-by: Guchun Chen --- drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c | 13 ++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c index 53ff91fc6cf6..b870c827cbaa 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c @@ -46,7 +46,10 @@ static enum hrtimer_restart amdgpu_vkms_vblank_simulate(struct hrtimer *timer) struct amdgpu_crtc *amdgpu_crtc = container_of(timer, struct amdgpu_crtc, vblank_timer); struct drm_crtc *crtc = _crtc->base; struct amdgpu_vkms_output *output = drm_crtc_to_amdgpu_vkms_output(crtc); + struct drm_vblank_crtc *vblank; + struct drm_device *dev; u64 ret_overrun; + unsigned int pipe; bool ret; ret_overrun = hrtimer_forward_now(_crtc->vblank_timer, @@ -54,9 +57,13 @@ static enum hrtimer_restart amdgpu_vkms_vblank_simulate(struct hrtimer *timer) if (ret_overrun != 1) DRM_WARN("%s: vblank timer overrun\n", __func__); + dev = crtc->dev; + pipe = drm_crtc_index(crtc); + vblank = >vblank[pipe]; ret = drm_crtc_handle_vblank(crtc); - if (!ret) - DRM_ERROR("amdgpu_vkms failure on handling vblank"); + /* Don't queue timer again when vblank is disabled. */ + if (!ret && !READ_ONCE(vblank->enabled)) + return HRTIMER_NORESTART; return HRTIMER_RESTART; } @@ -81,7 +88,7 @@ static void amdgpu_vkms_disable_vblank(struct drm_crtc *crtc) { struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); - hrtimer_cancel(_crtc->vblank_timer); + hrtimer_try_to_cancel(_crtc->vblank_timer); } static bool amdgpu_vkms_get_vblank_timestamp(struct drm_crtc *crtc, -- 2.25.1
RE: [PATCH v2] drm/amdgpu/vkms: relax timer deactivation by hrtimer_try_to_cancel
[Public] > -Original Message- > From: Koenig, Christian > Sent: Monday, July 10, 2023 6:16 PM > To: Chen, Guchun ; amd- > g...@lists.freedesktop.org; Deucher, Alexander > ; Zhang, Hawking > ; Milinkovic, Dusica > ; Prica, Nikola ; Cui, > Flora > Cc: sta...@vger.kernel.org > Subject: Re: [PATCH v2] drm/amdgpu/vkms: relax timer deactivation by > hrtimer_try_to_cancel > > > > Am 10.07.23 um 08:38 schrieb Guchun Chen: > > In below thousands of screen rotation loop tests with virtual display > > enabled, a CPU hard lockup issue may happen, leading system to > > unresponsive and crash. > > > > do { > > xrandr --output Virtual --rotate inverted > > xrandr --output Virtual --rotate right > > xrandr --output Virtual --rotate left > > xrandr --output Virtual --rotate normal } while (1); > > > > NMI watchdog: Watchdog detected hard LOCKUP on cpu 1 > > > > ? hrtimer_run_softirq+0x140/0x140 > > ? store_vblank+0xe0/0xe0 [drm] > > hrtimer_cancel+0x15/0x30 > > amdgpu_vkms_disable_vblank+0x15/0x30 [amdgpu] > > drm_vblank_disable_and_save+0x185/0x1f0 [drm] > > drm_crtc_vblank_off+0x159/0x4c0 [drm] > > ? record_print_text.cold+0x11/0x11 > > ? wait_for_completion_timeout+0x232/0x280 > > ? drm_crtc_wait_one_vblank+0x40/0x40 [drm] ? > > bit_wait_io_timeout+0xe0/0xe0 ? > > wait_for_completion_interruptible+0x1d7/0x320 > > ? mutex_unlock+0x81/0xd0 > > amdgpu_vkms_crtc_atomic_disable > > > > It's caused by a stuck in lock dependency in such scenario on > > different CPUs. > > > > CPU1 CPU2 > > drm_crtc_vblank_off hrtimer_interrupt > > grab event_lock (irq disabled) __hrtimer_run_queues > > grab vbl_lock/vblank_time_block > amdgpu_vkms_vblank_simulate > > amdgpu_vkms_disable_vblank > > drm_handle_vblank > > hrtimer_cancel grab > > dev->event_lock > > > > So CPU1 stucks in hrtimer_cancel as timer callback is running endless > > on current clock base, as that timer queue on CPU2 has no chance to > > finish it because of failing to hold the lock. So NMI watchdog will > > throw the errors after its threshold, and all later CPUs are > impacted/blocked. > > > > So use hrtimer_try_to_cancel to fix this, as disable_vblank callback > > does not need to wait the handler to finish. And also it's not > > necessary to check the return value of hrtimer_try_to_cancel, because > > even if it's > > -1 which means current timer callback is running, it will be > > reprogrammed in hrtimer_start with calling enable_vblank to make it works. > > > > v2: only re-arm timer when vblank is enabled (Christian) and add a > > Fixes tag as well > > > > Fixes: 84ec374bd580("drm/amdgpu: create amdgpu_vkms (v4)") > > Cc: sta...@vger.kernel.org > > Suggested-by: Christian König > > Signed-off-by: Guchun Chen > > --- > > drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c | 15 --- > > 1 file changed, 12 insertions(+), 3 deletions(-) > > > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c > > b/drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c > > index 53ff91fc6cf6..44d704306f44 100644 > > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c > > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c > > @@ -46,7 +46,10 @@ static enum hrtimer_restart > amdgpu_vkms_vblank_simulate(struct hrtimer *timer) > > struct amdgpu_crtc *amdgpu_crtc = container_of(timer, struct > amdgpu_crtc, vblank_timer); > > struct drm_crtc *crtc = _crtc->base; > > struct amdgpu_vkms_output *output = > > drm_crtc_to_amdgpu_vkms_output(crtc); > > + struct drm_vblank_crtc *vblank; > > + struct drm_device *dev; > > u64 ret_overrun; > > + unsigned int pipe; > > bool ret; > > > > ret_overrun = hrtimer_forward_now(_crtc->vblank_timer, > > @@ -54,9 +57,15 @@ static enum hrtimer_restart > amdgpu_vkms_vblank_simulate(struct hrtimer *timer) > > if (ret_overrun != 1) > > DRM_WARN("%s: vblank timer overrun\n", __func__); > > > > + dev = crtc->dev; > > + pipe = drm_crtc_index(crtc); > > + vblank = >vblank[pipe]; > > ret = drm_crtc_handle_vblank(crtc); > > - if (!ret) > > - DRM_ERROR("amdgpu_vkms failure on handling vblank"); > > + if (!ret && !READ_ONCE(vblank->enabled)) { > > + /* Don't queue timer again when vblank is disabled. */ > > + DRM_WARN("amdgpu_vkms failure on handling vblank\n"); > > You should probably only print the warning when really an error happened. > > Disabling the vblank and not firing the timer again is a perfectly normal > operation. > > Apart from that looks good to me, > Christian. Thanks for your comment, Christian. Then I think I can drop the printing, as drm_crtc_handle_vblank have two return cases, one is false when vblank is disabled, and the other is always true. I will fix this in patch v3. Regards, Guchun > > + return HRTIMER_NORESTART; > > + } > > > >
Re: [PATCH] drm/amdkfd: enable grace period for xcp instance
OK. Mukul, I will resend this patch based on top of yours. Regards, Eric On 2023-07-10 18:24, Joshi, Mukul wrote: [AMD Official Use Only - General] -Original Message- From: amd-gfx On Behalf Of Eric Huang Sent: Monday, July 10, 2023 3:46 PM To: amd-gfx@lists.freedesktop.org Cc: Huang, JinHuiEric ; Kim, Jonathan Subject: [PATCH] drm/amdkfd: enable grace period for xcp instance Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding. Read/write grace period from/to first xcc instance of xcp in kfd node. Hi Eric, My patch, "drm/amdkfd: Update CWSR grace period for GFX9.4.3", which got missed during the merge should handle most of what you are trying to do. I will push that patch. Please add on top if there is anything missing. Hope that works for you. Thanks, Mukul Signed-off-by: Eric Huang --- drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c | 11 --- drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.h | 2 +- drivers/gpu/drm/amd/amdkfd/kfd_packet_manager_v9.c| 10 +++--- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c index de83eccdd9de..a95bcb91dc09 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c @@ -1619,10 +1619,15 @@ static int initialize_cpsch(struct device_queue_manager *dqm) init_sdma_bitmaps(dqm); - if (dqm->dev->kfd2kgd->get_iq_wait_times) + if (dqm->dev->kfd2kgd->get_iq_wait_times) { + u32 inst = ffs(dqm->dev->xcc_mask & + (1UL << + dqm->dev->xcp->id * + dqm->dev->adev->gfx.num_xcc_per_xcp)) - + 1; dqm->dev->kfd2kgd->get_iq_wait_times(dqm->dev->adev, - >wait_times, - 0); + >wait_times[inst], + inst); + } return 0; } diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.h b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.h index 7dd4b177219d..45959c33b944 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.h +++ b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.h @@ -262,7 +262,7 @@ struct device_queue_manager { /* used for GFX 9.4.3 only */ uint32_tcurrent_logical_xcc_start; - uint32_twait_times; + uint32_twait_times[MAX_XCP]; wait_queue_head_t destroy_wait; }; diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_packet_manager_v9.c b/drivers/gpu/drm/amd/amdkfd/kfd_packet_manager_v9.c index 8fda16e6fee6..dd50164c16cd 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_packet_manager_v9.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_packet_manager_v9.c @@ -292,17 +292,21 @@ static int pm_set_grace_period_v9(struct packet_manager *pm, struct pm4_mec_write_data_mmio *packet; uint32_t reg_offset = 0; uint32_t reg_data = 0; + uint32_t inst = ffs(pm->dqm->dev->xcc_mask & + (1UL << + pm->dqm->dev->xcp->id * + pm->dqm->dev->adev->gfx.num_xcc_per_xcp)) - + 1; pm->dqm->dev->kfd2kgd->build_grace_period_packet_info( pm->dqm->dev->adev, - pm->dqm->wait_times, + pm->dqm->wait_times[inst], grace_period, _offset, _data, - 0); + inst); if (grace_period == USE_DEFAULT_GRACE_PERIOD) - reg_data = pm->dqm->wait_times; + reg_data = pm->dqm->wait_times[inst]; packet = (struct pm4_mec_write_data_mmio *)buffer; memset(buffer, 0, sizeof(struct pm4_mec_write_data_mmio)); -- 2.34.1
RE: [PATCH] drm/amdkfd: enable grace period for xcp instance
[AMD Official Use Only - General] > -Original Message- > From: amd-gfx On Behalf Of Eric > Huang > Sent: Monday, July 10, 2023 3:46 PM > To: amd-gfx@lists.freedesktop.org > Cc: Huang, JinHuiEric ; Kim, Jonathan > > Subject: [PATCH] drm/amdkfd: enable grace period for xcp instance > > Caution: This message originated from an External Source. Use proper caution > when opening attachments, clicking links, or responding. > > > Read/write grace period from/to first xcc instance of xcp in kfd node. > Hi Eric, My patch, "drm/amdkfd: Update CWSR grace period for GFX9.4.3", which got missed during the merge should handle most of what you are trying to do. I will push that patch. Please add on top if there is anything missing. Hope that works for you. Thanks, Mukul > Signed-off-by: Eric Huang > --- > drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c | 11 > --- drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.h | > 2 +- > drivers/gpu/drm/amd/amdkfd/kfd_packet_manager_v9.c| 10 +++--- > 3 files changed, 16 insertions(+), 7 deletions(-) > > diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c > b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c > index de83eccdd9de..a95bcb91dc09 100644 > --- a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c > +++ b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c > @@ -1619,10 +1619,15 @@ static int initialize_cpsch(struct > device_queue_manager *dqm) > > init_sdma_bitmaps(dqm); > > - if (dqm->dev->kfd2kgd->get_iq_wait_times) > + if (dqm->dev->kfd2kgd->get_iq_wait_times) { > + u32 inst = ffs(dqm->dev->xcc_mask & > + (1UL << > + dqm->dev->xcp->id * > + dqm->dev->adev->gfx.num_xcc_per_xcp)) - > + 1; > dqm->dev->kfd2kgd->get_iq_wait_times(dqm->dev->adev, > - >wait_times, > - 0); > + >wait_times[inst], > + inst); > + } > return 0; > } > > diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.h > b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.h > index 7dd4b177219d..45959c33b944 100644 > --- a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.h > +++ b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.h > @@ -262,7 +262,7 @@ struct device_queue_manager { > /* used for GFX 9.4.3 only */ > uint32_tcurrent_logical_xcc_start; > > - uint32_twait_times; > + uint32_twait_times[MAX_XCP]; > > wait_queue_head_t destroy_wait; > }; > diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_packet_manager_v9.c > b/drivers/gpu/drm/amd/amdkfd/kfd_packet_manager_v9.c > index 8fda16e6fee6..dd50164c16cd 100644 > --- a/drivers/gpu/drm/amd/amdkfd/kfd_packet_manager_v9.c > +++ b/drivers/gpu/drm/amd/amdkfd/kfd_packet_manager_v9.c > @@ -292,17 +292,21 @@ static int pm_set_grace_period_v9(struct > packet_manager *pm, > struct pm4_mec_write_data_mmio *packet; > uint32_t reg_offset = 0; > uint32_t reg_data = 0; > + uint32_t inst = ffs(pm->dqm->dev->xcc_mask & > + (1UL << > + pm->dqm->dev->xcp->id * > + pm->dqm->dev->adev->gfx.num_xcc_per_xcp)) - > + 1; > > pm->dqm->dev->kfd2kgd->build_grace_period_packet_info( > pm->dqm->dev->adev, > - pm->dqm->wait_times, > + pm->dqm->wait_times[inst], > grace_period, > _offset, > _data, > - 0); > + inst); > > if (grace_period == USE_DEFAULT_GRACE_PERIOD) > - reg_data = pm->dqm->wait_times; > + reg_data = pm->dqm->wait_times[inst]; > > packet = (struct pm4_mec_write_data_mmio *)buffer; > memset(buffer, 0, sizeof(struct pm4_mec_write_data_mmio)); > -- > 2.34.1
[PATCH] drm/amdkfd: Update CWSR grace period for GFX9.4.3
For GFX9.4.3, setup a reduced default CWSR grace period equal to 1000 cycles instead of 64000 cycles. Signed-off-by: Mukul Joshi Reviewed-by: Felix Kuehling --- .../gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c | 2 +- .../drm/amd/amdkfd/kfd_device_queue_manager.c | 22 ++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c index 7b1eea493377..28963726bc97 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd_gfx_v9.c @@ -1109,7 +1109,7 @@ void kgd_gfx_v9_build_grace_period_packet_info(struct amdgpu_device *adev, *reg_data = wait_times; /* -* The CP cannont handle a 0 grace period input and will result in +* The CP cannot handle a 0 grace period input and will result in * an infinite grace period being set so set to 1 to prevent this. */ if (grace_period == 0) diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c index de83eccdd9de..31cac1fd0d58 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c @@ -1622,7 +1622,7 @@ static int initialize_cpsch(struct device_queue_manager *dqm) if (dqm->dev->kfd2kgd->get_iq_wait_times) dqm->dev->kfd2kgd->get_iq_wait_times(dqm->dev->adev, >wait_times, - 0); + ffs(dqm->dev->xcc_mask) - 1); return 0; } @@ -1664,6 +1664,26 @@ static int start_cpsch(struct device_queue_manager *dqm) if (!dqm->dev->kfd->shared_resources.enable_mes) execute_queues_cpsch(dqm, KFD_UNMAP_QUEUES_FILTER_DYNAMIC_QUEUES, 0, USE_DEFAULT_GRACE_PERIOD); + + /* Set CWSR grace period to 1x1000 cycle for GFX9.4.3 APU */ + if (amdgpu_emu_mode == 0 && dqm->dev->adev->gmc.is_app_apu && + (KFD_GC_VERSION(dqm->dev) == IP_VERSION(9, 4, 3))) { + uint32_t reg_offset = 0; + uint32_t grace_period = 1; + + retval = pm_update_grace_period(>packet_mgr, + grace_period); + if (retval) + pr_err("Setting grace timeout failed\n"); + else if (dqm->dev->kfd2kgd->build_grace_period_packet_info) + /* Update dqm->wait_times maintained in software */ + dqm->dev->kfd2kgd->build_grace_period_packet_info( + dqm->dev->adev, dqm->wait_times, + grace_period, _offset, + >wait_times, + ffs(dqm->dev->xcc_mask) - 1); + } + dqm_unlock(dqm); return 0; -- 2.35.1
Re: [PATCH] drm/client: Send hotplug event after registering a client
On 10/07/2023 12:10, Thomas Zimmermann wrote: Generate a hotplug event after registering a client to allow the client to configure its display. Remove the hotplug calls from the existing clients for fbdev emulation. This change fixes a concurrency bug between registering a client and receiving events from the DRM core. The bug is present in the fbdev emulation of all drivers. The fbdev emulation currently generates a hotplug event before registering the client to the device. For each new output, the DRM core sends an additional hotplug event to each registered client. If the DRM core detects first output between sending the artificial hotplug and registering the device, the output's hotplug event gets lost. If this is the first output, the fbdev console display remains dark. This has been observed with amdgpu and fbdev-generic. Fix this by adding hotplug generation directly to the client's register helper drm_client_register(). Registering the client and receiving events are serialized by struct drm_device.clientlist_mutex. So an output is either configured by the initial hotplug event, or the client has already been registered. The bug was originally added in commit 6e3f17ee73f7 ("drm/fb-helper: generic: Call drm_client_add() after setup is done"), in which adding a client and receiving a hotplug event switched order. It was hidden, as most hardware and drivers have at least on static output configured. Other drivers didn't use the internal DRM client or still had struct drm_mode_config_funcs.output_poll_changed set. That callback handled hotplug events as well. After not setting the callback in amdgpu in commit 0e3172bac3f4 ("drm/amdgpu: Don't set struct drm_driver.output_poll_changed"), amdgpu did not show a framebuffer console if output events got lost. The bug got copy-pasted from fbdev-generic into the other fbdev emulation. Reported-by: Moritz Duge Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/2649 Fixes: 6e3f17ee73f7 ("drm/fb-helper: generic: Call drm_client_add() after setup is done") Fixes: 8ab59da26bc0 ("drm/fb-helper: Move generic fbdev emulation into separate source file") Fixes: b79fe9abd58b ("drm/fbdev-dma: Implement fbdev emulation for GEM DMA helpers") Fixes: 63c381552f69 ("drm/armada: Implement fbdev emulation as in-kernel client") Fixes: 49953b70e7d3 ("drm/exynos: Implement fbdev emulation as in-kernel client") Fixes: 8f1aaccb04b7 ("drm/gma500: Implement client-based fbdev emulation") Fixes: 940b869c2f2f ("drm/msm: Implement fbdev emulation as in-kernel client") Fixes: 9e69bcd88e45 ("drm/omapdrm: Implement fbdev emulation as in-kernel client") Fixes: e317a69fe891 ("drm/radeon: Implement client-based fbdev emulation") Fixes: 71ec16f45ef8 ("drm/tegra: Implement fbdev emulation as in-kernel client") Signed-off-by: Thomas Zimmermann Tested-by: Moritz Duge Tested-by: Torsten Krah Tested-by: Paul Schyska Cc: Daniel Vetter Cc: David Airlie Cc: Noralf Trønnes Cc: Maarten Lankhorst Cc: Maxime Ripard Cc: Javier Martinez Canillas Cc: Russell King Cc: Inki Dae Cc: Seung-Woo Kim Cc: Kyungmin Park Cc: Krzysztof Kozlowski Cc: Patrik Jakobsson Cc: Rob Clark Cc: Abhinav Kumar Cc: Dmitry Baryshkov Cc: Tomi Valkeinen Cc: Alex Deucher Cc: "Christian König" Cc: "Pan, Xinhui" Cc: Thierry Reding Cc: Mikko Perttunen Cc: dri-de...@lists.freedesktop.org Cc: linux-ker...@vger.kernel.org Cc: linux-arm-ker...@lists.infradead.org Cc: linux-samsung-...@vger.kernel.org Cc: linux-arm-...@vger.kernel.org Cc: freedr...@lists.freedesktop.org Cc: amd-gfx@lists.freedesktop.org Cc: linux-te...@vger.kernel.org Cc: dri-de...@lists.freedesktop.org Cc: # v5.2+ --- drivers/gpu/drm/armada/armada_fbdev.c | 4 drivers/gpu/drm/drm_client.c | 21 + drivers/gpu/drm/drm_fbdev_dma.c | 4 drivers/gpu/drm/drm_fbdev_generic.c | 4 drivers/gpu/drm/exynos/exynos_drm_fbdev.c | 4 drivers/gpu/drm/gma500/fbdev.c| 4 drivers/gpu/drm/msm/msm_fbdev.c | 4 Reviewed-by: Dmitry Baryshkov # msm drivers/gpu/drm/omapdrm/omap_fbdev.c | 4 drivers/gpu/drm/radeon/radeon_fbdev.c | 4 drivers/gpu/drm/tegra/fbdev.c | 4 10 files changed, 21 insertions(+), 36 deletions(-) BTW: As you have been clearing this area. I see that significant amount of DRM drivers use exactly the same code for msm_fbdev_client_funcs and for the significant part of foo_fbdev_setup(). Do you have any plans for moving that into a library / generic code? If not, I can take a look at crafting the patch. -- With best wishes Dmitry
RE: [PATCH v3 2/2] drm/amdgpu: update kernel vcn ring test
[AMD Official Use Only - General] -Original Message- From: Jamadar, Saleemkhan Sent: Monday, July 10, 2023 12:54 PM To: Jamadar, Saleemkhan ; amd-gfx@lists.freedesktop.org; Liu, Leo ; Gopalakrishnan, Veerabadhran (Veera) ; Sundararaju, Sathishkumar Cc: Koenig, Christian ; Rao, Srinath Subject: [PATCH v3 2/2] drm/amdgpu: update kernel vcn ring test add session context buffer to decoder ring test fro vcn v1 to v3. v3 - correct the cmd for sesssion ctx buf v2 - add the buffer into IB (Leo liu) Signed-off-by: Saleemkhan Jamadar --- drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 14 ++ 1 file changed, 14 insertions(+) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c index 76e9a2418286..4ee5f933e420 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c @@ -521,6 +521,7 @@ static int amdgpu_vcn_dec_send_msg(struct amdgpu_ring *ring, struct dma_fence **fence) { u64 addr = AMDGPU_GPU_PAGE_ALIGN(ib_msg->gpu_addr); + uint64_t session_ctx_buf_gaddr = AMDGPU_GPU_PAGE_ALIGN(ib_msg->gpu_addr + 8192); struct amdgpu_device *adev = ring->adev; struct dma_fence *f = NULL; struct amdgpu_job *job; @@ -546,6 +547,19 @@ static int amdgpu_vcn_dec_send_msg(struct amdgpu_ring *ring, } ib->length_dw = 16; This line above can be removed. With that the patch is: Reviewed-by: Leo Liu + ib->ptr[ib->length_dw++] = PACKET0(adev->vcn.internal.data0, 0); + ib->ptr[ib->length_dw++] = lower_32_bits(session_ctx_buf_gaddr); + ib->ptr[ib->length_dw++] = PACKET0(adev->vcn.internal.data1, 0); + ib->ptr[ib->length_dw++] = upper_32_bits(session_ctx_buf_gaddr); + /* session ctx buffer cmd */ + ib->ptr[ib->length_dw++] = PACKET0(adev->vcn.internal.cmd, 0xa); + ib->ptr[ib->length_dw++] = 0; + for (i = ib->length_dw; i < 32; i += 2) { + ib->ptr[i] = PACKET0(adev->vcn.internal.nop, 0); + ib->ptr[i+1] = 0; + } + ib->length_dw = 32; + r = amdgpu_job_submit_direct(job, ring, ); if (r) goto err_free; -- 2.25.1
Re: [PATCH 00/10] Freesync Panel Replay V2
On Mon, Jul 10, 2023 at 3:27 PM Bhawanpreet Lakha wrote: > > This patch set introduces Freesync Panel Replay capability on DCN 3.1.4 > and newer. Replay has been verified to be working with these patches (in > house) > > These patches are enabling panel replay in static screen use-cases. > Other use cases will be added as they are ready > > > The importance of Replay > > > In some instances, the GPU is transmitting repeated frames to the sink > without any updates or changes in the content. These repeat transmission > are wasteful, resulting in power draw in different aspects of the system > > 1. DCN is fetching the frame of data from DF/UMC/DRAM. This memory traffic > prevents power down of parts of this HW path. > > 2. GPU is transmitting pixel data to the display through the main link of > the DisplayPort interface. This prevents power down of both the Source > transmitter (TX) and the Sink receiver (RX) > > > > How it improves on PSR > > > The concepts of utilizing replay is similar to PSR, but there is a benefit of: > Source and Sink remaining synchronized which allows for > - lower latency when switching from replay to live frames > - enable the possibility of more use cases > - easy control of the sink's refresh rate during replay > > Due to Source and Sink remaining timing synchronized, Replay can be activated > in more UI scenarios. > > > V2: Bug fixes, V1 had some issues which have all been fixed. > - Invisible Cursor > - Random Hang > - Laggy System > Are there minimum DMCUB firmware versions required for this? If so, we should check before enabling this. Alex > Regards, > Bhawan > > Bhawanpreet Lakha (10): > drm/amd/display: Add structs for Freesync Panel Replay > drm/amd/display: Add Functions to enable Freesync Panel Replay > drm/amd/display: Add Freesync Panel DM code > drm/amd/display: Read replay data from sink > drm/amd/display: Get replay info from VSDB > drm/amd/display: Add Replay supported/enabled checks > drm/amd/display: Update replay for clk_mgr optimizations > drm/amd/display: Update adaptive sync infopackets for replay > drm/amd/display: Handle Replay related hpd irq > drm/amd/display: Enable Replay for static screen use cases > > .../gpu/drm/amd/display/amdgpu_dm/Makefile| 2 +- > .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 71 ++- > .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h | 14 + > .../amd/display/amdgpu_dm/amdgpu_dm_crtc.c| 9 +- > .../amd/display/amdgpu_dm/amdgpu_dm_replay.c | 183 > .../amd/display/amdgpu_dm/amdgpu_dm_replay.h | 46 ++ > .../gpu/drm/amd/display/dc/clk_mgr/clk_mgr.c | 3 + > drivers/gpu/drm/amd/display/dc/core/dc.c | 6 + > .../drm/amd/display/dc/core/dc_link_exports.c | 5 + > drivers/gpu/drm/amd/display/dc/dc.h | 6 + > drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c | 3 + > drivers/gpu/drm/amd/display/dc/dc_dp_types.h | 29 ++ > drivers/gpu/drm/amd/display/dc/dc_types.h | 41 ++ > drivers/gpu/drm/amd/display/dc/dce/Makefile | 2 +- > .../gpu/drm/amd/display/dc/dce/dmub_replay.c | 303 + > .../gpu/drm/amd/display/dc/dce/dmub_replay.h | 58 +++ > .../display/dc/dce110/dce110_hw_sequencer.c | 6 + > .../drm/amd/display/dc/dcn21/dcn21_resource.c | 1 + > .../drm/amd/display/dc/dcn30/dcn30_resource.c | 1 + > .../amd/display/dc/dcn302/dcn302_resource.c | 1 + > .../amd/display/dc/dcn303/dcn303_resource.c | 1 + > .../drm/amd/display/dc/dcn31/dcn31_resource.c | 13 + > .../amd/display/dc/dcn314/dcn314_resource.c | 14 + > .../amd/display/dc/dcn315/dcn315_resource.c | 1 + > .../amd/display/dc/dcn316/dcn316_resource.c | 1 + > .../gpu/drm/amd/display/dc/inc/core_types.h | 19 + > drivers/gpu/drm/amd/display/dc/inc/link.h | 14 + > .../drm/amd/display/dc/link/link_factory.c| 7 + > .../dc/link/protocols/link_dp_capability.c| 10 + > .../dc/link/protocols/link_dp_irq_handler.c | 66 +++ > .../link/protocols/link_edp_panel_control.c | 165 +++ > .../link/protocols/link_edp_panel_control.h | 8 + > .../gpu/drm/amd/display/dmub/inc/dmub_cmd.h | 412 ++ > .../gpu/drm/amd/display/include/dpcd_defs.h | 5 +- > .../display/modules/info_packet/info_packet.c | 4 + > .../amd/display/modules/power/power_helpers.c | 5 + > .../amd/display/modules/power/power_helpers.h | 2 + > drivers/gpu/drm/amd/include/amd_shared.h | 2 + > 38 files changed, 1533 insertions(+), 6 deletions(-) > create mode 100644 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_replay.c > create mode 100644 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_replay.h > create mode 100644 drivers/gpu/drm/amd/display/dc/dce/dmub_replay.c > create mode 100644 drivers/gpu/drm/amd/display/dc/dce/dmub_replay.h > > -- > 2.25.1 >
[PATCH] drm/amdkfd: enable grace period for xcp instance
Read/write grace period from/to first xcc instance of xcp in kfd node. Signed-off-by: Eric Huang --- drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c | 11 --- drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.h | 2 +- drivers/gpu/drm/amd/amdkfd/kfd_packet_manager_v9.c| 10 +++--- 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c index de83eccdd9de..a95bcb91dc09 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.c @@ -1619,10 +1619,15 @@ static int initialize_cpsch(struct device_queue_manager *dqm) init_sdma_bitmaps(dqm); - if (dqm->dev->kfd2kgd->get_iq_wait_times) + if (dqm->dev->kfd2kgd->get_iq_wait_times) { + u32 inst = ffs(dqm->dev->xcc_mask & + (1UL << + dqm->dev->xcp->id * + dqm->dev->adev->gfx.num_xcc_per_xcp)) - 1; dqm->dev->kfd2kgd->get_iq_wait_times(dqm->dev->adev, - >wait_times, - 0); + >wait_times[inst], + inst); + } return 0; } diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.h b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.h index 7dd4b177219d..45959c33b944 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.h +++ b/drivers/gpu/drm/amd/amdkfd/kfd_device_queue_manager.h @@ -262,7 +262,7 @@ struct device_queue_manager { /* used for GFX 9.4.3 only */ uint32_tcurrent_logical_xcc_start; - uint32_twait_times; + uint32_twait_times[MAX_XCP]; wait_queue_head_t destroy_wait; }; diff --git a/drivers/gpu/drm/amd/amdkfd/kfd_packet_manager_v9.c b/drivers/gpu/drm/amd/amdkfd/kfd_packet_manager_v9.c index 8fda16e6fee6..dd50164c16cd 100644 --- a/drivers/gpu/drm/amd/amdkfd/kfd_packet_manager_v9.c +++ b/drivers/gpu/drm/amd/amdkfd/kfd_packet_manager_v9.c @@ -292,17 +292,21 @@ static int pm_set_grace_period_v9(struct packet_manager *pm, struct pm4_mec_write_data_mmio *packet; uint32_t reg_offset = 0; uint32_t reg_data = 0; + uint32_t inst = ffs(pm->dqm->dev->xcc_mask & + (1UL << + pm->dqm->dev->xcp->id * + pm->dqm->dev->adev->gfx.num_xcc_per_xcp)) - 1; pm->dqm->dev->kfd2kgd->build_grace_period_packet_info( pm->dqm->dev->adev, - pm->dqm->wait_times, + pm->dqm->wait_times[inst], grace_period, _offset, _data, - 0); + inst); if (grace_period == USE_DEFAULT_GRACE_PERIOD) - reg_data = pm->dqm->wait_times; + reg_data = pm->dqm->wait_times[inst]; packet = (struct pm4_mec_write_data_mmio *)buffer; memset(buffer, 0, sizeof(struct pm4_mec_write_data_mmio)); -- 2.34.1
[PATCH 09/10] drm/amd/display: Handle Replay related hpd irq
Handle replay related hpd irqs Signed-off-by: Bhawanpreet Lakha --- .../dc/link/protocols/link_dp_irq_handler.c | 66 +++ 1 file changed, 66 insertions(+) diff --git a/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_irq_handler.c b/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_irq_handler.c index ba95facc4ee8..a5605cf4449e 100644 --- a/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_irq_handler.c +++ b/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_irq_handler.c @@ -175,6 +175,68 @@ static bool handle_hpd_irq_psr_sink(struct dc_link *link) return false; } +static bool handle_hpd_irq_replay_sink(struct dc_link *link) +{ + union dpcd_replay_configuration replay_configuration; + /*AMD Replay version reuse DP_PSR_ERROR_STATUS for REPLAY_ERROR status.*/ + union psr_error_status replay_error_status; + + if (!link->replay_settings.replay_feature_enabled) + return false; + + dm_helpers_dp_read_dpcd( + link->ctx, + link, + DP_SINK_PR_REPLAY_STATUS, + _configuration.raw, + sizeof(replay_configuration.raw)); + + dm_helpers_dp_read_dpcd( + link->ctx, + link, + DP_PSR_ERROR_STATUS, + _error_status.raw, + sizeof(replay_error_status.raw)); + + link->replay_settings.config.replay_error_status.bits.LINK_CRC_ERROR = + replay_error_status.bits.LINK_CRC_ERROR; + link->replay_settings.config.replay_error_status.bits.DESYNC_ERROR = + replay_configuration.bits.DESYNC_ERROR_STATUS; + link->replay_settings.config.replay_error_status.bits.STATE_TRANSITION_ERROR = + replay_configuration.bits.STATE_TRANSITION_ERROR_STATUS; + + if (link->replay_settings.config.replay_error_status.bits.LINK_CRC_ERROR || + link->replay_settings.config.replay_error_status.bits.DESYNC_ERROR || + link->replay_settings.config.replay_error_status.bits.STATE_TRANSITION_ERROR) { + bool allow_active; + + /* Acknowledge and clear configuration bits */ + dm_helpers_dp_write_dpcd( + link->ctx, + link, + DP_SINK_PR_REPLAY_STATUS, + _configuration.raw, + sizeof(replay_configuration.raw)); + + /* Acknowledge and clear error bits */ + dm_helpers_dp_write_dpcd( + link->ctx, + link, + DP_PSR_ERROR_STATUS,/*DpcdAddress_REPLAY_Error_Status*/ + _error_status.raw, + sizeof(replay_error_status.raw)); + + /* Replay error, disable and re-enable Replay */ + if (link->replay_settings.replay_allow_active) { + allow_active = false; + edp_set_replay_allow_active(link, _active, true, false, NULL); + allow_active = true; + edp_set_replay_allow_active(link, _active, true, false, NULL); + } + } + return true; +} + void dp_handle_link_loss(struct dc_link *link) { struct pipe_ctx *pipes[MAX_PIPES]; @@ -327,6 +389,10 @@ bool dp_handle_hpd_rx_irq(struct dc_link *link, /* PSR-related error was detected and handled */ return true; + if (handle_hpd_irq_replay_sink(link)) + /* Replay-related error was detected and handled */ + return true; + /* If PSR-related error handled, Main link may be off, * so do not handle as a normal sink status change interrupt. */ -- 2.25.1
[PATCH 07/10] drm/amd/display: Update replay for clk_mgr optimizations
Add Replay calls to clk_mgr updates (just like PSR) Signed-off-by: Bhawanpreet Lakha --- drivers/gpu/drm/amd/display/dc/clk_mgr/clk_mgr.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/gpu/drm/amd/display/dc/clk_mgr/clk_mgr.c b/drivers/gpu/drm/amd/display/dc/clk_mgr/clk_mgr.c index 6127d6045336..3bb11dc1138f 100644 --- a/drivers/gpu/drm/amd/display/dc/clk_mgr/clk_mgr.c +++ b/drivers/gpu/drm/amd/display/dc/clk_mgr/clk_mgr.c @@ -117,6 +117,7 @@ void clk_mgr_exit_optimized_pwr_state(const struct dc *dc, struct clk_mgr *clk_m continue; clk_mgr->psr_allow_active_cache = edp_link->psr_settings.psr_allow_active; dc->link_srv->edp_set_psr_allow_active(edp_link, _active, false, false, NULL); + dc->link_srv->edp_set_replay_allow_active(edp_link, _active, false, false, NULL); } } @@ -137,6 +138,8 @@ void clk_mgr_optimize_pwr_state(const struct dc *dc, struct clk_mgr *clk_mgr) continue; dc->link_srv->edp_set_psr_allow_active(edp_link, _mgr->psr_allow_active_cache, false, false, NULL); + dc->link_srv->edp_set_replay_allow_active(edp_link, +_mgr->psr_allow_active_cache, false, false, NULL); } } -- 2.25.1
[PATCH 10/10] drm/amd/display: Enable Replay for static screen use cases
- Setup replay config on device init. - Enable replay if feature is enabled (prioritize replay over PSR, since it can be enabled in more usecases) - Add debug masks to enable replay on supported ASICs Signed-off-by: Bhawanpreet Lakha --- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 23 +++ .../amd/display/amdgpu_dm/amdgpu_dm_crtc.c| 9 +++- drivers/gpu/drm/amd/include/amd_shared.h | 2 ++ 3 files changed, 33 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c index 90bc32a29356..b5aeae693417 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -65,6 +65,7 @@ #include "amdgpu_dm_debugfs.h" #endif #include "amdgpu_dm_psr.h" +#include "amdgpu_dm_replay.h" #include "ivsrcid/ivsrcid_vislands30.h" @@ -4315,6 +4316,7 @@ static int amdgpu_dm_initialize_drm_device(struct amdgpu_device *adev) enum dc_connection_type new_connection_type = dc_connection_none; const struct dc_plane_cap *plane; bool psr_feature_enabled = false; + bool replay_feature_enabled = false; int max_overlay = dm->dc->caps.max_slave_planes; dm->display_indexes_num = dm->dc->caps.max_streams; @@ -4424,6 +4426,20 @@ static int amdgpu_dm_initialize_drm_device(struct amdgpu_device *adev) } } + if (!(amdgpu_dc_debug_mask & DC_DISABLE_REPLAY)) { + switch (adev->ip_versions[DCE_HWIP][0]) { + case IP_VERSION(3, 1, 4): + case IP_VERSION(3, 1, 5): + case IP_VERSION(3, 1, 6): + case IP_VERSION(3, 2, 0): + case IP_VERSION(3, 2, 1): + replay_feature_enabled = true; + break; + default: + replay_feature_enabled = amdgpu_dc_feature_mask & DC_REPLAY_MASK; + break; + } + } /* loops over all connectors on the board */ for (i = 0; i < link_cnt; i++) { struct dc_link *link = NULL; @@ -4472,6 +4488,12 @@ static int amdgpu_dm_initialize_drm_device(struct amdgpu_device *adev) amdgpu_dm_update_connector_after_detect(aconnector); setup_backlight_device(dm, aconnector); + /* +* Disable psr if replay can be enabled +*/ + if (replay_feature_enabled && amdgpu_dm_setup_replay(link, aconnector)) + psr_feature_enabled = false; + if (psr_feature_enabled) amdgpu_dm_set_psr_caps(link); @@ -4480,6 +4502,7 @@ static int amdgpu_dm_initialize_drm_device(struct amdgpu_device *adev) */ if (link->psr_settings.psr_feature_enabled) adev_to_drm(adev)->vblank_disable_immediate = false; + } } amdgpu_set_panel_orientation(>base); diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c index 440fc0869a34..fb51ec4f8d31 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_crtc.c @@ -29,6 +29,7 @@ #include "dc.h" #include "amdgpu.h" #include "amdgpu_dm_psr.h" +#include "amdgpu_dm_replay.h" #include "amdgpu_dm_crtc.h" #include "amdgpu_dm_plane.h" #include "amdgpu_dm_trace.h" @@ -123,7 +124,12 @@ static void vblank_control_worker(struct work_struct *work) * fill_dc_dirty_rects(). */ if (vblank_work->stream && vblank_work->stream->link) { - if (vblank_work->enable) { + /* +* Prioritize replay, instead of psr +*/ + if (vblank_work->stream->link->replay_settings.replay_feature_enabled) + amdgpu_dm_replay_enable(vblank_work->stream, false); + else if (vblank_work->enable) { if (vblank_work->stream->link->psr_settings.psr_version < DC_PSR_VERSION_SU_1 && vblank_work->stream->link->psr_settings.psr_allow_active) amdgpu_dm_psr_disable(vblank_work->stream); @@ -132,6 +138,7 @@ static void vblank_control_worker(struct work_struct *work) #ifdef CONFIG_DRM_AMD_SECURE_DISPLAY !amdgpu_dm_crc_window_is_activated(_work->acrtc->base) && #endif + vblank_work->stream->link->panel_config.psr.disallow_replay && vblank_work->acrtc->dm_irq_params.allow_psr_entry) {
[PATCH 03/10] drm/amd/display: Add Freesync Panel DM code
We need certain conditions for replay to be enabled, so create an interface in DM to enable/disable replay. Signed-off-by: Bhawanpreet Lakha --- .../gpu/drm/amd/display/amdgpu_dm/Makefile| 2 +- .../amd/display/amdgpu_dm/amdgpu_dm_replay.c | 176 ++ .../amd/display/amdgpu_dm/amdgpu_dm_replay.h | 46 + .../drm/amd/display/dc/core/dc_link_exports.c | 5 + drivers/gpu/drm/amd/display/dc/dc.h | 2 + .../amd/display/modules/power/power_helpers.c | 5 + .../amd/display/modules/power/power_helpers.h | 2 + 7 files changed, 237 insertions(+), 1 deletion(-) create mode 100644 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_replay.c create mode 100644 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_replay.h diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/Makefile b/drivers/gpu/drm/amd/display/amdgpu_dm/Makefile index 249b073f6a23..8bf94920d23e 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/Makefile +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/Makefile @@ -38,7 +38,7 @@ AMDGPUDM += dc_fpu.o endif ifneq ($(CONFIG_DRM_AMD_DC),) -AMDGPUDM += amdgpu_dm_services.o amdgpu_dm_helpers.o amdgpu_dm_pp_smu.o amdgpu_dm_psr.o +AMDGPUDM += amdgpu_dm_services.o amdgpu_dm_helpers.o amdgpu_dm_pp_smu.o amdgpu_dm_psr.o amdgpu_dm_replay.o endif AMDGPUDM += amdgpu_dm_hdcp.o diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_replay.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_replay.c new file mode 100644 index ..b3e14997b470 --- /dev/null +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_replay.c @@ -0,0 +1,176 @@ +/* + * Copyright 2023 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Authors: AMD + * + */ + +#include "amdgpu_dm_replay.h" +#include "dc.h" +#include "dm_helpers.h" +#include "amdgpu_dm.h" +#include "modules/power/power_helpers.h" +#include "dmub/inc/dmub_cmd.h" +#include "dc/inc/link.h" + +/* + * link_supports_replay() - check if the link supports replay + * @link: link + * @aconnector: aconnector + * + */ +static bool link_supports_replay(struct dc_link *link, struct amdgpu_dm_connector *aconnector) +{ + struct dm_connector_state *state = to_dm_connector_state(aconnector->base.state); + struct dpcd_caps *dpcd_caps = >dpcd_caps; + struct adaptive_sync_caps *as_caps = >dpcd_caps.adaptive_sync_caps; + + if (!state->freesync_capable) + return false; + + // Check the eDP version + if (dpcd_caps->edp_rev < EDP_REVISION_13) + return false; + + if (!dpcd_caps->alpm_caps.bits.AUX_WAKE_ALPM_CAP) + return false; + + // Check adaptive sync support cap + if (!as_caps->dp_adap_sync_caps.bits.ADAPTIVE_SYNC_SDP_SUPPORT) + return false; + + return true; +} + +/* + * amdgpu_dm_setup_replay() - setup replay configuration + * @link: link + * @aconnector: aconnector + * + */ +bool amdgpu_dm_setup_replay(struct dc_link *link, struct amdgpu_dm_connector *aconnector) +{ + struct replay_config pr_config; + union replay_debug_flags *debug_flags = NULL; + + if (!dc_is_embedded_signal(link->connector_signal)) + return false; + + if (link->panel_config.psr.disallow_replay) + return false; + + if (!link_supports_replay(link, aconnector)) + return false; + + // Mark Replay is supported in link and update related attributes + pr_config.replay_supported = true; + pr_config.replay_power_opt_supported = 0; + pr_config.replay_enable_option |= pr_enable_option_static_screen; + pr_config.replay_timing_sync_supported = aconnector->max_vfreq >= 2 * aconnector->min_vfreq ? true : false; + + if (!pr_config.replay_timing_sync_supported) + pr_config.replay_enable_option &= ~pr_enable_option_general_ui; + + debug_flags = (union replay_debug_flags
[PATCH 05/10] drm/amd/display: Get replay info from VSDB
We need to make sure that the panel supports replay. This info is inside the amd vsdb (vendor specific data block). Create a function to parse the block and read the replay_mode bit. Signed-off-by: Bhawanpreet Lakha --- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 44 +++ .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h | 14 ++ .../amd/display/amdgpu_dm/amdgpu_dm_replay.c | 7 +++ 3 files changed, 65 insertions(+) diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c index 2446529c329a..c574a11a10bd 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -10527,6 +10527,42 @@ static bool parse_edid_cea(struct amdgpu_dm_connector *aconnector, return ret; } +static int parse_amd_vsdb(struct amdgpu_dm_connector *aconnector, + struct edid *edid, struct amdgpu_hdmi_vsdb_info *vsdb_info) +{ + u8 *edid_ext = NULL; + int i; + int j = 0; + + if (edid == NULL || edid->extensions == 0) + return -ENODEV; + + /* Find DisplayID extension */ + for (i = 0; i < edid->extensions; i++) { + edid_ext = (void *)(edid + (i + 1)); + if (edid_ext[0] == DISPLAYID_EXT) + break; + } + + while (j < EDID_LENGTH) { + + struct amd_vsdb_block *amd_vsdb = (struct amd_vsdb_block *)_ext[j]; + unsigned int ieeeId = (amd_vsdb->ieee_id[2] << 16) | (amd_vsdb->ieee_id[1] << 8) | (amd_vsdb->ieee_id[0]); + + if (ieeeId == HDMI_AMD_VENDOR_SPECIFIC_DATA_BLOCK_IEEE_REGISTRATION_ID && + amd_vsdb->version == HDMI_AMD_VENDOR_SPECIFIC_DATA_BLOCK_VERSION_3) { + vsdb_info->replay_mode = (amd_vsdb->feature_caps & AMD_VSDB_VERSION_3_FEATURECAP_REPLAYMODE) ? true : false; + vsdb_info->amd_vsdb_version = HDMI_AMD_VENDOR_SPECIFIC_DATA_BLOCK_VERSION_3; + DRM_DEBUG_KMS("Panel supports Replay Mode: %d\n", vsdb_info->replay_mode); + + return true; + } + j++; + } + + return false; +} + static int parse_hdmi_amd_vsdb(struct amdgpu_dm_connector *aconnector, struct edid *edid, struct amdgpu_hdmi_vsdb_info *vsdb_info) { @@ -10662,6 +10698,14 @@ void amdgpu_dm_update_freesync_caps(struct drm_connector *connector, freesync_capable = true; } } + parse_amd_vsdb(amdgpu_dm_connector, edid, _info); + + if(vsdb_info.replay_mode){ + amdgpu_dm_connector->vsdb_info.replay_mode = vsdb_info.replay_mode; + amdgpu_dm_connector->vsdb_info.amd_vsdb_version = vsdb_info.amd_vsdb_version; + amdgpu_dm_connector->as_type = ADAPTIVE_SYNC_TYPE_EDP; + } + } else if (edid && sink->sink_signal == SIGNAL_TYPE_HDMI_TYPE_A) { i = parse_hdmi_amd_vsdb(amdgpu_dm_connector, edid, _info); if (i >= 0 && vsdb_info.freesync_supported) { diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h index 4561f55afa99..5c9cf6c147d7 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h @@ -51,6 +51,9 @@ #define AMDGPU_DMUB_NOTIFICATION_MAX 5 +#define HDMI_AMD_VENDOR_SPECIFIC_DATA_BLOCK_IEEE_REGISTRATION_ID 0x1A +#define AMD_VSDB_VERSION_3_FEATURECAP_REPLAYMODE 0x40 +#define HDMI_AMD_VENDOR_SPECIFIC_DATA_BLOCK_VERSION_3 0x3 /* #include "include/amdgpu_dal_power_if.h" #include "amdgpu_dm_irq.h" @@ -75,6 +78,12 @@ struct dmub_srv; struct dc_plane_state; struct dmub_notification; +struct amd_vsdb_block { + unsigned char ieee_id[3]; + unsigned char version; + unsigned char feature_caps; +}; + struct common_irq_params { struct amdgpu_device *adev; enum dc_irq_source irq_src; @@ -604,6 +613,11 @@ struct amdgpu_hdmi_vsdb_info { * @max_refresh_rate_hz: FreeSync Maximum Refresh Rate in Hz */ unsigned int max_refresh_rate_hz; + + /** +* @replay mode: Replay supported +*/ + bool replay_mode; }; struct amdgpu_dm_connector { diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_replay.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_replay.c index b3e14997b470..32d3086c4cb7 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_replay.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_replay.c @@ -46,6 +46,9 @@ static bool link_supports_replay(struct dc_link *link, struct amdgpu_dm_connecto if (!state->freesync_capable) return false; + if (!aconnector->vsdb_info.replay_mode) + return false;
[PATCH 02/10] drm/amd/display: Add Functions to enable Freesync Panel Replay
Add various functions for replay, such as construct, destroy, enable get_state, and copy_setting etc. These functions communicate with the firmware to setup and enable panel replay Signed-off-by: Bhawanpreet Lakha --- drivers/gpu/drm/amd/display/dc/dce/Makefile | 2 +- .../gpu/drm/amd/display/dc/dce/dmub_replay.c | 303 ++ .../gpu/drm/amd/display/dc/dce/dmub_replay.h | 58 .../drm/amd/display/dc/dcn31/dcn31_resource.c | 12 + .../amd/display/dc/dcn314/dcn314_resource.c | 12 + drivers/gpu/drm/amd/display/dc/inc/link.h | 14 + .../drm/amd/display/dc/link/link_factory.c| 7 + .../link/protocols/link_edp_panel_control.c | 165 ++ .../link/protocols/link_edp_panel_control.h | 8 + 9 files changed, 580 insertions(+), 1 deletion(-) create mode 100644 drivers/gpu/drm/amd/display/dc/dce/dmub_replay.c create mode 100644 drivers/gpu/drm/amd/display/dc/dce/dmub_replay.h diff --git a/drivers/gpu/drm/amd/display/dc/dce/Makefile b/drivers/gpu/drm/amd/display/dc/dce/Makefile index 01490c9ba958..15b64c26d5a2 100644 --- a/drivers/gpu/drm/amd/display/dc/dce/Makefile +++ b/drivers/gpu/drm/amd/display/dc/dce/Makefile @@ -30,7 +30,7 @@ DCE = dce_audio.o dce_stream_encoder.o dce_link_encoder.o dce_hwseq.o \ dce_mem_input.o dce_clock_source.o dce_scl_filters.o dce_transform.o \ dce_opp.o dce_dmcu.o dce_abm.o dce_ipp.o dce_aux.o \ dce_i2c.o dce_i2c_hw.o dce_i2c_sw.o dmub_psr.o dmub_abm.o dmub_abm_lcd.o dce_panel_cntl.o \ -dmub_hw_lock_mgr.o dmub_outbox.o +dmub_hw_lock_mgr.o dmub_outbox.o dmub_replay.o AMD_DAL_DCE = $(addprefix $(AMDDALPATH)/dc/dce/,$(DCE)) diff --git a/drivers/gpu/drm/amd/display/dc/dce/dmub_replay.c b/drivers/gpu/drm/amd/display/dc/dce/dmub_replay.c new file mode 100644 index ..cab7e71fd27f --- /dev/null +++ b/drivers/gpu/drm/amd/display/dc/dce/dmub_replay.c @@ -0,0 +1,303 @@ +/* + * Copyright 2023 Advanced Micro Devices, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Authors: AMD + * + */ + +#include "dc.h" +#include "dc_dmub_srv.h" +#include "dmub/dmub_srv.h" +#include "core_types.h" +#include "dmub_replay.h" + +#define DC_TRACE_LEVEL_MESSAGE(...) /* do nothing */ + +#define MAX_PIPES 6 + +/** + * Get Replay state from firmware. + */ +static void dmub_replay_get_state(struct dmub_replay *dmub, enum replay_state *state, uint8_t panel_inst) +{ + struct dmub_srv *srv = dmub->ctx->dmub_srv->dmub; + /* uint32_t raw_state = 0; */ + uint32_t retry_count = 0; + enum dmub_status status; + + do { + // Send gpint command and wait for ack + status = dmub_srv_send_gpint_command(srv, DMUB_GPINT__GET_REPLAY_STATE, panel_inst, 30); + + if (status == DMUB_STATUS_OK) { + // GPINT was executed, get response + dmub_srv_get_gpint_response(srv, (uint32_t *)state); + } else + // Return invalid state when GPINT times out + *state = REPLAY_STATE_INVALID; + } while (++retry_count <= 1000 && *state == REPLAY_STATE_INVALID); + + // Assert if max retry hit + if (retry_count >= 1000 && *state == REPLAY_STATE_INVALID) { + ASSERT(0); + /* To-do: Add retry fail log */ + } +} + +/** + * Enable/Disable Replay. + */ +static void dmub_replay_enable(struct dmub_replay *dmub, bool enable, bool wait, uint8_t panel_inst) +{ + union dmub_rb_cmd cmd; + struct dc_context *dc = dmub->ctx; + uint32_t retry_count; + enum replay_state state = REPLAY_STATE_0; + + memset(, 0, sizeof(cmd)); + cmd.replay_enable.header.type = DMUB_CMD__REPLAY; + cmd.replay_enable.data.panel_inst = panel_inst; + + cmd.replay_enable.header.sub_type = DMUB_CMD__REPLAY_ENABLE; + if (enable) + cmd.replay_enable.data.enable = REPLAY_ENABLE; + else +
[PATCH 06/10] drm/amd/display: Add Replay supported/enabled checks
- Add checks for Cursor update and dirty rects (sending updates to dmub) - Add checks for dc_notify_vsync, and fbc and subvp Signed-off-by: Bhawanpreet Lakha --- drivers/gpu/drm/amd/display/dc/core/dc.c| 6 ++ drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c| 3 +++ drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c | 6 ++ 3 files changed, 15 insertions(+) diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c b/drivers/gpu/drm/amd/display/dc/core/dc.c index dd3a9d06c6e2..dccb49e27f35 100644 --- a/drivers/gpu/drm/amd/display/dc/core/dc.c +++ b/drivers/gpu/drm/amd/display/dc/core/dc.c @@ -3367,6 +3367,9 @@ static bool dc_dmub_should_send_dirty_rect_cmd(struct dc *dc, struct dc_stream_s && stream->ctx->dce_version >= DCN_VERSION_3_1) return true; +if (stream->link->replay_settings.config.replay_supported) +return true; + return false; } @@ -5116,6 +5119,9 @@ void dc_notify_vsync_int_state(struct dc *dc, struct dc_stream_state *stream, bo if (link->psr_settings.psr_feature_enabled) return; +if (link->replay_settings.replay_feature_enabled) +return; + /*find primary pipe associated with stream*/ for (i = 0; i < MAX_PIPES; i++) { pipe = >current_state->res_ctx.pipe_ctx[i]; diff --git a/drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c b/drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c index c52c40b16387..706c49e015f6 100644 --- a/drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c +++ b/drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c @@ -894,6 +894,9 @@ static bool dc_dmub_should_update_cursor_data(struct pipe_ctx *pipe_ctx) pipe_ctx->stream->ctx->dce_version >= DCN_VERSION_3_1) return true; + if (pipe_ctx->stream->link->replay_settings.config.replay_supported) +return true; + return false; } diff --git a/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c b/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c index 6c9ca43d1040..16b53a4c5a42 100644 --- a/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c +++ b/drivers/gpu/drm/amd/display/dc/dce110/dce110_hw_sequencer.c @@ -1585,6 +1585,8 @@ static enum dc_status apply_single_controller_ctx_to_hw( */ if (pipe_ctx->stream->mall_stream_config.type != SUBVP_PHANTOM) { pipe_ctx->stream->link->psr_settings.psr_feature_enabled = false; + printk("## %s %d\n",__func__,__LINE__); + pipe_ctx->stream->link->replay_settings.replay_feature_enabled = false; } return DC_OK; } @@ -2013,6 +2015,10 @@ static bool should_enable_fbc(struct dc *dc, if (pipe_ctx->stream->link->psr_settings.psr_feature_enabled) return false; + /* Replay should not be enabled */ +if (pipe_ctx->stream->link->replay_settings.replay_feature_enabled) +return false; + /* Nothing to compress */ if (!pipe_ctx->plane_state) return false; -- 2.25.1
[PATCH 04/10] drm/amd/display: Read replay data from sink
Read DP_SINK_PR_PIXEL_DEVIATION_PER_LINE and DP_SINK_PR_MAX_NUMBER_OF_DEVIATION_LINE Signed-off-by: Bhawanpreet Lakha --- .../amd/display/dc/link/protocols/link_dp_capability.c | 10 ++ drivers/gpu/drm/amd/display/include/dpcd_defs.h| 2 ++ 2 files changed, 12 insertions(+) diff --git a/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_capability.c b/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_capability.c index 3a5e80b57711..5eec5d9bfd68 100644 --- a/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_capability.c +++ b/drivers/gpu/drm/amd/display/dc/link/protocols/link_dp_capability.c @@ -2008,6 +2008,16 @@ void detect_edp_sink_caps(struct dc_link *link) core_link_read_dpcd(link, DP_RECEIVER_ALPM_CAP, >dpcd_caps.alpm_caps.raw, sizeof(link->dpcd_caps.alpm_caps.raw)); + + /* +* Read REPLAY info +*/ + core_link_read_dpcd(link, DP_SINK_PR_PIXEL_DEVIATION_PER_LINE, + >dpcd_caps.pr_info.pixel_deviation_per_line, + sizeof(link->dpcd_caps.pr_info.pixel_deviation_per_line)); + core_link_read_dpcd(link, DP_SINK_PR_MAX_NUMBER_OF_DEVIATION_LINE, + >dpcd_caps.pr_info.max_deviation_line, + sizeof(link->dpcd_caps.pr_info.max_deviation_line)); } bool dp_get_max_link_enc_cap(const struct dc_link *link, struct dc_link_settings *max_link_enc_cap) diff --git a/drivers/gpu/drm/amd/display/include/dpcd_defs.h b/drivers/gpu/drm/amd/display/include/dpcd_defs.h index f72023a296a0..914f28e9f224 100644 --- a/drivers/gpu/drm/amd/display/include/dpcd_defs.h +++ b/drivers/gpu/drm/amd/display/include/dpcd_defs.h @@ -174,5 +174,7 @@ enum dpcd_psr_sink_states { #define DP_SOURCE_BACKLIGHT_ENABLE 0x32F #define DP_SOURCE_MINIMUM_HBLANK_SUPPORTED 0x340 #define DP_SINK_PR_REPLAY_STATUS0x378 +#define DP_SINK_PR_PIXEL_DEVIATION_PER_LINE 0x379 +#define DP_SINK_PR_MAX_NUMBER_OF_DEVIATION_LINE 0x37A #endif /* __DAL_DPCD_DEFS_H__ */ -- 2.25.1
[PATCH 08/10] drm/amd/display: Update adaptive sync infopackets for replay
Update infopackets for replay Signed-off-by: Bhawanpreet Lakha --- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 4 ++-- drivers/gpu/drm/amd/display/modules/info_packet/info_packet.c | 4 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c index c574a11a10bd..90bc32a29356 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -6097,7 +6097,7 @@ create_stream_for_sink(struct amdgpu_dm_connector *aconnector, if (stream->signal == SIGNAL_TYPE_HDMI_TYPE_A) mod_build_hf_vsif_infopacket(stream, >vsp_infopacket); - if (stream->link->psr_settings.psr_feature_enabled) { + if (stream->link->psr_settings.psr_feature_enabled || stream->link->replay_settings.replay_feature_enabled) { // // should decide stream support vsc sdp colorimetry capability // before building vsc info packet @@ -7842,7 +7842,7 @@ static void update_freesync_state_on_stream( aconn = (struct amdgpu_dm_connector *)new_stream->dm_stream_context; - if (aconn && aconn->as_type == FREESYNC_TYPE_PCON_IN_WHITELIST) { + if (aconn && (aconn->as_type == FREESYNC_TYPE_PCON_IN_WHITELIST || aconn->vsdb_info.replay_mode)) { pack_sdp_v1_3 = aconn->pack_sdp_v1_3; if (aconn->vsdb_info.amd_vsdb_version == 1) diff --git a/drivers/gpu/drm/amd/display/modules/info_packet/info_packet.c b/drivers/gpu/drm/amd/display/modules/info_packet/info_packet.c index ec64f19e1786..5e0068f71609 100644 --- a/drivers/gpu/drm/amd/display/modules/info_packet/info_packet.c +++ b/drivers/gpu/drm/amd/display/modules/info_packet/info_packet.c @@ -149,6 +149,8 @@ void mod_build_vsc_infopacket(const struct dc_stream_state *stream, /* VSC packet set to 4 for PSR-SU, or 2 for PSR1 */ if (stream->link->psr_settings.psr_version == DC_PSR_VERSION_SU_1) vsc_packet_revision = vsc_packet_rev4; + else if (stream->link->replay_settings.config.replay_supported) + vsc_packet_revision = vsc_packet_rev4; else if (stream->link->psr_settings.psr_version == DC_PSR_VERSION_1) vsc_packet_revision = vsc_packet_rev2; @@ -536,6 +538,8 @@ void mod_build_adaptive_sync_infopacket(const struct dc_stream_state *stream, case FREESYNC_TYPE_PCON_IN_WHITELIST: mod_build_adaptive_sync_infopacket_v1(info_packet); break; + case ADAPTIVE_SYNC_TYPE_EDP: + mod_build_adaptive_sync_infopacket_v1(info_packet); case ADAPTIVE_SYNC_TYPE_NONE: case FREESYNC_TYPE_PCON_NOT_IN_WHITELIST: default: -- 2.25.1
[PATCH 00/10] Freesync Panel Replay V2
This patch set introduces Freesync Panel Replay capability on DCN 3.1.4 and newer. Replay has been verified to be working with these patches (in house) These patches are enabling panel replay in static screen use-cases. Other use cases will be added as they are ready The importance of Replay In some instances, the GPU is transmitting repeated frames to the sink without any updates or changes in the content. These repeat transmission are wasteful, resulting in power draw in different aspects of the system 1. DCN is fetching the frame of data from DF/UMC/DRAM. This memory traffic prevents power down of parts of this HW path. 2. GPU is transmitting pixel data to the display through the main link of the DisplayPort interface. This prevents power down of both the Source transmitter (TX) and the Sink receiver (RX) How it improves on PSR The concepts of utilizing replay is similar to PSR, but there is a benefit of: Source and Sink remaining synchronized which allows for - lower latency when switching from replay to live frames - enable the possibility of more use cases - easy control of the sink's refresh rate during replay Due to Source and Sink remaining timing synchronized, Replay can be activated in more UI scenarios. V2: Bug fixes, V1 had some issues which have all been fixed. - Invisible Cursor - Random Hang - Laggy System Regards, Bhawan Bhawanpreet Lakha (10): drm/amd/display: Add structs for Freesync Panel Replay drm/amd/display: Add Functions to enable Freesync Panel Replay drm/amd/display: Add Freesync Panel DM code drm/amd/display: Read replay data from sink drm/amd/display: Get replay info from VSDB drm/amd/display: Add Replay supported/enabled checks drm/amd/display: Update replay for clk_mgr optimizations drm/amd/display: Update adaptive sync infopackets for replay drm/amd/display: Handle Replay related hpd irq drm/amd/display: Enable Replay for static screen use cases .../gpu/drm/amd/display/amdgpu_dm/Makefile| 2 +- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 71 ++- .../gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.h | 14 + .../amd/display/amdgpu_dm/amdgpu_dm_crtc.c| 9 +- .../amd/display/amdgpu_dm/amdgpu_dm_replay.c | 183 .../amd/display/amdgpu_dm/amdgpu_dm_replay.h | 46 ++ .../gpu/drm/amd/display/dc/clk_mgr/clk_mgr.c | 3 + drivers/gpu/drm/amd/display/dc/core/dc.c | 6 + .../drm/amd/display/dc/core/dc_link_exports.c | 5 + drivers/gpu/drm/amd/display/dc/dc.h | 6 + drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c | 3 + drivers/gpu/drm/amd/display/dc/dc_dp_types.h | 29 ++ drivers/gpu/drm/amd/display/dc/dc_types.h | 41 ++ drivers/gpu/drm/amd/display/dc/dce/Makefile | 2 +- .../gpu/drm/amd/display/dc/dce/dmub_replay.c | 303 + .../gpu/drm/amd/display/dc/dce/dmub_replay.h | 58 +++ .../display/dc/dce110/dce110_hw_sequencer.c | 6 + .../drm/amd/display/dc/dcn21/dcn21_resource.c | 1 + .../drm/amd/display/dc/dcn30/dcn30_resource.c | 1 + .../amd/display/dc/dcn302/dcn302_resource.c | 1 + .../amd/display/dc/dcn303/dcn303_resource.c | 1 + .../drm/amd/display/dc/dcn31/dcn31_resource.c | 13 + .../amd/display/dc/dcn314/dcn314_resource.c | 14 + .../amd/display/dc/dcn315/dcn315_resource.c | 1 + .../amd/display/dc/dcn316/dcn316_resource.c | 1 + .../gpu/drm/amd/display/dc/inc/core_types.h | 19 + drivers/gpu/drm/amd/display/dc/inc/link.h | 14 + .../drm/amd/display/dc/link/link_factory.c| 7 + .../dc/link/protocols/link_dp_capability.c| 10 + .../dc/link/protocols/link_dp_irq_handler.c | 66 +++ .../link/protocols/link_edp_panel_control.c | 165 +++ .../link/protocols/link_edp_panel_control.h | 8 + .../gpu/drm/amd/display/dmub/inc/dmub_cmd.h | 412 ++ .../gpu/drm/amd/display/include/dpcd_defs.h | 5 +- .../display/modules/info_packet/info_packet.c | 4 + .../amd/display/modules/power/power_helpers.c | 5 + .../amd/display/modules/power/power_helpers.h | 2 + drivers/gpu/drm/amd/include/amd_shared.h | 2 + 38 files changed, 1533 insertions(+), 6 deletions(-) create mode 100644 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_replay.c create mode 100644 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_replay.h create mode 100644 drivers/gpu/drm/amd/display/dc/dce/dmub_replay.c create mode 100644 drivers/gpu/drm/amd/display/dc/dce/dmub_replay.h -- 2.25.1
[PATCH 01/10] drm/amd/display: Add structs for Freesync Panel Replay
In some instances, the GPU is transmitting repeated frame to the sink without any updates or changes in the content. These repeat transmission are wasteful, resulting in power draw in different aspects of the system 1. DCN is fetching the frame of data from DF/UMC/DRAM. This memory traffic prevents power down of parts of this HW path. 2. GPU is transmitting pixel data to the display through the main link of the DisplayPort interface. This prevents power down of both the Source transmitter (TX) and the Sink receiver (RX) The concepts of utilizing replay is similar to PSR, but there is a benefit of: Source and Sink remaining synchronized which allows for - lower latency when switching from replay to live frames - enable the possibility of more use cases - easy control of the sink's refresh rate during replay Due to Source and Sink remaining timing synchronized, Replay can be activated in more UI scenarios. Signed-off-by: Bhawanpreet Lakha --- drivers/gpu/drm/amd/display/dc/dc.h | 4 + drivers/gpu/drm/amd/display/dc/dc_dp_types.h | 29 ++ drivers/gpu/drm/amd/display/dc/dc_types.h | 41 ++ .../drm/amd/display/dc/dcn21/dcn21_resource.c | 1 + .../drm/amd/display/dc/dcn30/dcn30_resource.c | 1 + .../amd/display/dc/dcn302/dcn302_resource.c | 1 + .../amd/display/dc/dcn303/dcn303_resource.c | 1 + .../drm/amd/display/dc/dcn31/dcn31_resource.c | 1 + .../amd/display/dc/dcn314/dcn314_resource.c | 2 + .../amd/display/dc/dcn315/dcn315_resource.c | 1 + .../amd/display/dc/dcn316/dcn316_resource.c | 1 + .../gpu/drm/amd/display/dc/inc/core_types.h | 19 + .../gpu/drm/amd/display/dmub/inc/dmub_cmd.h | 412 ++ .../gpu/drm/amd/display/include/dpcd_defs.h | 3 +- 14 files changed, 516 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/display/dc/dc.h b/drivers/gpu/drm/amd/display/dc/dc.h index 26d05e225088..3a7208a86541 100644 --- a/drivers/gpu/drm/amd/display/dc/dc.h +++ b/drivers/gpu/drm/amd/display/dc/dc.h @@ -428,6 +428,7 @@ enum visual_confirm { VISUAL_CONFIRM_SWAPCHAIN = 6, VISUAL_CONFIRM_FAMS = 7, VISUAL_CONFIRM_SWIZZLE = 9, + VISUAL_CONFIRM_REPLAY = 12, VISUAL_CONFIRM_SUBVP = 14, VISUAL_CONFIRM_MCLK_SWITCH = 16, }; @@ -901,6 +902,7 @@ struct dc_debug_options { uint32_t fpo_vactive_max_blank_us; bool enable_legacy_fast_update; bool disable_dc_mode_overwrite; + bool replay_skip_crtc_disabled; }; struct gpu_info_soc_bounding_box_v1_0; @@ -1505,6 +1507,8 @@ struct dc_link { struct psr_settings psr_settings; + struct replay_settings replay_settings; + /* Drive settings read from integrated info table */ struct dc_lane_settings bios_forced_drive_settings; diff --git a/drivers/gpu/drm/amd/display/dc/dc_dp_types.h b/drivers/gpu/drm/amd/display/dc/dc_dp_types.h index 55139d7bf422..cfaa39c5dd16 100644 --- a/drivers/gpu/drm/amd/display/dc/dc_dp_types.h +++ b/drivers/gpu/drm/amd/display/dc/dc_dp_types.h @@ -1117,6 +1117,11 @@ struct edp_psr_info { uint8_t force_psrsu_cap; }; +struct replay_info { + uint8_t pixel_deviation_per_line; + uint8_t max_deviation_line; +}; + struct dprx_states { bool cable_id_written; }; @@ -1236,6 +1241,8 @@ struct dpcd_caps { uint8_t edp_rev; union edp_alpm_caps alpm_caps; struct edp_psr_info psr_info; + + struct replay_info pr_info; }; union dpcd_sink_ext_caps { @@ -1276,6 +1283,28 @@ union dpcd_psr_configuration { unsigned char raw; }; +union replay_enable_and_configuration { + struct { + unsigned char FREESYNC_PANEL_REPLAY_MODE :1; + unsigned char TIMING_DESYNC_ERROR_VERIFICATION:1; + unsigned char STATE_TRANSITION_ERROR_DETECTION:1; + unsigned char RESERVED0 :1; + unsigned char RESERVED1 :4; + } bits; + unsigned char raw; +}; + +union dpcd_replay_configuration { + struct { + unsigned char STATE_TRANSITION_ERROR_STATUS: 1; + unsigned char DESYNC_ERROR_STATUS : 1; + unsigned char SINK_DEVICE_REPLAY_STATUS: 3; + unsigned char SINK_FRAME_LOCKED: 2; + unsigned char RESERVED : 1; + } bits; + unsigned char raw; +}; + union dpcd_alpm_configuration { struct { unsigned char ENABLE: 1; diff --git a/drivers/gpu/drm/amd/display/dc/dc_types.h b/drivers/gpu/drm/amd/display/dc/dc_types.h index 0ce7728a5a4b..b77ceb442fa2 100644 --- a/drivers/gpu/drm/amd/display/dc/dc_types.h +++ b/drivers/gpu/drm/amd/display/dc/dc_types.h @@ -1014,6 +1014,45 @@ struct psr_settings { unsigned int psr_power_opt; };
Re: [PATCH 00/17] fbdev: Remove FBINFO_DEFAULT and FBINFO_FLAG_DEFAULT flags
Hi Thomas, On Mon, Jul 10, 2023 at 02:50:04PM +0200, Thomas Zimmermann wrote: > Remove the unused flags FBINFO_DEFAULT and FBINFO_FLAG_DEFAULT from > fbdev and drivers, as briefly discussed at [1]. Both flags were maybe > useful when fbdev had special handling for driver modules. With > commit 376b3ff54c9a ("fbdev: Nuke FBINFO_MODULE"), they are both 0 > and have no further effect. > > Patches 1 to 7 remove FBINFO_DEFAULT from drivers. Patches 2 to 5 > split this by the way the fb_info struct is being allocated. All flags > are cleared to zero during the allocation. > > Patches 8 to 16 do the same for FBINFO_FLAG_DEFAULT. Patch 8 fixes > an actual bug in how arch/sh uses the tokne for struct fb_videomode, > which is unrelated. > > Patch 17 removes both flag constants from We have a few more flags that are unused - should they be nuked too? FBINFO_HWACCEL_FILLRECT FBINFO_HWACCEL_ROTATE FBINFO_HWACCEL_XPAN Unused as in no references from fbdev/core/* I would rather see one series nuke all unused FBINFO flags in one go. Assuming my quick grep are right and the above can be dropped. Sam
Re: [PATCH] drm/radeon: ERROR: that open brace { should be on the previous line
Applied. Thanks! On Mon, Jul 10, 2023 at 5:06 AM wrote: > > Fix eleven occurrences of the checkpatch.pl error: > ERROR: that open brace { should be on the previous line > > Signed-off-by: Ran Sun > --- > drivers/gpu/drm/radeon/rv770.c | 22 +++--- > 1 file changed, 11 insertions(+), 11 deletions(-) > > diff --git a/drivers/gpu/drm/radeon/rv770.c > b/drivers/gpu/drm/radeon/rv770.c > index a5ce59d4a485..9ce12fa3c356 100644 > --- a/drivers/gpu/drm/radeon/rv770.c > +++ b/drivers/gpu/drm/radeon/rv770.c > @@ -136,7 +136,7 @@ int rv770_set_uvd_clocks(struct radeon_device *rdev, > u32 vclk, u32 dclk) > return 0; > } > > -static const u32 r7xx_golden_registers[] ={ > +static const u32 r7xx_golden_registers[] = { > 0x8d00, 0x, 0x0e0e0074, > 0x8d04, 0x, 0x013a2b34, > 0x9508, 0x, 0x0002, > @@ -151,7 +151,7 @@ static const u32 r7xx_golden_registers[] ={ > 0x7300, 0x, 0x001000f0 > }; > > -static const u32 r7xx_golden_dyn_gpr_registers[] ={ > +static const u32 r7xx_golden_dyn_gpr_registers[] = { > 0x8db0, 0x, 0x98989898, > 0x8db4, 0x, 0x98989898, > 0x8db8, 0x, 0x98989898, > @@ -163,7 +163,7 @@ static const u32 r7xx_golden_dyn_gpr_registers[] ={ > 0x88c4, 0x, 0x0082 > }; > > -static const u32 rv770_golden_registers[] ={ > +static const u32 rv770_golden_registers[] = { > 0x562c, 0x, 0, > 0x3f90, 0x, 0, > 0x9148, 0x, 0, > @@ -172,7 +172,7 @@ static const u32 rv770_golden_registers[] ={ > 0x9698, 0x1800, 0x1800 > }; > > -static const u32 rv770ce_golden_registers[] ={ > +static const u32 rv770ce_golden_registers[] = { > 0x562c, 0x, 0, > 0x3f90, 0x, 0x00cc, > 0x9148, 0x, 0x00cc, > @@ -183,7 +183,7 @@ static const u32 rv770ce_golden_registers[] ={ > 0x9698, 0x1800, 0x1800 > }; > > -static const u32 rv770_mgcg_init[] ={ > +static const u32 rv770_mgcg_init[] = { > 0x8bcc, 0x, 0x130300f9, > 0x5448, 0x, 0x100, > 0x55e4, 0x, 0x100, > @@ -340,7 +340,7 @@ static const u32 rv770_mgcg_init[] ={ > 0x92a4, 0x, 0x00080007 > }; > > -static const u32 rv710_golden_registers[] ={ > +static const u32 rv710_golden_registers[] = { > 0x3f90, 0x00ff, 0x00fc, > 0x9148, 0x00ff, 0x00fc, > 0x3f94, 0x00ff, 0x00fc, > @@ -349,7 +349,7 @@ static const u32 rv710_golden_registers[] ={ > 0xa180, 0x, 0x3f3f > }; > > -static const u32 rv710_mgcg_init[] ={ > +static const u32 rv710_mgcg_init[] = { > 0x8bcc, 0x, 0x13030040, > 0x5448, 0x, 0x100, > 0x55e4, 0x, 0x100, > @@ -407,7 +407,7 @@ static const u32 rv710_mgcg_init[] ={ > 0x9150, 0x, 0x4d94 > }; > > -static const u32 rv730_golden_registers[] ={ > +static const u32 rv730_golden_registers[] = { > 0x3f90, 0x00ff, 0x00f0, > 0x9148, 0x00ff, 0x00f0, > 0x3f94, 0x00ff, 0x00f0, > @@ -417,7 +417,7 @@ static const u32 rv730_golden_registers[] ={ > 0xa180, 0x, 0x3f3f > }; > > -static const u32 rv730_mgcg_init[] ={ > +static const u32 rv730_mgcg_init[] = { > 0x8bcc, 0x, 0x130300f9, > 0x5448, 0x, 0x100, > 0x55e4, 0x, 0x100, > @@ -538,7 +538,7 @@ static const u32 rv730_mgcg_init[] ={ > 0x92a4, 0x, 0x0005 > }; > > -static const u32 rv740_golden_registers[] ={ > +static const u32 rv740_golden_registers[] = { > 0x88c4, 0x, 0x0082, > 0x28a50, 0xfffc, 0x0004, > 0x2650, 0x0004, 0, > @@ -574,7 +574,7 @@ static const u32 rv740_golden_registers[] ={ > 0x9698, 0x1800, 0x1800 > }; > > -static const u32 rv740_mgcg_init[] ={ > +static const u32 rv740_mgcg_init[] = { > 0x8bcc, 0x, 0x13030100, > 0x5448, 0x, 0x100, > 0x55e4, 0x, 0x100,
Re: [PATCH] drm/radeon: ERROR: "(foo*)" should be "(foo *)"
Applied. Thanks! On Mon, Jul 10, 2023 at 4:27 AM wrote: > > Fix four occurrences of the checkpatch.pl error: > ERROR: "(foo*)" should be "(foo *)" > > Signed-off-by: Ran Sun > --- > drivers/gpu/drm/radeon/radeon_atombios.c | 8 > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/drivers/gpu/drm/radeon/radeon_atombios.c > b/drivers/gpu/drm/radeon/radeon_atombios.c > index bf3c411a55c5..85c4bb186203 100644 > --- a/drivers/gpu/drm/radeon/radeon_atombios.c > +++ b/drivers/gpu/drm/radeon/radeon_atombios.c > @@ -1389,7 +1389,7 @@ bool radeon_atombios_get_ppll_ss_info(struct > radeon_device *rdev, > > num_indices = (size - sizeof(ATOM_COMMON_TABLE_HEADER)) / > sizeof(ATOM_SPREAD_SPECTRUM_ASSIGNMENT); > -ss_assign = (struct _ATOM_SPREAD_SPECTRUM_ASSIGNMENT*) > +ss_assign = (struct _ATOM_SPREAD_SPECTRUM_ASSIGNMENT *) > ((u8 *)_info->asSS_Info[0]); > for (i = 0; i < num_indices; i++) { > if (ss_assign->ucSS_Id == id) { > @@ -1402,7 +1402,7 @@ bool radeon_atombios_get_ppll_ss_info(struct > radeon_device *rdev, > ss->refdiv = ss_assign->ucRecommendedRef_Div; > return true; > } > -ss_assign = (struct _ATOM_SPREAD_SPECTRUM_ASSIGNMENT*) > +ss_assign = (struct _ATOM_SPREAD_SPECTRUM_ASSIGNMENT *) > ((u8 *)ss_assign + sizeof(struct > _ATOM_SPREAD_SPECTRUM_ASSIGNMENT)); > } > } > @@ -3406,7 +3406,7 @@ static ATOM_VOLTAGE_OBJECT_V2 > *atom_lookup_voltage_object_v2(ATOM_VOLTAGE_OBJECT > { > u32 size = le16_to_cpu(v2->sHeader.usStructureSize); > u32 offset = offsetof(ATOM_VOLTAGE_OBJECT_INFO_V2, > asVoltageObj[0]); > -u8 *start = (u8*)v2; > +u8 *start = (u8 *)v2; > > while (offset < size) { > ATOM_VOLTAGE_OBJECT_V2 *vo = (ATOM_VOLTAGE_OBJECT_V2 *)(start + > offset); > @@ -3423,7 +3423,7 @@ static ATOM_VOLTAGE_OBJECT_V3 > *atom_lookup_voltage_object_v3(ATOM_VOLTAGE_OBJECT > { > u32 size = le16_to_cpu(v3->sHeader.usStructureSize); > u32 offset = offsetof(ATOM_VOLTAGE_OBJECT_INFO_V3_1, > asVoltageObj[0]); > -u8 *start = (u8*)v3; > +u8 *start = (u8 *)v3; > > while (offset < size) { > ATOM_VOLTAGE_OBJECT_V3 *vo = (ATOM_VOLTAGE_OBJECT_V3 *)(start + > offset);
Re: [PATCH] drm/radeon: ERROR: "(foo*)" should be "(foo *)"
Applied. Thanks! Alex On Mon, Jul 10, 2023 at 3:52 AM wrote: > > Fix four occurrences of the checkpatch.pl error: > ERROR: "(foo*)" should be "(foo *)" > > Signed-off-by: Ran Sun > --- > drivers/gpu/drm/radeon/radeon_test.c | 8 > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/drivers/gpu/drm/radeon/radeon_test.c > b/drivers/gpu/drm/radeon/radeon_test.c > index a5e1d2139e80..c9fef9b61ced 100644 > --- a/drivers/gpu/drm/radeon/radeon_test.c > +++ b/drivers/gpu/drm/radeon/radeon_test.c > @@ -156,10 +156,10 @@ static void radeon_do_test_moves(struct > radeon_device *rdev, int flag) > i, *vram_start, gtt_start, > (unsigned long long) > (gtt_addr - rdev->mc.gtt_start + > - (void*)gtt_start - gtt_map), > + (void *)gtt_start - gtt_map), > (unsigned long long) > (vram_addr - rdev->mc.vram_start + > - (void*)gtt_start - gtt_map)); > + (void *)gtt_start - gtt_map)); > radeon_bo_kunmap(vram_obj); > goto out_lclean_unpin; > } > @@ -207,10 +207,10 @@ static void radeon_do_test_moves(struct > radeon_device *rdev, int flag) > i, *gtt_start, vram_start, > (unsigned long long) > (vram_addr - rdev->mc.vram_start + > - (void*)vram_start - vram_map), > + (void *)vram_start - vram_map), > (unsigned long long) > (gtt_addr - rdev->mc.gtt_start + > - (void*)vram_start - vram_map)); > + (void *)vram_start - vram_map)); > radeon_bo_kunmap(gtt_obj[i]); > goto out_lclean_unpin; > }
Re: [PATCH] drm/radeon: ERROR: "foo * bar" should be "foo *bar"
Applied. Thanks! On Mon, Jul 10, 2023 at 3:38 AM wrote: > > Fix nine occurrences of the checkpatch.pl error: > ERROR: "foo * bar" should be "foo *bar" > > Signed-off-by: Ran Sun > --- > drivers/gpu/drm/radeon/atom.c | 14 +++--- > 1 file changed, 7 insertions(+), 7 deletions(-) > > diff --git a/drivers/gpu/drm/radeon/atom.c > b/drivers/gpu/drm/radeon/atom.c > index c1bbfbe28bda..11a1940bb26d 100644 > --- a/drivers/gpu/drm/radeon/atom.c > +++ b/drivers/gpu/drm/radeon/atom.c > @@ -1156,7 +1156,7 @@ static struct { > atom_op_shr, ATOM_ARG_MC}, { > atom_op_debug, 0},}; > > -static int atom_execute_table_locked(struct atom_context *ctx, int > index, uint32_t * params) > +static int atom_execute_table_locked(struct atom_context *ctx, int > index, uint32_t *params) > { > int base = CU16(ctx->cmd_table + 4 + 2 * index); > int len, ws, ps, ptr; > @@ -1216,7 +1216,7 @@ static int atom_execute_table_locked(struct > atom_context *ctx, int index, uint32 > return ret; > } > > -int atom_execute_table_scratch_unlocked(struct atom_context *ctx, int > index, uint32_t * params) > +int atom_execute_table_scratch_unlocked(struct atom_context *ctx, int > index, uint32_t *params) > { > int r; > > @@ -1237,7 +1237,7 @@ int atom_execute_table_scratch_unlocked(struct > atom_context *ctx, int index, uin > return r; > } > > -int atom_execute_table(struct atom_context *ctx, int index, uint32_t * > params) > +int atom_execute_table(struct atom_context *ctx, int index, uint32_t > *params) > { > int r; > mutex_lock(>scratch_mutex); > @@ -1359,8 +1359,8 @@ void atom_destroy(struct atom_context *ctx) > } > > bool atom_parse_data_header(struct atom_context *ctx, int index, > -uint16_t * size, uint8_t * frev, uint8_t * crev, > -uint16_t * data_start) > +uint16_t *size, uint8_t *frev, uint8_t *crev, > +uint16_t *data_start) > { > int offset = index * 2 + 4; > int idx = CU16(ctx->data_table + offset); > @@ -1379,8 +1379,8 @@ bool atom_parse_data_header(struct atom_context > *ctx, int index, > return true; > } > > -bool atom_parse_cmd_header(struct atom_context *ctx, int index, uint8_t > * frev, > - uint8_t * crev) > +bool atom_parse_cmd_header(struct atom_context *ctx, int index, uint8_t > *frev, > + uint8_t *crev) > { > int offset = index * 2 + 4; > int idx = CU16(ctx->cmd_table + offset);
Re: [PATCH] drm/client: Send hotplug event after registering a client
+regressions On 7/10/2023 04:58, Thomas Zimmermann wrote: Hi Am 10.07.23 um 11:52 schrieb Javier Martinez Canillas: Thomas Zimmermann writes: Hello Thomas, Generate a hotplug event after registering a client to allow the client to configure its display. Remove the hotplug calls from the existing clients for fbdev emulation. This change fixes a concurrency bug between registering a client and receiving events from the DRM core. The bug is present in the fbdev emulation of all drivers. The fbdev emulation currently generates a hotplug event before registering the client to the device. For each new output, the DRM core sends an additional hotplug event to each registered client. If the DRM core detects first output between sending the artificial hotplug and registering the device, the output's hotplug event gets lost. If this is the first output, the fbdev console display remains dark. This has been observed with amdgpu and fbdev-generic. Fix this by adding hotplug generation directly to the client's register helper drm_client_register(). Registering the client and receiving events are serialized by struct drm_device.clientlist_mutex. So an output is either configured by the initial hotplug event, or the client has already been registered. The bug was originally added in commit 6e3f17ee73f7 ("drm/fb-helper: generic: Call drm_client_add() after setup is done"), in which adding a client and receiving a hotplug event switched order. It was hidden, as most hardware and drivers have at least on static output configured. Other drivers didn't use the internal DRM client or still had struct drm_mode_config_funcs.output_poll_changed set. That callback handled hotplug events as well. After not setting the callback in amdgpu in commit 0e3172bac3f4 ("drm/amdgpu: Don't set struct drm_driver.output_poll_changed"), amdgpu did not show a framebuffer console if output events got lost. The bug got copy-pasted from fbdev-generic into the other fbdev emulation. Reported-by: Moritz Duge Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/2649 Aren't you missing a Fixes: for 0e3172bac3f4 too? Since that's the commit that unmasked the bug for amdgpu, IMO that is the most important to list. Well, OK. Fixes: 6e3f17ee73f7 ("drm/fb-helper: generic: Call drm_client_add() after setup is done") Fixes: 8ab59da26bc0 ("drm/fb-helper: Move generic fbdev emulation into separate source file") Fixes: b79fe9abd58b ("drm/fbdev-dma: Implement fbdev emulation for GEM DMA helpers") Fixes: 63c381552f69 ("drm/armada: Implement fbdev emulation as in-kernel client") Fixes: 49953b70e7d3 ("drm/exynos: Implement fbdev emulation as in-kernel client") Fixes: 8f1aaccb04b7 ("drm/gma500: Implement client-based fbdev emulation") Fixes: 940b869c2f2f ("drm/msm: Implement fbdev emulation as in-kernel client") Fixes: 9e69bcd88e45 ("drm/omapdrm: Implement fbdev emulation as in-kernel client") Fixes: e317a69fe891 ("drm/radeon: Implement client-based fbdev emulation") Fixes: 71ec16f45ef8 ("drm/tegra: Implement fbdev emulation as in-kernel client") Signed-off-by: Thomas Zimmermann Tested-by: Moritz Duge Tested-by: Torsten Krah Tested-by: Paul Schyska Cc: Daniel Vetter Cc: David Airlie Cc: Noralf Trønnes Cc: Maarten Lankhorst Cc: Maxime Ripard Cc: Javier Martinez Canillas Cc: Russell King Cc: Inki Dae Cc: Seung-Woo Kim Cc: Kyungmin Park Cc: Krzysztof Kozlowski Cc: Patrik Jakobsson Cc: Rob Clark Cc: Abhinav Kumar Cc: Dmitry Baryshkov Cc: Tomi Valkeinen Cc: Alex Deucher Cc: "Christian König" Cc: "Pan, Xinhui" Cc: Thierry Reding Cc: Mikko Perttunen Cc: dri-de...@lists.freedesktop.org Cc: linux-ker...@vger.kernel.org Cc: linux-arm-ker...@lists.infradead.org Cc: linux-samsung-...@vger.kernel.org Cc: linux-arm-...@vger.kernel.org Cc: freedr...@lists.freedesktop.org Cc: amd-gfx@lists.freedesktop.org Cc: linux-te...@vger.kernel.org Cc: dri-de...@lists.freedesktop.org Cc: # v5.2+ While it's true that the but was introduced by commit 6e3f17ee73f7 and that landed in v5.2, I wonder if this patch could even be applied to such olders Linux versions. Probably in practice it would be at most backported to v6.2, which is the release that exposed the bug for the amdgpu driver. No idea. The fix looks simple enough, but a lot has changed in the surrounding code. Actually it needs to go to at least 6.1.y. Moritz found it in 6.1.35 (not present in 6.1.34). Best regards Thomas Your explanation makes sense to me and the patch looks good. Reviewed-by: Javier Martinez Canillas
[PATCH v3 2/2] drm/amdgpu: update kernel vcn ring test
add session context buffer to decoder ring test fro vcn v1 to v3. v3 - correct the cmd for sesssion ctx buf v2 - add the buffer into IB (Leo liu) Signed-off-by: Saleemkhan Jamadar --- drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 14 ++ 1 file changed, 14 insertions(+) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c index 76e9a2418286..4ee5f933e420 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c @@ -521,6 +521,7 @@ static int amdgpu_vcn_dec_send_msg(struct amdgpu_ring *ring, struct dma_fence **fence) { u64 addr = AMDGPU_GPU_PAGE_ALIGN(ib_msg->gpu_addr); + uint64_t session_ctx_buf_gaddr = AMDGPU_GPU_PAGE_ALIGN(ib_msg->gpu_addr + 8192); struct amdgpu_device *adev = ring->adev; struct dma_fence *f = NULL; struct amdgpu_job *job; @@ -546,6 +547,19 @@ static int amdgpu_vcn_dec_send_msg(struct amdgpu_ring *ring, } ib->length_dw = 16; + ib->ptr[ib->length_dw++] = PACKET0(adev->vcn.internal.data0, 0); + ib->ptr[ib->length_dw++] = lower_32_bits(session_ctx_buf_gaddr); + ib->ptr[ib->length_dw++] = PACKET0(adev->vcn.internal.data1, 0); + ib->ptr[ib->length_dw++] = upper_32_bits(session_ctx_buf_gaddr); + /* session ctx buffer cmd */ + ib->ptr[ib->length_dw++] = PACKET0(adev->vcn.internal.cmd, 0xa); + ib->ptr[ib->length_dw++] = 0; + for (i = ib->length_dw; i < 32; i += 2) { + ib->ptr[i] = PACKET0(adev->vcn.internal.nop, 0); + ib->ptr[i+1] = 0; + } + ib->length_dw = 32; + r = amdgpu_job_submit_direct(job, ring, ); if (r) goto err_free; -- 2.25.1
Re: [PATCH 09/17] auxdisplay: Remove flag FBINFO_FLAG_DEFAULT from fbdev drivers
On Mon, Jul 10, 2023 at 5:22 PM Thomas Zimmermann wrote: > > I'll append a patch to the series that documents this. > > Sure. Thanks! If you are planning to take it into some other tree: Acked-by: Miguel Ojeda Otherwise, I can take it into the `auxdisplay` tree. Cheers, Miguel
Re: [PATCH v2] drm/amdgpu: Increase soft IH ring size
On 2023-07-10 06:54, Christian König wrote: Am 07.07.23 um 17:49 schrieb Philip Yang: Retry faults are delegated to soft IH ring and then processed by deferred worker. Current soft IH ring size PAGE_SIZE can store 128 entries, which may overflow and drop retry faults, causes HW stucks because the retry fault is not recovered. Increase soft IH ring size to 8KB, enough to store 256 CAM entries because we clear the CAM entry after handling the retry fault from soft ring. Define macro IH_RING_SIZE and IH_SW_RING_SIZE to remove duplicate constant. Show warning message if soft IH ring overflows because this should not happen. Signed-off-by: Philip Yang --- drivers/gpu/drm/amd/amdgpu/amdgpu_ih.c | 8 ++-- drivers/gpu/drm/amd/amdgpu/amdgpu_ih.h | 7 +-- drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c | 2 +- drivers/gpu/drm/amd/amdgpu/ih_v6_0.c | 4 ++-- drivers/gpu/drm/amd/amdgpu/navi10_ih.c | 4 ++-- drivers/gpu/drm/amd/amdgpu/vega10_ih.c | 4 ++-- drivers/gpu/drm/amd/amdgpu/vega20_ih.c | 4 ++-- 7 files changed, 20 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ih.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ih.c index fceb3b384955..51a0dbd2358a 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ih.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ih.c @@ -138,6 +138,7 @@ void amdgpu_ih_ring_fini(struct amdgpu_device *adev, struct amdgpu_ih_ring *ih) /** * amdgpu_ih_ring_write - write IV to the ring buffer * + * @adev: amdgpu_device pointer * @ih: ih ring to write to * @iv: the iv to write * @num_dw: size of the iv in dw @@ -145,8 +146,8 @@ void amdgpu_ih_ring_fini(struct amdgpu_device *adev, struct amdgpu_ih_ring *ih) * Writes an IV to the ring buffer using the CPU and increment the wptr. * Used for testing and delegating IVs to a software ring. */ -void amdgpu_ih_ring_write(struct amdgpu_ih_ring *ih, const uint32_t *iv, - unsigned int num_dw) +void amdgpu_ih_ring_write(struct amdgpu_device *adev, struct amdgpu_ih_ring *ih, + const uint32_t *iv, unsigned int num_dw) { uint32_t wptr = le32_to_cpu(*ih->wptr_cpu) >> 2; unsigned int i; @@ -161,6 +162,9 @@ void amdgpu_ih_ring_write(struct amdgpu_ih_ring *ih, const uint32_t *iv, if (wptr != READ_ONCE(ih->rptr)) { wmb(); WRITE_ONCE(*ih->wptr_cpu, cpu_to_le32(wptr)); + } else { + dev_warn(adev->dev, "IH soft ring buffer overflow 0x%X, 0x%X\n", + wptr, ih->rptr); } } diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ih.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_ih.h index dd1c2eded6b9..6c6184f0dbc1 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ih.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ih.h @@ -27,6 +27,9 @@ /* Maximum number of IVs processed at once */ #define AMDGPU_IH_MAX_NUM_IVS 32 +#define IH_RING_SIZE (256 * 1024) +#define IH_SW_RING_SIZE (8 * 1024) /* enough for 256 CAM entries */ + Please add an AMDGPU_ prefix to the macro name and don't put comments on the same line as the macro. I have pushed this, will wait longer for comment in future. Thanks. Apart from that looks good to me, Christian. struct amdgpu_device; struct amdgpu_iv_entry; @@ -97,8 +100,8 @@ struct amdgpu_ih_funcs { int amdgpu_ih_ring_init(struct amdgpu_device *adev, struct amdgpu_ih_ring *ih, unsigned ring_size, bool use_bus_addr); void amdgpu_ih_ring_fini(struct amdgpu_device *adev, struct amdgpu_ih_ring *ih); -void
Re: [PATCH 09/17] auxdisplay: Remove flag FBINFO_FLAG_DEFAULT from fbdev drivers
Hi Am 10.07.23 um 16:24 schrieb Miguel Ojeda: On Mon, Jul 10, 2023 at 3:01 PM Thomas Zimmermann wrote: The flag FBINFO_FLAG_DEFAULT is 0 and has no effect, as struct fbinfo.flags has been allocated to zero by framebuffer_alloc(). So do not set it. `framebuffer_alloc()` does indeed use `kzalloc()`, but the docs do not mention the zeroing. Should that guarantee be documented? I'll append a patch to the series that documents this. Flags should signal differences from the default values. After cleaning up all occurences of FBINFO_FLAG_DEFAULT, the token can be removed. occurences -> occurrences can -> will maybe? Since the intention of the patch series is to remove it (them) altogether). Sure. Best regards Thomas Thanks! Cheers, Miguel -- Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Frankenstrasse 146, 90461 Nuernberg, Germany GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman HRB 36809 (AG Nuernberg) OpenPGP_signature Description: OpenPGP digital signature
Re: [PATCH 09/17] auxdisplay: Remove flag FBINFO_FLAG_DEFAULT from fbdev drivers
On Mon, Jul 10, 2023 at 3:01 PM Thomas Zimmermann wrote: > > The flag FBINFO_FLAG_DEFAULT is 0 and has no effect, as struct > fbinfo.flags has been allocated to zero by framebuffer_alloc(). So do > not set it. `framebuffer_alloc()` does indeed use `kzalloc()`, but the docs do not mention the zeroing. Should that guarantee be documented? > Flags should signal differences from the default values. After cleaning > up all occurences of FBINFO_FLAG_DEFAULT, the token can be removed. occurences -> occurrences can -> will maybe? Since the intention of the patch series is to remove it (them) altogether). Thanks! Cheers, Miguel
Re: [PATCH 08/17] arch/sh: Do not assign FBINFO_FLAG_DEFAULT to fb_videomode.flag
Hi Thomas! On Mon, 2023-07-10 at 14:50 +0200, Thomas Zimmermann wrote: > FBINFO_FLAG_DEFAULT is a flag for a framebuffer in struct fb_info. > Flags for videomodes are prefixed with FB_MODE_. FBINFO_FLAG_DEFAULT > is 0 and the static declaration already clears the memory area of > sh7763fb_videomode. So remove the assignment. > > Signed-off-by: Thomas Zimmermann > Cc: Yoshinori Sato > Cc: Rich Felker > Cc: John Paul Adrian Glaubitz > --- > arch/sh/boards/mach-sh7763rdp/setup.c | 1 - > 1 file changed, 1 deletion(-) > > diff --git a/arch/sh/boards/mach-sh7763rdp/setup.c > b/arch/sh/boards/mach-sh7763rdp/setup.c > index 97e715e4e9b3..345f2b76c85a 100644 > --- a/arch/sh/boards/mach-sh7763rdp/setup.c > +++ b/arch/sh/boards/mach-sh7763rdp/setup.c > @@ -119,7 +119,6 @@ static struct fb_videomode sh7763fb_videomode = { > .vsync_len = 1, > .sync = 0, > .vmode = FB_VMODE_NONINTERLACED, > - .flag = FBINFO_FLAG_DEFAULT, > }; > > static struct sh7760fb_platdata sh7763fb_def_pdata = { I would argue that the current code is more readable that your proposed change. I agree that it's a no-op, but code is not just about functionality but also readability, isn't it? Also, I prefer "sh:" as the architecture prefix, not "arch/sh:". Thanks, Adrian -- .''`. John Paul Adrian Glaubitz : :' : Debian Developer `. `' Physicist `-GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913
Re: [PATCH 08/17] arch/sh: Do not assign FBINFO_FLAG_DEFAULT to fb_videomode.flag
Hi Thomas! On Mon, 2023-07-10 at 15:52 +0200, Thomas Zimmermann wrote: > > I would argue that the current code is more readable that your proposed > > change. > > > > I agree that it's a no-op, but code is not just about functionality but also > > readability, isn't it? > > I won't argue with that, but the flag itself is wrong. > FBINFO_FLAG_DEFAULT is/was for struct fb_info.flags. You have struct > fb_videomode.flag. The valid flags for this field are at [1]. If > anything, the field could be initialized to FB_MODE_IS_UNKNOWN, which > has the same value. > > [1] https://elixir.bootlin.com/linux/latest/source/include/linux/fb.h#L681 FB_MODE_IS_UNKNOWN sounds very reasonable to me. Would you agree using that instead? > > > > Also, I prefer "sh:" as the architecture prefix, not "arch/sh:". > > Ok. Thanks. Adrian -- .''`. John Paul Adrian Glaubitz : :' : Debian Developer `. `' Physicist `-GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913
Re: [PATCH 08/17] arch/sh: Do not assign FBINFO_FLAG_DEFAULT to fb_videomode.flag
Hi! On Mon, 2023-07-10 at 16:04 +0200, Thomas Zimmermann wrote: > > > I won't argue with that, but the flag itself is wrong. > > > FBINFO_FLAG_DEFAULT is/was for struct fb_info.flags. You have struct > > > fb_videomode.flag. The valid flags for this field are at [1]. If > > > anything, the field could be initialized to FB_MODE_IS_UNKNOWN, which > > > has the same value. > > > > > > [1] https://elixir.bootlin.com/linux/latest/source/include/linux/fb.h#L681 > > > > FB_MODE_IS_UNKNOWN sounds very reasonable to me. Would you agree using that > > instead? > > Sure, I'll update the patch accordingly. Thanks! I'll ack the updated patch. Adrian -- .''`. John Paul Adrian Glaubitz : :' : Debian Developer `. `' Physicist `-GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913
Re: [PATCH 08/17] arch/sh: Do not assign FBINFO_FLAG_DEFAULT to fb_videomode.flag
Hi Am 10.07.23 um 15:59 schrieb John Paul Adrian Glaubitz: Hi Thomas! On Mon, 2023-07-10 at 15:52 +0200, Thomas Zimmermann wrote: I would argue that the current code is more readable that your proposed change. I agree that it's a no-op, but code is not just about functionality but also readability, isn't it? I won't argue with that, but the flag itself is wrong. FBINFO_FLAG_DEFAULT is/was for struct fb_info.flags. You have struct fb_videomode.flag. The valid flags for this field are at [1]. If anything, the field could be initialized to FB_MODE_IS_UNKNOWN, which has the same value. [1] https://elixir.bootlin.com/linux/latest/source/include/linux/fb.h#L681 FB_MODE_IS_UNKNOWN sounds very reasonable to me. Would you agree using that instead? Sure, I'll update the patch accordingly. Best regards Thomas Also, I prefer "sh:" as the architecture prefix, not "arch/sh:". Ok. Thanks. Adrian -- Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Frankenstrasse 146, 90461 Nuernberg, Germany GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman HRB 36809 (AG Nuernberg) OpenPGP_signature Description: OpenPGP digital signature
RE: [PATCH v2 2/2] drm/amdgpu: update kernel vcn ring test
[AMD Official Use Only - General] -Original Message- From: Jamadar, Saleemkhan Sent: Monday, July 10, 2023 4:24 AM To: Jamadar, Saleemkhan ; amd-gfx@lists.freedesktop.org; Liu, Leo ; Gopalakrishnan, Veerabadhran (Veera) ; Sundararaju, Sathishkumar Cc: Koenig, Christian ; Rao, Srinath Subject: [PATCH v2 2/2] drm/amdgpu: update kernel vcn ring test add session context buffer to decoder ring test for vcn v1 to v3. v2 - add the buffer into IB (Leo liu) Signed-off-by: Saleemkhan Jamadar --- drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 12 1 file changed, 12 insertions(+) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c index 76e9a2418286..4c44d76f69de 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c @@ -521,6 +521,7 @@ static int amdgpu_vcn_dec_send_msg(struct amdgpu_ring *ring, struct dma_fence **fence) { u64 addr = AMDGPU_GPU_PAGE_ALIGN(ib_msg->gpu_addr); + uint64_t session_ctx_buf_gaddr = AMDGPU_GPU_PAGE_ALIGN(ib_msg->gpu_addr + 8192); struct amdgpu_device *adev = ring->adev; struct dma_fence *f = NULL; struct amdgpu_job *job; @@ -546,6 +547,17 @@ static int amdgpu_vcn_dec_send_msg(struct amdgpu_ring *ring, } ib->length_dw = 16; + ib->ptr[ib->length_dw++] = PACKET0(adev->vcn.internal.data0, 0); + ib->ptr[ib->length_dw++] = lower_32_bits(session_ctx_buf_gaddr); + ib->ptr[ib->length_dw++] = PACKET0(adev->vcn.internal.data1, 0); + ib->ptr[ib->length_dw++] = upper_32_bits(session_ctx_buf_gaddr); + ib->ptr[ib->length_dw++] = PACKET0(adev->vcn.internal.cmd, 0); + ib->ptr[ib->length_dw++] = 0; This is not right. Again please check with Mesa. + for (i = ib->length_dw; i < 32; i += 2) { + ib->ptr[i] = PACKET0(adev->vcn.internal.nop, 0); + ib->ptr[i+1] = 0; + } + Do we need update the ib length? Regards, Leo r = amdgpu_job_submit_direct(job, ring, ); if (r) goto err_free; -- 2.25.1
Re: [PATCH 08/17] arch/sh: Do not assign FBINFO_FLAG_DEFAULT to fb_videomode.flag
Hi Am 10.07.23 um 15:42 schrieb John Paul Adrian Glaubitz: Hi Thomas! On Mon, 2023-07-10 at 14:50 +0200, Thomas Zimmermann wrote: FBINFO_FLAG_DEFAULT is a flag for a framebuffer in struct fb_info. Flags for videomodes are prefixed with FB_MODE_. FBINFO_FLAG_DEFAULT is 0 and the static declaration already clears the memory area of sh7763fb_videomode. So remove the assignment. Signed-off-by: Thomas Zimmermann Cc: Yoshinori Sato Cc: Rich Felker Cc: John Paul Adrian Glaubitz --- arch/sh/boards/mach-sh7763rdp/setup.c | 1 - 1 file changed, 1 deletion(-) diff --git a/arch/sh/boards/mach-sh7763rdp/setup.c b/arch/sh/boards/mach-sh7763rdp/setup.c index 97e715e4e9b3..345f2b76c85a 100644 --- a/arch/sh/boards/mach-sh7763rdp/setup.c +++ b/arch/sh/boards/mach-sh7763rdp/setup.c @@ -119,7 +119,6 @@ static struct fb_videomode sh7763fb_videomode = { .vsync_len = 1, .sync = 0, .vmode = FB_VMODE_NONINTERLACED, - .flag = FBINFO_FLAG_DEFAULT, }; static struct sh7760fb_platdata sh7763fb_def_pdata = { I would argue that the current code is more readable that your proposed change. I agree that it's a no-op, but code is not just about functionality but also readability, isn't it? I won't argue with that, but the flag itself is wrong. FBINFO_FLAG_DEFAULT is/was for struct fb_info.flags. You have struct fb_videomode.flag. The valid flags for this field are at [1]. If anything, the field could be initialized to FB_MODE_IS_UNKNOWN, which has the same value. [1] https://elixir.bootlin.com/linux/latest/source/include/linux/fb.h#L681 Also, I prefer "sh:" as the architecture prefix, not "arch/sh:". Ok. Best regards Thomas Thanks, Adrian -- Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Frankenstrasse 146, 90461 Nuernberg, Germany GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman HRB 36809 (AG Nuernberg) OpenPGP_signature Description: OpenPGP digital signature
RE: [PATCH v3] drm/amdkfd: Fix stack size in 'amdgpu_amdkfd_unmap_hiq'
[AMD Official Use Only - General] Thanks for looking into this. I got an email about this from kernel test robot, can you add this also to the commit message: Reported-by: kernel test robot Closes: https://lore.kernel.org/oe-kbuild-all/202307080505.v12qs0oz-...@intel.com Reviewed-by: Mukul Joshi > -Original Message- > From: amd-gfx On Behalf Of > Srinivasan Shanmugam > Sent: Sunday, July 9, 2023 11:22 PM > To: Koenig, Christian ; Deucher, Alexander > ; Kuehling, Felix ; > Chen, Guchun > Cc: SHANMUGAM, SRINIVASAN ; > amd-gfx@lists.freedesktop.org > Subject: [PATCH v3] drm/amdkfd: Fix stack size in > 'amdgpu_amdkfd_unmap_hiq' > > Caution: This message originated from an External Source. Use proper caution > when opening attachments, clicking links, or responding. > > > Allocate large local variable on heap to avoid exceeding the stack size: > drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c: In function > ‘amdgpu_amdkfd_unmap_hiq’: > drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c:868:1: warning: the > frame size of 1280 bytes is larger than 1024 bytes [-Wframe-larger-than=] > > Suggested-by: Guchun Chen > Cc: Felix Kuehling > Cc: Christian König > Cc: Alex Deucher > Signed-off-by: Srinivasan Shanmugam > --- > > v3: > - free ring_funcs before 'return -ENOMEM' (Guchun). > - keep the check of ' kiq->pmf' and 'kiq->pmf->kiq_unmap_queues' ahead >of allocation of ring & ring_funcs (Guchun). > > drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c | 32 > -- > 1 file changed, 23 insertions(+), 9 deletions(-) > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c > b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c > index 0040c63e2356..629ca1ad75a8 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_amdkfd.c > @@ -836,33 +836,47 @@ int amdgpu_amdkfd_unmap_hiq(struct > amdgpu_device *adev, u32 doorbell_off, { > struct amdgpu_kiq *kiq = >gfx.kiq[inst]; > struct amdgpu_ring *kiq_ring = >ring; > - struct amdgpu_ring_funcs ring_funcs; > - struct amdgpu_ring ring; > + struct amdgpu_ring_funcs *ring_funcs; > + struct amdgpu_ring *ring; > int r = 0; > > if (!kiq->pmf || !kiq->pmf->kiq_unmap_queues) > return -EINVAL; > > - memset(, 0x0, sizeof(struct amdgpu_ring)); > - memset(_funcs, 0x0, sizeof(struct amdgpu_ring_funcs)); > + ring_funcs = kzalloc(sizeof(*ring_funcs), GFP_KERNEL); > + if (!ring_funcs) > + return -ENOMEM; > + > + ring = kzalloc(sizeof(*ring), GFP_KERNEL); > + if (!ring) { > + r = -ENOMEM; > + goto free_ring_funcs; > + } > > - ring_funcs.type = AMDGPU_RING_TYPE_COMPUTE; > - ring.doorbell_index = doorbell_off; > - ring.funcs = _funcs; > + ring_funcs->type = AMDGPU_RING_TYPE_COMPUTE; > + ring->doorbell_index = doorbell_off; > + ring->funcs = ring_funcs; > > spin_lock(>ring_lock); > > if (amdgpu_ring_alloc(kiq_ring, kiq->pmf->unmap_queues_size)) { > spin_unlock(>ring_lock); > - return -ENOMEM; > + r = -ENOMEM; > + goto free_ring; > } > > - kiq->pmf->kiq_unmap_queues(kiq_ring, , RESET_QUEUES, 0, 0); > + kiq->pmf->kiq_unmap_queues(kiq_ring, ring, RESET_QUEUES, 0, 0); > > if (kiq_ring->sched.ready && !adev->job_hang) > r = amdgpu_ring_test_helper(kiq_ring); > > spin_unlock(>ring_lock); > > +free_ring: > + kfree(ring); > + > +free_ring_funcs: > + kfree(ring_funcs); > + > return r; > } > -- > 2.25.1 <>
[PATCH] drm/radeon: ERROR: that open brace { should be on the previous line
Fix eleven occurrences of the checkpatch.pl error: ERROR: that open brace { should be on the previous line Signed-off-by: Ran Sun --- drivers/gpu/drm/radeon/rv770.c | 22 +++--- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/radeon/rv770.c b/drivers/gpu/drm/radeon/rv770.c index a5ce59d4a485..9ce12fa3c356 100644 --- a/drivers/gpu/drm/radeon/rv770.c +++ b/drivers/gpu/drm/radeon/rv770.c @@ -136,7 +136,7 @@ int rv770_set_uvd_clocks(struct radeon_device *rdev, u32 vclk, u32 dclk) return 0; } -static const u32 r7xx_golden_registers[] ={ +static const u32 r7xx_golden_registers[] = { 0x8d00, 0x, 0x0e0e0074, 0x8d04, 0x, 0x013a2b34, 0x9508, 0x, 0x0002, @@ -151,7 +151,7 @@ static const u32 r7xx_golden_registers[] ={ 0x7300, 0x, 0x001000f0 }; -static const u32 r7xx_golden_dyn_gpr_registers[] ={ +static const u32 r7xx_golden_dyn_gpr_registers[] = { 0x8db0, 0x, 0x98989898, 0x8db4, 0x, 0x98989898, 0x8db8, 0x, 0x98989898, @@ -163,7 +163,7 @@ static const u32 r7xx_golden_dyn_gpr_registers[] ={ 0x88c4, 0x, 0x0082 }; -static const u32 rv770_golden_registers[] ={ +static const u32 rv770_golden_registers[] = { 0x562c, 0x, 0, 0x3f90, 0x, 0, 0x9148, 0x, 0, @@ -172,7 +172,7 @@ static const u32 rv770_golden_registers[] ={ 0x9698, 0x1800, 0x1800 }; -static const u32 rv770ce_golden_registers[] ={ +static const u32 rv770ce_golden_registers[] = { 0x562c, 0x, 0, 0x3f90, 0x, 0x00cc, 0x9148, 0x, 0x00cc, @@ -183,7 +183,7 @@ static const u32 rv770ce_golden_registers[] ={ 0x9698, 0x1800, 0x1800 }; -static const u32 rv770_mgcg_init[] ={ +static const u32 rv770_mgcg_init[] = { 0x8bcc, 0x, 0x130300f9, 0x5448, 0x, 0x100, 0x55e4, 0x, 0x100, @@ -340,7 +340,7 @@ static const u32 rv770_mgcg_init[] ={ 0x92a4, 0x, 0x00080007 }; -static const u32 rv710_golden_registers[] ={ +static const u32 rv710_golden_registers[] = { 0x3f90, 0x00ff, 0x00fc, 0x9148, 0x00ff, 0x00fc, 0x3f94, 0x00ff, 0x00fc, @@ -349,7 +349,7 @@ static const u32 rv710_golden_registers[] ={ 0xa180, 0x, 0x3f3f }; -static const u32 rv710_mgcg_init[] ={ +static const u32 rv710_mgcg_init[] = { 0x8bcc, 0x, 0x13030040, 0x5448, 0x, 0x100, 0x55e4, 0x, 0x100, @@ -407,7 +407,7 @@ static const u32 rv710_mgcg_init[] ={ 0x9150, 0x, 0x4d94 }; -static const u32 rv730_golden_registers[] ={ +static const u32 rv730_golden_registers[] = { 0x3f90, 0x00ff, 0x00f0, 0x9148, 0x00ff, 0x00f0, 0x3f94, 0x00ff, 0x00f0, @@ -417,7 +417,7 @@ static const u32 rv730_golden_registers[] ={ 0xa180, 0x, 0x3f3f }; -static const u32 rv730_mgcg_init[] ={ +static const u32 rv730_mgcg_init[] = { 0x8bcc, 0x, 0x130300f9, 0x5448, 0x, 0x100, 0x55e4, 0x, 0x100, @@ -538,7 +538,7 @@ static const u32 rv730_mgcg_init[] ={ 0x92a4, 0x, 0x0005 }; -static const u32 rv740_golden_registers[] ={ +static const u32 rv740_golden_registers[] = { 0x88c4, 0x, 0x0082, 0x28a50, 0xfffc, 0x0004, 0x2650, 0x0004, 0, @@ -574,7 +574,7 @@ static const u32 rv740_golden_registers[] ={ 0x9698, 0x1800, 0x1800 }; -static const u32 rv740_mgcg_init[] ={ +static const u32 rv740_mgcg_init[] = { 0x8bcc, 0x, 0x13030100, 0x5448, 0x, 0x100, 0x55e4, 0x, 0x100,
Re: [PATCH 10/17] hid/picolcd: Remove flag FBINFO_FLAG_DEFAULT from fbdev driver
On Mon, Jul 10, 2023 at 3:01 PM Thomas Zimmermann wrote: > > The flag FBINFO_FLAG_DEFAULT is 0 and has no effect, as struct > fbinfo.flags has been allocated to zero by framebuffer_alloc(). So do > not set it. > > Flags should signal differences from the default values. After cleaning > up all occurences of FBINFO_FLAG_DEFAULT, the token can be removed. > > Signed-off-by: Thomas Zimmermann > Cc: "Bruno Prémont" > Cc: Jiri Kosina > Cc: Benjamin Tissoires Acked-by: Benjamin Tissoires Feel free to take this through the DRI tree (or any other that handles FB) with the rest of the series if you want. Cheers, Benjamin > --- > drivers/hid/hid-picolcd_fb.c | 1 - > 1 file changed, 1 deletion(-) > > diff --git a/drivers/hid/hid-picolcd_fb.c b/drivers/hid/hid-picolcd_fb.c > index dabcd054dad9..d726aaafb146 100644 > --- a/drivers/hid/hid-picolcd_fb.c > +++ b/drivers/hid/hid-picolcd_fb.c > @@ -527,7 +527,6 @@ int picolcd_init_framebuffer(struct picolcd_data *data) > info->var = picolcdfb_var; > info->fix = picolcdfb_fix; > info->fix.smem_len = PICOLCDFB_SIZE*8; > - info->flags = FBINFO_FLAG_DEFAULT; > > fbdata = info->par; > spin_lock_init(>lock); > -- > 2.41.0 >
[PATCH] drm/radeon: ERROR: "foo * bar" should be "foo *bar"
Fix nine occurrences of the checkpatch.pl error: ERROR: "foo * bar" should be "foo *bar" Signed-off-by: Ran Sun --- drivers/gpu/drm/radeon/atom.c | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/radeon/atom.c b/drivers/gpu/drm/radeon/atom.c index c1bbfbe28bda..11a1940bb26d 100644 --- a/drivers/gpu/drm/radeon/atom.c +++ b/drivers/gpu/drm/radeon/atom.c @@ -1156,7 +1156,7 @@ static struct { atom_op_shr, ATOM_ARG_MC}, { atom_op_debug, 0},}; -static int atom_execute_table_locked(struct atom_context *ctx, int index, uint32_t * params) +static int atom_execute_table_locked(struct atom_context *ctx, int index, uint32_t *params) { int base = CU16(ctx->cmd_table + 4 + 2 * index); int len, ws, ps, ptr; @@ -1216,7 +1216,7 @@ static int atom_execute_table_locked(struct atom_context *ctx, int index, uint32 return ret; } -int atom_execute_table_scratch_unlocked(struct atom_context *ctx, int index, uint32_t * params) +int atom_execute_table_scratch_unlocked(struct atom_context *ctx, int index, uint32_t *params) { int r; @@ -1237,7 +1237,7 @@ int atom_execute_table_scratch_unlocked(struct atom_context *ctx, int index, uin return r; } -int atom_execute_table(struct atom_context *ctx, int index, uint32_t * params) +int atom_execute_table(struct atom_context *ctx, int index, uint32_t *params) { int r; mutex_lock(>scratch_mutex); @@ -1359,8 +1359,8 @@ void atom_destroy(struct atom_context *ctx) } bool atom_parse_data_header(struct atom_context *ctx, int index, -uint16_t * size, uint8_t * frev, uint8_t * crev, -uint16_t * data_start) +uint16_t *size, uint8_t *frev, uint8_t *crev, +uint16_t *data_start) { int offset = index * 2 + 4; int idx = CU16(ctx->data_table + offset); @@ -1379,8 +1379,8 @@ bool atom_parse_data_header(struct atom_context *ctx, int index, return true; } -bool atom_parse_cmd_header(struct atom_context *ctx, int index, uint8_t * frev, - uint8_t * crev) +bool atom_parse_cmd_header(struct atom_context *ctx, int index, uint8_t *frev, + uint8_t *crev) { int offset = index * 2 + 4; int idx = CU16(ctx->cmd_table + offset);
[PATCH] drm/radeon: ERROR: "(foo*)" should be "(foo *)"
Fix four occurrences of the checkpatch.pl error: ERROR: "(foo*)" should be "(foo *)" Signed-off-by: Ran Sun --- drivers/gpu/drm/radeon/radeon_atombios.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/radeon/radeon_atombios.c b/drivers/gpu/drm/radeon/radeon_atombios.c index bf3c411a55c5..85c4bb186203 100644 --- a/drivers/gpu/drm/radeon/radeon_atombios.c +++ b/drivers/gpu/drm/radeon/radeon_atombios.c @@ -1389,7 +1389,7 @@ bool radeon_atombios_get_ppll_ss_info(struct radeon_device *rdev, num_indices = (size - sizeof(ATOM_COMMON_TABLE_HEADER)) / sizeof(ATOM_SPREAD_SPECTRUM_ASSIGNMENT); -ss_assign = (struct _ATOM_SPREAD_SPECTRUM_ASSIGNMENT*) +ss_assign = (struct _ATOM_SPREAD_SPECTRUM_ASSIGNMENT *) ((u8 *)_info->asSS_Info[0]); for (i = 0; i < num_indices; i++) { if (ss_assign->ucSS_Id == id) { @@ -1402,7 +1402,7 @@ bool radeon_atombios_get_ppll_ss_info(struct radeon_device *rdev, ss->refdiv = ss_assign->ucRecommendedRef_Div; return true; } -ss_assign = (struct _ATOM_SPREAD_SPECTRUM_ASSIGNMENT*) +ss_assign = (struct _ATOM_SPREAD_SPECTRUM_ASSIGNMENT *) ((u8 *)ss_assign + sizeof(struct _ATOM_SPREAD_SPECTRUM_ASSIGNMENT)); } } @@ -3406,7 +3406,7 @@ static ATOM_VOLTAGE_OBJECT_V2 *atom_lookup_voltage_object_v2(ATOM_VOLTAGE_OBJECT { u32 size = le16_to_cpu(v2->sHeader.usStructureSize); u32 offset = offsetof(ATOM_VOLTAGE_OBJECT_INFO_V2, asVoltageObj[0]); -u8 *start = (u8*)v2; +u8 *start = (u8 *)v2; while (offset < size) { ATOM_VOLTAGE_OBJECT_V2 *vo = (ATOM_VOLTAGE_OBJECT_V2 *)(start + offset); @@ -3423,7 +3423,7 @@ static ATOM_VOLTAGE_OBJECT_V3 *atom_lookup_voltage_object_v3(ATOM_VOLTAGE_OBJECT { u32 size = le16_to_cpu(v3->sHeader.usStructureSize); u32 offset = offsetof(ATOM_VOLTAGE_OBJECT_INFO_V3_1, asVoltageObj[0]); -u8 *start = (u8*)v3; +u8 *start = (u8 *)v3; while (offset < size) { ATOM_VOLTAGE_OBJECT_V3 *vo = (ATOM_VOLTAGE_OBJECT_V3 *)(start + offset);
[PATCH] drm/radeon: ERROR: "(foo*)" should be "(foo *)"
Fix four occurrences of the checkpatch.pl error: ERROR: "(foo*)" should be "(foo *)" Signed-off-by: Ran Sun --- drivers/gpu/drm/radeon/radeon_test.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/radeon/radeon_test.c b/drivers/gpu/drm/radeon/radeon_test.c index a5e1d2139e80..c9fef9b61ced 100644 --- a/drivers/gpu/drm/radeon/radeon_test.c +++ b/drivers/gpu/drm/radeon/radeon_test.c @@ -156,10 +156,10 @@ static void radeon_do_test_moves(struct radeon_device *rdev, int flag) i, *vram_start, gtt_start, (unsigned long long) (gtt_addr - rdev->mc.gtt_start + - (void*)gtt_start - gtt_map), + (void *)gtt_start - gtt_map), (unsigned long long) (vram_addr - rdev->mc.vram_start + - (void*)gtt_start - gtt_map)); + (void *)gtt_start - gtt_map)); radeon_bo_kunmap(vram_obj); goto out_lclean_unpin; } @@ -207,10 +207,10 @@ static void radeon_do_test_moves(struct radeon_device *rdev, int flag) i, *gtt_start, vram_start, (unsigned long long) (vram_addr - rdev->mc.vram_start + - (void*)vram_start - vram_map), + (void *)vram_start - vram_map), (unsigned long long) (gtt_addr - rdev->mc.gtt_start + - (void*)vram_start - vram_map)); + (void *)vram_start - vram_map)); radeon_bo_kunmap(gtt_obj[i]); goto out_lclean_unpin; }
[PATCH 05/17] fbdev: Remove flag FBINFO_DEFAULT from fbdev drivers
The flag FBINFO_DEFAULT is 0 and has no effect, as struct fbinfo.flags has been allocated to zero by framebuffer_alloc(). So do not set it. Flags should signal differences from the default values. After cleaning up all occurences of FBINFO_DEFAULT, the token can be removed. Signed-off-by: Thomas Zimmermann Cc: Helge Deller Cc: Nicolas Ferre Cc: Benjamin Herrenschmidt Cc: Ferenc Bakonyi Cc: "K. Y. Srinivasan" Cc: Haiyang Zhang Cc: Wei Liu Cc: Dexuan Cui Cc: Antonino Daplas Cc: Maik Broemme Cc: Michael Ellerman Cc: Nicholas Piggin Cc: Christophe Leroy Cc: Kristoffer Ericson Cc: Hans de Goede Cc: Steve Glendinning Cc: Bernie Thompson Cc: Florian Tobias Schandinat --- drivers/video/fbdev/amifb.c | 5 ++--- drivers/video/fbdev/asiliantfb.c | 1 - drivers/video/fbdev/atmel_lcdfb.c| 2 +- drivers/video/fbdev/aty/atyfb_base.c | 3 +-- drivers/video/fbdev/aty/radeon_base.c| 3 +-- drivers/video/fbdev/bw2.c| 1 - drivers/video/fbdev/carminefb.c | 1 - drivers/video/fbdev/cg14.c | 2 +- drivers/video/fbdev/cg3.c| 1 - drivers/video/fbdev/cg6.c| 2 +- drivers/video/fbdev/chipsfb.c| 1 - drivers/video/fbdev/cirrusfb.c | 3 +-- drivers/video/fbdev/clps711x-fb.c| 1 - drivers/video/fbdev/cobalt_lcdfb.c | 1 - drivers/video/fbdev/ep93xx-fb.c | 1 - drivers/video/fbdev/ffb.c| 3 +-- drivers/video/fbdev/fm2fb.c | 1 - drivers/video/fbdev/gbefb.c | 1 - drivers/video/fbdev/geode/gx1fb_core.c | 1 - drivers/video/fbdev/geode/gxfb_core.c| 1 - drivers/video/fbdev/geode/lxfb_core.c| 1 - drivers/video/fbdev/grvga.c | 2 +- drivers/video/fbdev/hgafb.c | 2 +- drivers/video/fbdev/hitfb.c | 2 +- drivers/video/fbdev/hyperv_fb.c | 2 -- drivers/video/fbdev/i740fb.c | 2 +- drivers/video/fbdev/i810/i810_main.c | 4 ++-- drivers/video/fbdev/imsttfb.c| 3 +-- drivers/video/fbdev/intelfb/intelfbdrv.c | 4 ++-- drivers/video/fbdev/kyro/fbdev.c | 1 - drivers/video/fbdev/leo.c| 1 - drivers/video/fbdev/mb862xx/mb862xxfbdrv.c | 2 +- drivers/video/fbdev/mmp/fb/mmpfb.c | 2 +- drivers/video/fbdev/neofb.c | 2 +- drivers/video/fbdev/nvidia/nvidia.c | 4 ++-- drivers/video/fbdev/offb.c | 2 +- drivers/video/fbdev/p9100.c | 1 - drivers/video/fbdev/platinumfb.c | 1 - drivers/video/fbdev/pm2fb.c | 3 +-- drivers/video/fbdev/pm3fb.c | 3 +-- drivers/video/fbdev/pmag-aa-fb.c | 1 - drivers/video/fbdev/pmag-ba-fb.c | 1 - drivers/video/fbdev/pmagb-b-fb.c | 1 - drivers/video/fbdev/ps3fb.c | 2 +- drivers/video/fbdev/pvr2fb.c | 2 +- drivers/video/fbdev/pxa168fb.c | 2 +- drivers/video/fbdev/q40fb.c | 1 - drivers/video/fbdev/riva/fbdev.c | 3 +-- drivers/video/fbdev/s1d13xxxfb.c | 4 ++-- drivers/video/fbdev/savage/savagefb_driver.c | 3 +-- drivers/video/fbdev/simplefb.c | 1 - drivers/video/fbdev/sis/sis_main.c | 3 +-- drivers/video/fbdev/skeletonfb.c | 2 +- drivers/video/fbdev/smscufx.c| 2 +- drivers/video/fbdev/sstfb.c | 1 - drivers/video/fbdev/sunxvr1000.c | 1 - drivers/video/fbdev/sunxvr2500.c | 1 - drivers/video/fbdev/sunxvr500.c | 1 - drivers/video/fbdev/tcx.c| 1 - drivers/video/fbdev/tdfxfb.c | 2 +- drivers/video/fbdev/tgafb.c | 2 +- drivers/video/fbdev/tridentfb.c | 2 +- drivers/video/fbdev/udlfb.c | 2 +- drivers/video/fbdev/via/viafbdev.c | 2 +- 64 files changed, 41 insertions(+), 81 deletions(-) diff --git a/drivers/video/fbdev/amifb.c b/drivers/video/fbdev/amifb.c index d88265dbebf4..cea782283b9c 100644 --- a/drivers/video/fbdev/amifb.c +++ b/drivers/video/fbdev/amifb.c @@ -2427,7 +2427,7 @@ static int amifb_set_par(struct fb_info *info) info->fix.ywrapstep = 1; info->fix.xpanstep = 0; info->fix.ypanstep = 0; - info->flags = FBINFO_DEFAULT | FBINFO_HWACCEL_YWRAP | + info->flags = FBINFO_HWACCEL_YWRAP | FBINFO_READS_FAST; /* override SCROLL_REDRAW */ } else { info->fix.ywrapstep = 0; @@ -2436,7 +2436,7 @@ static int amifb_set_par(struct fb_info *info) else info->fix.xpanstep = 16 << maxfmode; info->fix.ypanstep = 1; - info->flags = FBINFO_DEFAULT |
[PATCH 09/17] auxdisplay: Remove flag FBINFO_FLAG_DEFAULT from fbdev drivers
The flag FBINFO_FLAG_DEFAULT is 0 and has no effect, as struct fbinfo.flags has been allocated to zero by framebuffer_alloc(). So do not set it. Flags should signal differences from the default values. After cleaning up all occurences of FBINFO_FLAG_DEFAULT, the token can be removed. Signed-off-by: Thomas Zimmermann Cc: Miguel Ojeda Cc: Robin van der Gracht --- drivers/auxdisplay/cfag12864bfb.c | 1 - drivers/auxdisplay/ht16k33.c | 1 - 2 files changed, 2 deletions(-) diff --git a/drivers/auxdisplay/cfag12864bfb.c b/drivers/auxdisplay/cfag12864bfb.c index c2cab7e2b126..729845bcc803 100644 --- a/drivers/auxdisplay/cfag12864bfb.c +++ b/drivers/auxdisplay/cfag12864bfb.c @@ -79,7 +79,6 @@ static int cfag12864bfb_probe(struct platform_device *device) info->var = cfag12864bfb_var; info->pseudo_palette = NULL; info->par = NULL; - info->flags = FBINFO_FLAG_DEFAULT; if (register_framebuffer(info) < 0) goto fballoced; diff --git a/drivers/auxdisplay/ht16k33.c b/drivers/auxdisplay/ht16k33.c index edaf92b7ea77..df3f37651e45 100644 --- a/drivers/auxdisplay/ht16k33.c +++ b/drivers/auxdisplay/ht16k33.c @@ -646,7 +646,6 @@ static int ht16k33_fbdev_probe(struct device *dev, struct ht16k33_priv *priv, fbdev->info->var = ht16k33_fb_var; fbdev->info->bl_dev = bl; fbdev->info->pseudo_palette = NULL; - fbdev->info->flags = FBINFO_FLAG_DEFAULT; fbdev->info->par = priv; err = register_framebuffer(fbdev->info); -- 2.41.0
[PATCH 11/17] media: Remove flag FBINFO_FLAG_DEFAULT from fbdev drivers
The flag FBINFO_FLAG_DEFAULT is 0 and has no effect, as struct fbinfo.flags has been allocated to zero by kzalloc(). So do not set it. Flags should signal differences from the default values. After cleaning up all occurences of FBINFO_FLAG_DEFAULT, the token can be removed. Signed-off-by: Thomas Zimmermann Cc: Andy Walls Cc: Mauro Carvalho Chehab Cc: Hans Verkuil --- drivers/media/pci/ivtv/ivtvfb.c | 1 - drivers/media/test-drivers/vivid/vivid-osd.c | 1 - 2 files changed, 2 deletions(-) diff --git a/drivers/media/pci/ivtv/ivtvfb.c b/drivers/media/pci/ivtv/ivtvfb.c index 0aeb9daaee4c..23c8c094e791 100644 --- a/drivers/media/pci/ivtv/ivtvfb.c +++ b/drivers/media/pci/ivtv/ivtvfb.c @@ -1048,7 +1048,6 @@ static int ivtvfb_init_vidmode(struct ivtv *itv) /* Generate valid fb_info */ oi->ivtvfb_info.node = -1; - oi->ivtvfb_info.flags = FBINFO_FLAG_DEFAULT; oi->ivtvfb_info.par = itv; oi->ivtvfb_info.var = oi->ivtvfb_defined; oi->ivtvfb_info.fix = oi->ivtvfb_fix; diff --git a/drivers/media/test-drivers/vivid/vivid-osd.c b/drivers/media/test-drivers/vivid/vivid-osd.c index ec25edc679b3..051f1805a16d 100644 --- a/drivers/media/test-drivers/vivid/vivid-osd.c +++ b/drivers/media/test-drivers/vivid/vivid-osd.c @@ -310,7 +310,6 @@ static int vivid_fb_init_vidmode(struct vivid_dev *dev) /* Generate valid fb_info */ dev->fb_info.node = -1; - dev->fb_info.flags = FBINFO_FLAG_DEFAULT; dev->fb_info.par = dev; dev->fb_info.var = dev->fb_defined; dev->fb_info.fix = dev->fb_fix; -- 2.41.0
[PATCH 16/17] fbdev/pxafb: Remove flag FBINFO_FLAG_DEFAULT
The flag FBINFO_FLAG_DEFAULT is 0 and has no effect, as struct fbinfo.flags has been allocated to zero by devm_kzalloc(). So do not set it. Flags should signal differences from the default values. After cleaning up all occurences of FBINFO_FLAG_DEFAULT, the token can be removed. Signed-off-by: Thomas Zimmermann Cc: Helge Deller --- drivers/video/fbdev/pxafb.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/video/fbdev/pxafb.c b/drivers/video/fbdev/pxafb.c index c8c4677d06b4..beffb0602a2c 100644 --- a/drivers/video/fbdev/pxafb.c +++ b/drivers/video/fbdev/pxafb.c @@ -888,7 +888,6 @@ static void init_pxafb_overlay(struct pxafb_info *fbi, struct pxafb_layer *ofb, ofb->fb.var.vmode = FB_VMODE_NONINTERLACED; ofb->fb.fbops = _fb_ops; - ofb->fb.flags = FBINFO_FLAG_DEFAULT; ofb->fb.node= -1; ofb->fb.pseudo_palette = NULL; -- 2.41.0
[PATCH 06/17] fbdev/fsl-diu-fb: Remove flag FBINFO_DEFAULT
The flag FBINFO_DEFAULT is 0 and has no effect, as struct fbinfo.flags has been allocated to zero by dmam_alloc_coherent(__GFP_ZERO). So do not set it. Flags should signal differences from the default values. After cleaning up all occurences of FBINFO_DEFAULT, the token can be removed. Signed-off-by: Thomas Zimmermann Cc: Timur Tabi Cc: Helge Deller --- drivers/video/fbdev/fsl-diu-fb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/video/fbdev/fsl-diu-fb.c b/drivers/video/fbdev/fsl-diu-fb.c index 785eb8a06943..c62b48f27ba9 100644 --- a/drivers/video/fbdev/fsl-diu-fb.c +++ b/drivers/video/fbdev/fsl-diu-fb.c @@ -1476,7 +1476,7 @@ static int install_fb(struct fb_info *info) info->var.activate = FB_ACTIVATE_NOW; info->fbops = _diu_ops; - info->flags = FBINFO_DEFAULT | FBINFO_VIRTFB | FBINFO_PARTIAL_PAN_OK | + info->flags = FBINFO_VIRTFB | FBINFO_PARTIAL_PAN_OK | FBINFO_READS_FAST; info->pseudo_palette = mfbi->pseudo_palette; -- 2.41.0
[PATCH 14/17] fbdev: Remove flag FBINFO_FLAG_DEFAULT from fbdev drivers
The flag FBINFO_FLAG_DEFAULT is 0 and has no effect, as struct fbinfo.flags has been allocated to zero by framebuffer_alloc(). So do not set it. Flags should signal differences from the default values. After cleaning up all occurences of FBINFO_FLAG_DEFAULT, the token can be removed. Signed-off-by: Thomas Zimmermann Cc: Jaya Kumar Cc: Helge Deller Cc: Peter Jones Cc: Sascha Hauer Cc: Pengutronix Kernel Team Cc: Shawn Guo Cc: Fabio Estevam Cc: NXP Linux Team Cc: Maik Broemme Cc: Jingoo Han Cc: Sudip Mukherjee Cc: Teddy Wang Cc: Michal Januszewski --- drivers/video/fbdev/arcfb.c| 1 - drivers/video/fbdev/aty/aty128fb.c | 1 - drivers/video/fbdev/broadsheetfb.c | 2 +- drivers/video/fbdev/da8xx-fb.c | 1 - drivers/video/fbdev/efifb.c| 1 - drivers/video/fbdev/goldfishfb.c | 1 - drivers/video/fbdev/gxt4500.c | 3 +-- drivers/video/fbdev/hecubafb.c | 2 +- drivers/video/fbdev/imxfb.c| 3 +-- drivers/video/fbdev/intelfb/intelfbdrv.c | 1 - drivers/video/fbdev/metronomefb.c | 2 +- drivers/video/fbdev/mx3fb.c| 1 - drivers/video/fbdev/omap/omapfb_main.c | 1 - drivers/video/fbdev/omap2/omapfb/omapfb-main.c | 1 - drivers/video/fbdev/s3c-fb.c | 1 - drivers/video/fbdev/sh_mobile_lcdcfb.c | 2 -- drivers/video/fbdev/sis/sis_main.c | 2 -- drivers/video/fbdev/sm501fb.c | 2 +- drivers/video/fbdev/sm712fb.c | 1 - drivers/video/fbdev/uvesafb.c | 3 +-- drivers/video/fbdev/vesafb.c | 2 +- drivers/video/fbdev/vfb.c | 1 - drivers/video/fbdev/vga16fb.c | 2 +- drivers/video/fbdev/xen-fbfront.c | 2 +- 24 files changed, 10 insertions(+), 29 deletions(-) diff --git a/drivers/video/fbdev/arcfb.c b/drivers/video/fbdev/arcfb.c index 9aaea3be8281..cff11cb04a55 100644 --- a/drivers/video/fbdev/arcfb.c +++ b/drivers/video/fbdev/arcfb.c @@ -546,7 +546,6 @@ static int arcfb_probe(struct platform_device *dev) par->c2io_addr = c2io_addr; par->cslut[0] = 0x00; par->cslut[1] = 0x06; - info->flags = FBINFO_FLAG_DEFAULT; spin_lock_init(>lock); if (irq) { par->irq = irq; diff --git a/drivers/video/fbdev/aty/aty128fb.c b/drivers/video/fbdev/aty/aty128fb.c index 2d9320a52e51..b44fc78ccd4f 100644 --- a/drivers/video/fbdev/aty/aty128fb.c +++ b/drivers/video/fbdev/aty/aty128fb.c @@ -1927,7 +1927,6 @@ static int aty128_init(struct pci_dev *pdev, const struct pci_device_id *ent) /* fill in info */ info->fbops = _ops; - info->flags = FBINFO_FLAG_DEFAULT; par->lcd_on = default_lcd_on; par->crt_on = default_crt_on; diff --git a/drivers/video/fbdev/broadsheetfb.c b/drivers/video/fbdev/broadsheetfb.c index cb725a91b6bb..e51e14c29c55 100644 --- a/drivers/video/fbdev/broadsheetfb.c +++ b/drivers/video/fbdev/broadsheetfb.c @@ -1069,7 +1069,7 @@ static int broadsheetfb_probe(struct platform_device *dev) mutex_init(>io_lock); - info->flags = FBINFO_FLAG_DEFAULT | FBINFO_VIRTFB; + info->flags = FBINFO_VIRTFB; info->fbdefio = _defio; fb_deferred_io_init(info); diff --git a/drivers/video/fbdev/da8xx-fb.c b/drivers/video/fbdev/da8xx-fb.c index 60cd1286370f..988dedcf6be8 100644 --- a/drivers/video/fbdev/da8xx-fb.c +++ b/drivers/video/fbdev/da8xx-fb.c @@ -1463,7 +1463,6 @@ static int fb_probe(struct platform_device *device) da8xx_fb_var.bits_per_pixel = lcd_cfg->bpp; /* Initialize fbinfo */ - da8xx_fb_info->flags = FBINFO_FLAG_DEFAULT; da8xx_fb_info->fix = da8xx_fb_fix; da8xx_fb_info->var = da8xx_fb_var; da8xx_fb_info->fbops = _fb_ops; diff --git a/drivers/video/fbdev/efifb.c b/drivers/video/fbdev/efifb.c index 3d7be69ab593..3391c8e84210 100644 --- a/drivers/video/fbdev/efifb.c +++ b/drivers/video/fbdev/efifb.c @@ -555,7 +555,6 @@ static int efifb_probe(struct platform_device *dev) info->fbops = _ops; info->var = efifb_defined; info->fix = efifb_fix; - info->flags = FBINFO_FLAG_DEFAULT; orientation = drm_get_panel_orientation_quirk(efifb_defined.xres, efifb_defined.yres); diff --git a/drivers/video/fbdev/goldfishfb.c b/drivers/video/fbdev/goldfishfb.c index 6fa2108fd912..ef2528c3faa9 100644 --- a/drivers/video/fbdev/goldfishfb.c +++ b/drivers/video/fbdev/goldfishfb.c @@ -212,7 +212,6 @@ static int goldfish_fb_probe(struct platform_device *pdev) height = readl(fb->reg_base + FB_GET_HEIGHT); fb->fb.fbops= _fb_ops; - fb->fb.flags= FBINFO_FLAG_DEFAULT; fb->fb.pseudo_palette = fb->cmap; fb->fb.fix.type = FB_TYPE_PACKED_PIXELS;
[PATCH 08/17] arch/sh: Do not assign FBINFO_FLAG_DEFAULT to fb_videomode.flag
FBINFO_FLAG_DEFAULT is a flag for a framebuffer in struct fb_info. Flags for videomodes are prefixed with FB_MODE_. FBINFO_FLAG_DEFAULT is 0 and the static declaration already clears the memory area of sh7763fb_videomode. So remove the assignment. Signed-off-by: Thomas Zimmermann Cc: Yoshinori Sato Cc: Rich Felker Cc: John Paul Adrian Glaubitz --- arch/sh/boards/mach-sh7763rdp/setup.c | 1 - 1 file changed, 1 deletion(-) diff --git a/arch/sh/boards/mach-sh7763rdp/setup.c b/arch/sh/boards/mach-sh7763rdp/setup.c index 97e715e4e9b3..345f2b76c85a 100644 --- a/arch/sh/boards/mach-sh7763rdp/setup.c +++ b/arch/sh/boards/mach-sh7763rdp/setup.c @@ -119,7 +119,6 @@ static struct fb_videomode sh7763fb_videomode = { .vsync_len = 1, .sync = 0, .vmode = FB_VMODE_NONINTERLACED, - .flag = FBINFO_FLAG_DEFAULT, }; static struct sh7760fb_platdata sh7763fb_def_pdata = { -- 2.41.0
[PATCH 13/17] fbdev: Remove flag FBINFO_FLAG_DEFAULT from fbdev drivers
The flag FBINFO_FLAG_DEFAULT is 0 and has no effect, as struct fbinfo.flags has been allocated to zero by kzalloc(). So do not set it. Flags should signal differences from the default values. After cleaning up all occurences of FBINFO_FLAG_DEFAULT, the token can be removed. Signed-off-by: Thomas Zimmermann Cc: Helge Deller --- drivers/video/fbdev/amba-clcd.c | 1 - drivers/video/fbdev/matrox/matroxfb_crtc2.c | 5 ++--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/video/fbdev/amba-clcd.c b/drivers/video/fbdev/amba-clcd.c index e45338227be6..24d89e6fb780 100644 --- a/drivers/video/fbdev/amba-clcd.c +++ b/drivers/video/fbdev/amba-clcd.c @@ -461,7 +461,6 @@ static int clcdfb_register(struct clcd_fb *fb) } fb->fb.fbops= _ops; - fb->fb.flags= FBINFO_FLAG_DEFAULT; fb->fb.pseudo_palette = fb->cmap; strncpy(fb->fb.fix.id, clcd_name, sizeof(fb->fb.fix.id)); diff --git a/drivers/video/fbdev/matrox/matroxfb_crtc2.c b/drivers/video/fbdev/matrox/matroxfb_crtc2.c index 7655afa3fd50..372197c124de 100644 --- a/drivers/video/fbdev/matrox/matroxfb_crtc2.c +++ b/drivers/video/fbdev/matrox/matroxfb_crtc2.c @@ -603,9 +603,8 @@ static int matroxfb_dh_regit(const struct matrox_fb_info *minfo, void* oldcrtc2; m2info->fbcon.fbops = _dh_ops; - m2info->fbcon.flags = FBINFO_FLAG_DEFAULT; - m2info->fbcon.flags |= FBINFO_HWACCEL_XPAN | - FBINFO_HWACCEL_YPAN; + m2info->fbcon.flags = FBINFO_HWACCEL_XPAN | + FBINFO_HWACCEL_YPAN; m2info->fbcon.pseudo_palette = m2info->cmap; fb_alloc_cmap(>fbcon.cmap, 256, 1); -- 2.41.0
[PATCH 03/17] fbdev: Remove flag FBINFO_DEFAULT from fbdev drivers
The flag FBINFO_DEFAULT is 0 and has no effect, as struct fbinfo.flags has been allocated to zero by kzalloc(). So do not set it. Flags should signal differences from the default values. After cleaning up all occurences of FBINFO_DEFAULT, the token can be removed. Signed-off-by: Thomas Zimmermann Cc: Helge Deller Cc: Russell King --- drivers/video/fbdev/controlfb.c | 2 +- drivers/video/fbdev/cyber2000fb.c | 2 +- drivers/video/fbdev/valkyriefb.c | 1 - drivers/video/fbdev/vermilion/vermilion.c | 2 +- drivers/video/fbdev/vt8500lcdfb.c | 3 +-- 5 files changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/video/fbdev/controlfb.c b/drivers/video/fbdev/controlfb.c index 82eeb139c4eb..717134c141ff 100644 --- a/drivers/video/fbdev/controlfb.c +++ b/drivers/video/fbdev/controlfb.c @@ -775,7 +775,7 @@ static void __init control_init_info(struct fb_info *info, struct fb_info_contro info->par = >par; info->fbops = _ops; info->pseudo_palette = p->pseudo_palette; -info->flags = FBINFO_DEFAULT | FBINFO_HWACCEL_YPAN; + info->flags = FBINFO_HWACCEL_YPAN; info->screen_base = p->frame_buffer + CTRLFB_OFF; fb_alloc_cmap(>cmap, 256, 0); diff --git a/drivers/video/fbdev/cyber2000fb.c b/drivers/video/fbdev/cyber2000fb.c index 38c0a6866d76..98ea56a9abf1 100644 --- a/drivers/video/fbdev/cyber2000fb.c +++ b/drivers/video/fbdev/cyber2000fb.c @@ -1459,7 +1459,7 @@ static struct cfb_info *cyberpro_alloc_fb_info(unsigned int id, char *name) cfb->fb.var.accel_flags = FB_ACCELF_TEXT; cfb->fb.fbops = _ops; - cfb->fb.flags = FBINFO_DEFAULT | FBINFO_HWACCEL_YPAN; + cfb->fb.flags = FBINFO_HWACCEL_YPAN; cfb->fb.pseudo_palette = cfb->pseudo_palette; spin_lock_init(>reg_b0_lock); diff --git a/drivers/video/fbdev/valkyriefb.c b/drivers/video/fbdev/valkyriefb.c index b166b7cfe0e5..fd4488777032 100644 --- a/drivers/video/fbdev/valkyriefb.c +++ b/drivers/video/fbdev/valkyriefb.c @@ -535,7 +535,6 @@ static int __init valkyrie_init_info(struct fb_info *info, { info->fbops = _ops; info->screen_base = p->frame_buffer + 0x1000; - info->flags = FBINFO_DEFAULT; info->pseudo_palette = p->pseudo_palette; info->par = >par; return fb_alloc_cmap(>cmap, 256, 0); diff --git a/drivers/video/fbdev/vermilion/vermilion.c b/drivers/video/fbdev/vermilion/vermilion.c index 32e74e02a02f..71584c775efd 100644 --- a/drivers/video/fbdev/vermilion/vermilion.c +++ b/drivers/video/fbdev/vermilion/vermilion.c @@ -477,7 +477,7 @@ static int vml_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) } info = >info; - info->flags = FBINFO_DEFAULT | FBINFO_PARTIAL_PAN_OK; + info->flags = FBINFO_PARTIAL_PAN_OK; err = vmlfb_enable_mmio(par); if (err) diff --git a/drivers/video/fbdev/vt8500lcdfb.c b/drivers/video/fbdev/vt8500lcdfb.c index 31d4e85b220c..42d39a9d5130 100644 --- a/drivers/video/fbdev/vt8500lcdfb.c +++ b/drivers/video/fbdev/vt8500lcdfb.c @@ -300,8 +300,7 @@ static int vt8500lcd_probe(struct platform_device *pdev) fbi->fb.var.vmode = FB_VMODE_NONINTERLACED; fbi->fb.fbops = _ops; - fbi->fb.flags = FBINFO_DEFAULT - | FBINFO_HWACCEL_COPYAREA + fbi->fb.flags = FBINFO_HWACCEL_COPYAREA | FBINFO_HWACCEL_FILLRECT | FBINFO_HWACCEL_YPAN | FBINFO_VIRTFB -- 2.41.0
[PATCH 07/17] vfio-mdev: Remove flag FBINFO_DEFAULT from fbdev sample driver
The flag FBINFO_DEFAULT is 0 and has no effect, as struct fbinfo.flags has been allocated to zero by framebuffer_alloc(). So do not set it. Flags should signal differences from the default values. After cleaning up all occurences of FBINFO_DEFAULT, the token can be removed. Signed-off-by: Thomas Zimmermann Cc: Kirti Wankhede --- samples/vfio-mdev/mdpy-fb.c | 1 - 1 file changed, 1 deletion(-) diff --git a/samples/vfio-mdev/mdpy-fb.c b/samples/vfio-mdev/mdpy-fb.c index 3c8001b9e407..cda477b28685 100644 --- a/samples/vfio-mdev/mdpy-fb.c +++ b/samples/vfio-mdev/mdpy-fb.c @@ -162,7 +162,6 @@ static int mdpy_fb_probe(struct pci_dev *pdev, } info->fbops = _fb_ops; - info->flags = FBINFO_DEFAULT; info->pseudo_palette = par->palette; ret = register_framebuffer(info); -- 2.41.0
[PATCH 10/17] hid/picolcd: Remove flag FBINFO_FLAG_DEFAULT from fbdev driver
The flag FBINFO_FLAG_DEFAULT is 0 and has no effect, as struct fbinfo.flags has been allocated to zero by framebuffer_alloc(). So do not set it. Flags should signal differences from the default values. After cleaning up all occurences of FBINFO_FLAG_DEFAULT, the token can be removed. Signed-off-by: Thomas Zimmermann Cc: "Bruno Prémont" Cc: Jiri Kosina Cc: Benjamin Tissoires --- drivers/hid/hid-picolcd_fb.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/hid/hid-picolcd_fb.c b/drivers/hid/hid-picolcd_fb.c index dabcd054dad9..d726aaafb146 100644 --- a/drivers/hid/hid-picolcd_fb.c +++ b/drivers/hid/hid-picolcd_fb.c @@ -527,7 +527,6 @@ int picolcd_init_framebuffer(struct picolcd_data *data) info->var = picolcdfb_var; info->fix = picolcdfb_fix; info->fix.smem_len = PICOLCDFB_SIZE*8; - info->flags = FBINFO_FLAG_DEFAULT; fbdata = info->par; spin_lock_init(>lock); -- 2.41.0
[PATCH 17/17] fbdev: Remove FBINFO_DEFAULT and FBINFO_FLAG_DEFAULT
Remove the unused flags FBINFO_DEFAULT and FBINFO_FLAG_DEFAULT. No functional changes. Signed-off-by: Thomas Zimmermann Cc: Helge Deller --- include/linux/fb.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/include/linux/fb.h b/include/linux/fb.h index 1d5c13f34b09..43458f582f35 100644 --- a/include/linux/fb.h +++ b/include/linux/fb.h @@ -383,7 +383,6 @@ struct fb_tile_ops { #endif /* CONFIG_FB_TILEBLITTING */ /* FBINFO_* = fb_info.flags bit flags */ -#define FBINFO_DEFAULT 0 #define FBINFO_HWACCEL_DISABLED0x0002 /* When FBINFO_HWACCEL_DISABLED is set: * Hardware acceleration is turned off. Software implementations @@ -504,8 +503,6 @@ struct fb_info { bool skip_vt_switch; /* no VT switch on suspend/resume required */ }; -#define FBINFO_FLAG_DEFAULTFBINFO_DEFAULT - /* This will go away * fbset currently hacks in FB_ACCELF_TEXT into var.accel_flags * when it wants to turn the acceleration engine on. This is -- 2.41.0
[PATCH 02/17] fbdev: Remove flag FBINFO_DEFAULT from fbdev drivers
The flag FBINFO_DEFAULT is 0 and has no effect, as struct fbinfo.flags has been allocated to zero by a static declaration. So do not set it. Flags should signal differences from the default values. After cleaning up all occurences of FBINFO_DEFAULT, the token can be removed. Signed-off-by: Thomas Zimmermann Cc: Helge Deller --- drivers/video/fbdev/68328fb.c | 2 +- drivers/video/fbdev/acornfb.c | 2 +- drivers/video/fbdev/g364fb.c | 2 +- drivers/video/fbdev/hpfb.c | 1 - drivers/video/fbdev/macfb.c| 1 - drivers/video/fbdev/maxinefb.c | 1 - 6 files changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/video/fbdev/68328fb.c b/drivers/video/fbdev/68328fb.c index 07d6e8dc686b..956dd2399cc0 100644 --- a/drivers/video/fbdev/68328fb.c +++ b/drivers/video/fbdev/68328fb.c @@ -448,7 +448,7 @@ static int __init mc68x328fb_init(void) fb_info.var.red.offset = fb_info.var.green.offset = fb_info.var.blue.offset = 0; } fb_info.pseudo_palette = _pseudo_palette; - fb_info.flags = FBINFO_DEFAULT | FBINFO_HWACCEL_YPAN; + fb_info.flags = FBINFO_HWACCEL_YPAN; if (fb_alloc_cmap(_info.cmap, 256, 0)) return -ENOMEM; diff --git a/drivers/video/fbdev/acornfb.c b/drivers/video/fbdev/acornfb.c index 1b72edc01cfb..8fec21dfca09 100644 --- a/drivers/video/fbdev/acornfb.c +++ b/drivers/video/fbdev/acornfb.c @@ -694,7 +694,7 @@ static void acornfb_init_fbinfo(void) first = 0; fb_info.fbops = _ops; - fb_info.flags = FBINFO_DEFAULT | FBINFO_HWACCEL_YPAN; + fb_info.flags = FBINFO_HWACCEL_YPAN; fb_info.pseudo_palette = current_par.pseudo_palette; strcpy(fb_info.fix.id, "Acorn"); diff --git a/drivers/video/fbdev/g364fb.c b/drivers/video/fbdev/g364fb.c index c5b7673ddc6c..0825cbde116e 100644 --- a/drivers/video/fbdev/g364fb.c +++ b/drivers/video/fbdev/g364fb.c @@ -219,7 +219,7 @@ int __init g364fb_init(void) fb_info.screen_base = (char *) G364_MEM_BASE; /* virtual kernel address */ fb_info.var = fb_var; fb_info.fix = fb_fix; - fb_info.flags = FBINFO_DEFAULT | FBINFO_HWACCEL_YPAN; + fb_info.flags = FBINFO_HWACCEL_YPAN; fb_alloc_cmap(_info.cmap, 255, 0); diff --git a/drivers/video/fbdev/hpfb.c b/drivers/video/fbdev/hpfb.c index 77fbff47b1a8..406c1383cbda 100644 --- a/drivers/video/fbdev/hpfb.c +++ b/drivers/video/fbdev/hpfb.c @@ -287,7 +287,6 @@ static int hpfb_init_one(unsigned long phys_base, unsigned long virt_base) else strcat(fb_info.fix.id, "Catseye"); fb_info.fbops = _ops; - fb_info.flags = FBINFO_DEFAULT; fb_info.var = hpfb_defined; fb_info.screen_base = (char *)fb_start; diff --git a/drivers/video/fbdev/macfb.c b/drivers/video/fbdev/macfb.c index 44ff860a3f37..5ca208d992cc 100644 --- a/drivers/video/fbdev/macfb.c +++ b/drivers/video/fbdev/macfb.c @@ -876,7 +876,6 @@ static int __init macfb_init(void) fb_info.var = macfb_defined; fb_info.fix = macfb_fix; fb_info.pseudo_palette = pseudo_palette; - fb_info.flags = FBINFO_DEFAULT; err = fb_alloc_cmap(_info.cmap, video_cmap_len, 0); if (err) diff --git a/drivers/video/fbdev/maxinefb.c b/drivers/video/fbdev/maxinefb.c index 4e6b05232ae2..0ac1873b2acb 100644 --- a/drivers/video/fbdev/maxinefb.c +++ b/drivers/video/fbdev/maxinefb.c @@ -155,7 +155,6 @@ int __init maxinefb_init(void) fb_info.screen_base = (char *)maxinefb_fix.smem_start; fb_info.var = maxinefb_defined; fb_info.fix = maxinefb_fix; - fb_info.flags = FBINFO_DEFAULT; fb_alloc_cmap(_info.cmap, 256, 0); -- 2.41.0
[PATCH 15/17] fbdev/atafb: Remove flag FBINFO_FLAG_DEFAULT
The flag FBINFO_FLAG_DEFAULT is 0 and has no effect, as struct fbinfo.flags has been allocated to zero by a static declaration. So do not set it. Flags should signal differences from the default values. After cleaning up all occurences of FBINFO_FLAG_DEFAULT, the token can be removed. Signed-off-by: Thomas Zimmermann Cc: Helge Deller --- drivers/video/fbdev/atafb.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/video/fbdev/atafb.c b/drivers/video/fbdev/atafb.c index 2bc4089865e6..c4a420b791b9 100644 --- a/drivers/video/fbdev/atafb.c +++ b/drivers/video/fbdev/atafb.c @@ -3112,7 +3112,6 @@ static int __init atafb_probe(struct platform_device *pdev) #ifdef ATAFB_FALCON fb_info.pseudo_palette = current_par.hw.falcon.pseudo_palette; #endif - fb_info.flags = FBINFO_FLAG_DEFAULT; if (!fb_find_mode(_info.var, _info, mode_option, atafb_modedb, NUM_TOTAL_MODES, _modedb[defmode], -- 2.41.0
[PATCH 12/17] staging: Remove flag FBINFO_FLAG_DEFAULT from fbdev drivers
The flag FBINFO_FLAG_DEFAULT is 0 and has no effect, as struct fbinfo.flags has been allocated to zero by framebuffer_alloc(). So do not set it. Flags should signal differences from the default values. After cleaning up all occurences of FBINFO_FLAG_DEFAULT, the token can be removed. Signed-off-by: Thomas Zimmermann Cc: Greg Kroah-Hartman Cc: Sudip Mukherjee Cc: Teddy Wang --- drivers/staging/fbtft/fbtft-core.c | 2 +- drivers/staging/sm750fb/sm750.c| 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/fbtft/fbtft-core.c b/drivers/staging/fbtft/fbtft-core.c index 3a4abf3bae40..eac1d570f437 100644 --- a/drivers/staging/fbtft/fbtft-core.c +++ b/drivers/staging/fbtft/fbtft-core.c @@ -684,7 +684,7 @@ struct fb_info *fbtft_framebuffer_alloc(struct fbtft_display *display, info->var.transp.offset = 0; info->var.transp.length = 0; - info->flags = FBINFO_FLAG_DEFAULT | FBINFO_VIRTFB; + info->flags = FBINFO_VIRTFB; par = info->par; par->info = info; diff --git a/drivers/staging/sm750fb/sm750.c b/drivers/staging/sm750fb/sm750.c index c260f73cf570..79bcd5bd4938 100644 --- a/drivers/staging/sm750fb/sm750.c +++ b/drivers/staging/sm750fb/sm750.c @@ -807,7 +807,6 @@ static int lynxfb_set_fbinfo(struct fb_info *info, int index) info->screen_base = crtc->v_screen; pr_debug("screen_base vaddr = %p\n", info->screen_base); info->screen_size = line_length * var->yres_virtual; - info->flags = FBINFO_FLAG_DEFAULT | 0; /* set info->fix */ fix->type = FB_TYPE_PACKED_PIXELS; -- 2.41.0
[PATCH 04/17] fbdev: Remove flag FBINFO_DEFAULT from fbdev drivers
The flag FBINFO_DEFAULT is 0 and has no effect, as struct fbinfo.flags has been allocated to zero by devm_kzalloc(). So do not set it. Flags should signal differences from the default values. After cleaning up all occurences of FBINFO_DEFAULT, the token can be removed. Signed-off-by: Thomas Zimmermann Cc: Helge Deller --- drivers/video/fbdev/pxafb.c| 1 - drivers/video/fbdev/sa1100fb.c | 1 - drivers/video/fbdev/wm8505fb.c | 3 +-- drivers/video/fbdev/xilinxfb.c | 1 - 4 files changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/video/fbdev/pxafb.c b/drivers/video/fbdev/pxafb.c index 2a8b1dea3a67..c8c4677d06b4 100644 --- a/drivers/video/fbdev/pxafb.c +++ b/drivers/video/fbdev/pxafb.c @@ -1826,7 +1826,6 @@ static struct pxafb_info *pxafb_init_fbinfo(struct device *dev, fbi->fb.var.vmode = FB_VMODE_NONINTERLACED; fbi->fb.fbops = _ops; - fbi->fb.flags = FBINFO_DEFAULT; fbi->fb.node= -1; addr = fbi; diff --git a/drivers/video/fbdev/sa1100fb.c b/drivers/video/fbdev/sa1100fb.c index a2408bf00ca0..3d76ce111488 100644 --- a/drivers/video/fbdev/sa1100fb.c +++ b/drivers/video/fbdev/sa1100fb.c @@ -1089,7 +1089,6 @@ static struct sa1100fb_info *sa1100fb_init_fbinfo(struct device *dev) fbi->fb.var.vmode = FB_VMODE_NONINTERLACED; fbi->fb.fbops = _ops; - fbi->fb.flags = FBINFO_DEFAULT; fbi->fb.monspecs= monspecs; fbi->fb.pseudo_palette = fbi->pseudo_palette; diff --git a/drivers/video/fbdev/wm8505fb.c b/drivers/video/fbdev/wm8505fb.c index 10a8b1250103..5833147aa43d 100644 --- a/drivers/video/fbdev/wm8505fb.c +++ b/drivers/video/fbdev/wm8505fb.c @@ -285,8 +285,7 @@ static int wm8505fb_probe(struct platform_device *pdev) fbi->fb.fix.accel = FB_ACCEL_NONE; fbi->fb.fbops = _ops; - fbi->fb.flags = FBINFO_DEFAULT - | FBINFO_HWACCEL_COPYAREA + fbi->fb.flags = FBINFO_HWACCEL_COPYAREA | FBINFO_HWACCEL_FILLRECT | FBINFO_HWACCEL_XPAN | FBINFO_HWACCEL_YPAN diff --git a/drivers/video/fbdev/xilinxfb.c b/drivers/video/fbdev/xilinxfb.c index 2aa3a528277f..768a281a8d2c 100644 --- a/drivers/video/fbdev/xilinxfb.c +++ b/drivers/video/fbdev/xilinxfb.c @@ -324,7 +324,6 @@ static int xilinxfb_assign(struct platform_device *pdev, drvdata->info.fix.line_length = pdata->xvirt * BYTES_PER_PIXEL; drvdata->info.pseudo_palette = drvdata->pseudo_palette; - drvdata->info.flags = FBINFO_DEFAULT; drvdata->info.var = xilinx_fb_var; drvdata->info.var.height = pdata->screen_height_mm; drvdata->info.var.width = pdata->screen_width_mm; -- 2.41.0
[PATCH 00/17] fbdev: Remove FBINFO_DEFAULT and FBINFO_FLAG_DEFAULT flags
Remove the unused flags FBINFO_DEFAULT and FBINFO_FLAG_DEFAULT from fbdev and drivers, as briefly discussed at [1]. Both flags were maybe useful when fbdev had special handling for driver modules. With commit 376b3ff54c9a ("fbdev: Nuke FBINFO_MODULE"), they are both 0 and have no further effect. Patches 1 to 7 remove FBINFO_DEFAULT from drivers. Patches 2 to 5 split this by the way the fb_info struct is being allocated. All flags are cleared to zero during the allocation. Patches 8 to 16 do the same for FBINFO_FLAG_DEFAULT. Patch 8 fixes an actual bug in how arch/sh uses the tokne for struct fb_videomode, which is unrelated. Patch 17 removes both flag constants from [1] https://lore.kernel.org/dri-devel/877crer8fm@minerva.mail-host-address-is-not-set/ Thomas Zimmermann (17): drm: Remove flag FBINFO_DEFAULT from fbdev emulation fbdev: Remove flag FBINFO_DEFAULT from fbdev drivers fbdev: Remove flag FBINFO_DEFAULT from fbdev drivers fbdev: Remove flag FBINFO_DEFAULT from fbdev drivers fbdev: Remove flag FBINFO_DEFAULT from fbdev drivers fbdev/fsl-diu-fb: Remove flag FBINFO_DEFAULT vfio-mdev: Remove flag FBINFO_DEFAULT from fbdev sample driver arch/sh: Do not assign FBINFO_FLAG_DEFAULT to fb_videomode.flag auxdisplay: Remove flag FBINFO_FLAG_DEFAULT from fbdev drivers hid/picolcd: Remove flag FBINFO_FLAG_DEFAULT from fbdev driver media: Remove flag FBINFO_FLAG_DEFAULT from fbdev drivers staging: Remove flag FBINFO_FLAG_DEFAULT from fbdev drivers fbdev: Remove flag FBINFO_FLAG_DEFAULT from fbdev drivers fbdev: Remove flag FBINFO_FLAG_DEFAULT from fbdev drivers fbdev/atafb: Remove flag FBINFO_FLAG_DEFAULT fbdev/pxafb: Remove flag FBINFO_FLAG_DEFAULT fbdev: Remove FBINFO_DEFAULT and FBINFO_FLAG_DEFAULT arch/sh/boards/mach-sh7763rdp/setup.c | 1 - drivers/auxdisplay/cfag12864bfb.c | 1 - drivers/auxdisplay/ht16k33.c | 1 - drivers/gpu/drm/drm_fbdev_dma.c| 1 - drivers/gpu/drm/drm_fbdev_generic.c| 1 - drivers/gpu/drm/gma500/fbdev.c | 2 +- drivers/gpu/drm/radeon/radeon_fbdev.c | 2 +- drivers/hid/hid-picolcd_fb.c | 1 - drivers/media/pci/ivtv/ivtvfb.c| 1 - drivers/media/test-drivers/vivid/vivid-osd.c | 1 - drivers/staging/fbtft/fbtft-core.c | 2 +- drivers/staging/sm750fb/sm750.c| 1 - drivers/video/fbdev/68328fb.c | 2 +- drivers/video/fbdev/acornfb.c | 2 +- drivers/video/fbdev/amba-clcd.c| 1 - drivers/video/fbdev/amifb.c| 5 ++--- drivers/video/fbdev/arcfb.c| 1 - drivers/video/fbdev/asiliantfb.c | 1 - drivers/video/fbdev/atafb.c| 1 - drivers/video/fbdev/atmel_lcdfb.c | 2 +- drivers/video/fbdev/aty/aty128fb.c | 1 - drivers/video/fbdev/aty/atyfb_base.c | 3 +-- drivers/video/fbdev/aty/radeon_base.c | 3 +-- drivers/video/fbdev/broadsheetfb.c | 2 +- drivers/video/fbdev/bw2.c | 1 - drivers/video/fbdev/carminefb.c| 1 - drivers/video/fbdev/cg14.c | 2 +- drivers/video/fbdev/cg3.c | 1 - drivers/video/fbdev/cg6.c | 2 +- drivers/video/fbdev/chipsfb.c | 1 - drivers/video/fbdev/cirrusfb.c | 3 +-- drivers/video/fbdev/clps711x-fb.c | 1 - drivers/video/fbdev/cobalt_lcdfb.c | 1 - drivers/video/fbdev/controlfb.c| 2 +- drivers/video/fbdev/cyber2000fb.c | 2 +- drivers/video/fbdev/da8xx-fb.c | 1 - drivers/video/fbdev/efifb.c| 1 - drivers/video/fbdev/ep93xx-fb.c| 1 - drivers/video/fbdev/ffb.c | 3 +-- drivers/video/fbdev/fm2fb.c| 1 - drivers/video/fbdev/fsl-diu-fb.c | 2 +- drivers/video/fbdev/g364fb.c | 2 +- drivers/video/fbdev/gbefb.c| 1 - drivers/video/fbdev/geode/gx1fb_core.c | 1 - drivers/video/fbdev/geode/gxfb_core.c | 1 - drivers/video/fbdev/geode/lxfb_core.c | 1 - drivers/video/fbdev/goldfishfb.c | 1 - drivers/video/fbdev/grvga.c| 2 +- drivers/video/fbdev/gxt4500.c | 3 +-- drivers/video/fbdev/hecubafb.c | 2 +- drivers/video/fbdev/hgafb.c| 2 +- drivers/video/fbdev/hitfb.c| 2 +- drivers/video/fbdev/hpfb.c | 1 - drivers/video/fbdev/hyperv_fb.c| 2 -- drivers/video/fbdev/i740fb.c | 2 +- drivers/video/fbdev/i810/i810_main.c | 4 ++-- drivers/video/fbdev/imsttfb.c | 3 +-- drivers/video/fbdev/imxfb.c| 3 +-- drivers/video/fbdev/intelfb/intelfbdrv.c | 5
[PATCH 01/17] drm: Remove flag FBINFO_DEFAULT from fbdev emulation
The flag FBINFO_DEFAULT is 0 and has no effect, as struct fbinfo.flags has been allocated to zero by framebuffer_alloc(). So do not set it. Flags should signal differences from the default values. After cleaning up all occurences of FBINFO_DEFAULT, the token can be removed. Signed-off-by: Thomas Zimmermann Cc: Patrik Jakobsson Cc: Alex Deucher Cc: "Christian König" Cc: "Pan, Xinhui" --- drivers/gpu/drm/drm_fbdev_dma.c | 1 - drivers/gpu/drm/drm_fbdev_generic.c | 1 - drivers/gpu/drm/gma500/fbdev.c| 2 +- drivers/gpu/drm/radeon/radeon_fbdev.c | 2 +- 4 files changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/drm_fbdev_dma.c b/drivers/gpu/drm/drm_fbdev_dma.c index 8217f1ddc007..bc5fdb1da6a3 100644 --- a/drivers/gpu/drm/drm_fbdev_dma.c +++ b/drivers/gpu/drm/drm_fbdev_dma.c @@ -123,7 +123,6 @@ static int drm_fbdev_dma_helper_fb_probe(struct drm_fb_helper *fb_helper, drm_fb_helper_fill_info(info, fb_helper, sizes); info->fbops = _fbdev_dma_fb_ops; - info->flags = FBINFO_DEFAULT; /* screen */ info->flags |= FBINFO_VIRTFB; /* system memory */ diff --git a/drivers/gpu/drm/drm_fbdev_generic.c b/drivers/gpu/drm/drm_fbdev_generic.c index 98ae703848a0..8a5600b33e10 100644 --- a/drivers/gpu/drm/drm_fbdev_generic.c +++ b/drivers/gpu/drm/drm_fbdev_generic.c @@ -109,7 +109,6 @@ static int drm_fbdev_generic_helper_fb_probe(struct drm_fb_helper *fb_helper, drm_fb_helper_fill_info(info, fb_helper, sizes); info->fbops = _fbdev_generic_fb_ops; - info->flags = FBINFO_DEFAULT; /* screen */ info->flags |= FBINFO_VIRTFB | FBINFO_READS_FAST; diff --git a/drivers/gpu/drm/gma500/fbdev.c b/drivers/gpu/drm/gma500/fbdev.c index 955cbe9f05a7..b09a3ef770d4 100644 --- a/drivers/gpu/drm/gma500/fbdev.c +++ b/drivers/gpu/drm/gma500/fbdev.c @@ -215,7 +215,7 @@ static int psb_fbdev_fb_probe(struct drm_fb_helper *fb_helper, } info->fbops = _fbdev_fb_ops; - info->flags = FBINFO_DEFAULT; + /* Accessed stolen memory directly */ info->screen_base = dev_priv->vram_addr + backing->offset; info->screen_size = size; diff --git a/drivers/gpu/drm/radeon/radeon_fbdev.c b/drivers/gpu/drm/radeon/radeon_fbdev.c index ab9c1abbac97..c632ca03032b 100644 --- a/drivers/gpu/drm/radeon/radeon_fbdev.c +++ b/drivers/gpu/drm/radeon/radeon_fbdev.c @@ -253,7 +253,7 @@ static int radeon_fbdev_fb_helper_fb_probe(struct drm_fb_helper *fb_helper, } info->fbops = _fbdev_fb_ops; - info->flags = FBINFO_DEFAULT; + /* radeon resume is fragile and needs a vt switch to help it along */ info->skip_vt_switch = false; -- 2.41.0
Re: [PATCH v2] drm/amdgpu: Increase soft IH ring size
Am 07.07.23 um 17:49 schrieb Philip Yang: Retry faults are delegated to soft IH ring and then processed by deferred worker. Current soft IH ring size PAGE_SIZE can store 128 entries, which may overflow and drop retry faults, causes HW stucks because the retry fault is not recovered. Increase soft IH ring size to 8KB, enough to store 256 CAM entries because we clear the CAM entry after handling the retry fault from soft ring. Define macro IH_RING_SIZE and IH_SW_RING_SIZE to remove duplicate constant. Show warning message if soft IH ring overflows because this should not happen. Signed-off-by: Philip Yang --- drivers/gpu/drm/amd/amdgpu/amdgpu_ih.c | 8 ++-- drivers/gpu/drm/amd/amdgpu/amdgpu_ih.h | 7 +-- drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c | 2 +- drivers/gpu/drm/amd/amdgpu/ih_v6_0.c| 4 ++-- drivers/gpu/drm/amd/amdgpu/navi10_ih.c | 4 ++-- drivers/gpu/drm/amd/amdgpu/vega10_ih.c | 4 ++-- drivers/gpu/drm/amd/amdgpu/vega20_ih.c | 4 ++-- 7 files changed, 20 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ih.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_ih.c index fceb3b384955..51a0dbd2358a 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ih.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ih.c @@ -138,6 +138,7 @@ void amdgpu_ih_ring_fini(struct amdgpu_device *adev, struct amdgpu_ih_ring *ih) /** * amdgpu_ih_ring_write - write IV to the ring buffer * + * @adev: amdgpu_device pointer * @ih: ih ring to write to * @iv: the iv to write * @num_dw: size of the iv in dw @@ -145,8 +146,8 @@ void amdgpu_ih_ring_fini(struct amdgpu_device *adev, struct amdgpu_ih_ring *ih) * Writes an IV to the ring buffer using the CPU and increment the wptr. * Used for testing and delegating IVs to a software ring. */ -void amdgpu_ih_ring_write(struct amdgpu_ih_ring *ih, const uint32_t *iv, - unsigned int num_dw) +void amdgpu_ih_ring_write(struct amdgpu_device *adev, struct amdgpu_ih_ring *ih, + const uint32_t *iv, unsigned int num_dw) { uint32_t wptr = le32_to_cpu(*ih->wptr_cpu) >> 2; unsigned int i; @@ -161,6 +162,9 @@ void amdgpu_ih_ring_write(struct amdgpu_ih_ring *ih, const uint32_t *iv, if (wptr != READ_ONCE(ih->rptr)) { wmb(); WRITE_ONCE(*ih->wptr_cpu, cpu_to_le32(wptr)); + } else { + dev_warn(adev->dev, "IH soft ring buffer overflow 0x%X, 0x%X\n", +wptr, ih->rptr); } } diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_ih.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_ih.h index dd1c2eded6b9..6c6184f0dbc1 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_ih.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_ih.h @@ -27,6 +27,9 @@ /* Maximum number of IVs processed at once */ #define AMDGPU_IH_MAX_NUM_IVS 32 +#define IH_RING_SIZE (256 * 1024) +#define IH_SW_RING_SIZE(8 * 1024) /* enough for 256 CAM entries */ + Please add an AMDGPU_ prefix to the macro name and don't put comments on the same line as the macro. Apart from that looks good to me, Christian. struct amdgpu_device; struct amdgpu_iv_entry; @@ -97,8 +100,8 @@ struct amdgpu_ih_funcs { int amdgpu_ih_ring_init(struct amdgpu_device *adev, struct amdgpu_ih_ring *ih, unsigned ring_size, bool use_bus_addr); void amdgpu_ih_ring_fini(struct amdgpu_device *adev, struct amdgpu_ih_ring *ih); -void amdgpu_ih_ring_write(struct amdgpu_ih_ring *ih, const uint32_t *iv, - unsigned int num_dw); +void amdgpu_ih_ring_write(struct amdgpu_device *adev, struct amdgpu_ih_ring *ih, + const uint32_t *iv, unsigned int num_dw); int amdgpu_ih_wait_on_checkpoint_process_ts(struct amdgpu_device *adev, struct amdgpu_ih_ring *ih); int amdgpu_ih_process(struct amdgpu_device *adev, struct amdgpu_ih_ring *ih); diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c index 5273decc5753..fa6d0adcec20 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_irq.c @@ -493,7 +493,7 @@ void amdgpu_irq_delegate(struct amdgpu_device *adev, struct amdgpu_iv_entry *entry, unsigned int num_dw) { - amdgpu_ih_ring_write(>irq.ih_soft, entry->iv_entry, num_dw); + amdgpu_ih_ring_write(adev, >irq.ih_soft, entry->iv_entry, num_dw); schedule_work(>irq.ih_soft_work); } diff --git a/drivers/gpu/drm/amd/amdgpu/ih_v6_0.c b/drivers/gpu/drm/amd/amdgpu/ih_v6_0.c index b02e1cef78a7..980b24120080 100644 --- a/drivers/gpu/drm/amd/amdgpu/ih_v6_0.c +++ b/drivers/gpu/drm/amd/amdgpu/ih_v6_0.c @@ -535,7 +535,7 @@ static int ih_v6_0_sw_init(void *handle) * use bus address for ih ring by psp bl */ use_bus_addr = (adev->firmware.load_type == AMDGPU_FW_LOAD_PSP) ? false : true; -
Re: [PATCH v2] drm/amdgpu/vkms: relax timer deactivation by hrtimer_try_to_cancel
Am 10.07.23 um 08:38 schrieb Guchun Chen: In below thousands of screen rotation loop tests with virtual display enabled, a CPU hard lockup issue may happen, leading system to unresponsive and crash. do { xrandr --output Virtual --rotate inverted xrandr --output Virtual --rotate right xrandr --output Virtual --rotate left xrandr --output Virtual --rotate normal } while (1); NMI watchdog: Watchdog detected hard LOCKUP on cpu 1 ? hrtimer_run_softirq+0x140/0x140 ? store_vblank+0xe0/0xe0 [drm] hrtimer_cancel+0x15/0x30 amdgpu_vkms_disable_vblank+0x15/0x30 [amdgpu] drm_vblank_disable_and_save+0x185/0x1f0 [drm] drm_crtc_vblank_off+0x159/0x4c0 [drm] ? record_print_text.cold+0x11/0x11 ? wait_for_completion_timeout+0x232/0x280 ? drm_crtc_wait_one_vblank+0x40/0x40 [drm] ? bit_wait_io_timeout+0xe0/0xe0 ? wait_for_completion_interruptible+0x1d7/0x320 ? mutex_unlock+0x81/0xd0 amdgpu_vkms_crtc_atomic_disable It's caused by a stuck in lock dependency in such scenario on different CPUs. CPU1 CPU2 drm_crtc_vblank_off hrtimer_interrupt grab event_lock (irq disabled) __hrtimer_run_queues grab vbl_lock/vblank_time_block amdgpu_vkms_vblank_simulate amdgpu_vkms_disable_vblank drm_handle_vblank hrtimer_cancel grab dev->event_lock So CPU1 stucks in hrtimer_cancel as timer callback is running endless on current clock base, as that timer queue on CPU2 has no chance to finish it because of failing to hold the lock. So NMI watchdog will throw the errors after its threshold, and all later CPUs are impacted/blocked. So use hrtimer_try_to_cancel to fix this, as disable_vblank callback does not need to wait the handler to finish. And also it's not necessary to check the return value of hrtimer_try_to_cancel, because even if it's -1 which means current timer callback is running, it will be reprogrammed in hrtimer_start with calling enable_vblank to make it works. v2: only re-arm timer when vblank is enabled (Christian) and add a Fixes tag as well Fixes: 84ec374bd580("drm/amdgpu: create amdgpu_vkms (v4)") Cc: sta...@vger.kernel.org Suggested-by: Christian König Signed-off-by: Guchun Chen --- drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c | 15 --- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c index 53ff91fc6cf6..44d704306f44 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c @@ -46,7 +46,10 @@ static enum hrtimer_restart amdgpu_vkms_vblank_simulate(struct hrtimer *timer) struct amdgpu_crtc *amdgpu_crtc = container_of(timer, struct amdgpu_crtc, vblank_timer); struct drm_crtc *crtc = _crtc->base; struct amdgpu_vkms_output *output = drm_crtc_to_amdgpu_vkms_output(crtc); + struct drm_vblank_crtc *vblank; + struct drm_device *dev; u64 ret_overrun; + unsigned int pipe; bool ret; ret_overrun = hrtimer_forward_now(_crtc->vblank_timer, @@ -54,9 +57,15 @@ static enum hrtimer_restart amdgpu_vkms_vblank_simulate(struct hrtimer *timer) if (ret_overrun != 1) DRM_WARN("%s: vblank timer overrun\n", __func__); + dev = crtc->dev; + pipe = drm_crtc_index(crtc); + vblank = >vblank[pipe]; ret = drm_crtc_handle_vblank(crtc); - if (!ret) - DRM_ERROR("amdgpu_vkms failure on handling vblank"); + if (!ret && !READ_ONCE(vblank->enabled)) { + /* Don't queue timer again when vblank is disabled. */ + DRM_WARN("amdgpu_vkms failure on handling vblank\n"); You should probably only print the warning when really an error happened. Disabling the vblank and not firing the timer again is a perfectly normal operation. Apart from that looks good to me, Christian. + return HRTIMER_NORESTART; + } return HRTIMER_RESTART; } @@ -81,7 +90,7 @@ static void amdgpu_vkms_disable_vblank(struct drm_crtc *crtc) { struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); - hrtimer_cancel(_crtc->vblank_timer); + hrtimer_try_to_cancel(_crtc->vblank_timer); } static bool amdgpu_vkms_get_vblank_timestamp(struct drm_crtc *crtc,
Re: [PATCH] drm/client: Send hotplug event after registering a client
Hi Am 10.07.23 um 11:52 schrieb Javier Martinez Canillas: Thomas Zimmermann writes: Hello Thomas, Generate a hotplug event after registering a client to allow the client to configure its display. Remove the hotplug calls from the existing clients for fbdev emulation. This change fixes a concurrency bug between registering a client and receiving events from the DRM core. The bug is present in the fbdev emulation of all drivers. The fbdev emulation currently generates a hotplug event before registering the client to the device. For each new output, the DRM core sends an additional hotplug event to each registered client. If the DRM core detects first output between sending the artificial hotplug and registering the device, the output's hotplug event gets lost. If this is the first output, the fbdev console display remains dark. This has been observed with amdgpu and fbdev-generic. Fix this by adding hotplug generation directly to the client's register helper drm_client_register(). Registering the client and receiving events are serialized by struct drm_device.clientlist_mutex. So an output is either configured by the initial hotplug event, or the client has already been registered. The bug was originally added in commit 6e3f17ee73f7 ("drm/fb-helper: generic: Call drm_client_add() after setup is done"), in which adding a client and receiving a hotplug event switched order. It was hidden, as most hardware and drivers have at least on static output configured. Other drivers didn't use the internal DRM client or still had struct drm_mode_config_funcs.output_poll_changed set. That callback handled hotplug events as well. After not setting the callback in amdgpu in commit 0e3172bac3f4 ("drm/amdgpu: Don't set struct drm_driver.output_poll_changed"), amdgpu did not show a framebuffer console if output events got lost. The bug got copy-pasted from fbdev-generic into the other fbdev emulation. Reported-by: Moritz Duge Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/2649 Aren't you missing a Fixes: for 0e3172bac3f4 too? Since that's the commit that unmasked the bug for amdgpu, IMO that is the most important to list. Well, OK. Fixes: 6e3f17ee73f7 ("drm/fb-helper: generic: Call drm_client_add() after setup is done") Fixes: 8ab59da26bc0 ("drm/fb-helper: Move generic fbdev emulation into separate source file") Fixes: b79fe9abd58b ("drm/fbdev-dma: Implement fbdev emulation for GEM DMA helpers") Fixes: 63c381552f69 ("drm/armada: Implement fbdev emulation as in-kernel client") Fixes: 49953b70e7d3 ("drm/exynos: Implement fbdev emulation as in-kernel client") Fixes: 8f1aaccb04b7 ("drm/gma500: Implement client-based fbdev emulation") Fixes: 940b869c2f2f ("drm/msm: Implement fbdev emulation as in-kernel client") Fixes: 9e69bcd88e45 ("drm/omapdrm: Implement fbdev emulation as in-kernel client") Fixes: e317a69fe891 ("drm/radeon: Implement client-based fbdev emulation") Fixes: 71ec16f45ef8 ("drm/tegra: Implement fbdev emulation as in-kernel client") Signed-off-by: Thomas Zimmermann Tested-by: Moritz Duge Tested-by: Torsten Krah Tested-by: Paul Schyska Cc: Daniel Vetter Cc: David Airlie Cc: Noralf Trønnes Cc: Maarten Lankhorst Cc: Maxime Ripard Cc: Javier Martinez Canillas Cc: Russell King Cc: Inki Dae Cc: Seung-Woo Kim Cc: Kyungmin Park Cc: Krzysztof Kozlowski Cc: Patrik Jakobsson Cc: Rob Clark Cc: Abhinav Kumar Cc: Dmitry Baryshkov Cc: Tomi Valkeinen Cc: Alex Deucher Cc: "Christian König" Cc: "Pan, Xinhui" Cc: Thierry Reding Cc: Mikko Perttunen Cc: dri-de...@lists.freedesktop.org Cc: linux-ker...@vger.kernel.org Cc: linux-arm-ker...@lists.infradead.org Cc: linux-samsung-...@vger.kernel.org Cc: linux-arm-...@vger.kernel.org Cc: freedr...@lists.freedesktop.org Cc: amd-gfx@lists.freedesktop.org Cc: linux-te...@vger.kernel.org Cc: dri-de...@lists.freedesktop.org Cc: # v5.2+ While it's true that the but was introduced by commit 6e3f17ee73f7 and that landed in v5.2, I wonder if this patch could even be applied to such olders Linux versions. Probably in practice it would be at most backported to v6.2, which is the release that exposed the bug for the amdgpu driver. No idea. The fix looks simple enough, but a lot has changed in the surrounding code. Best regards Thomas Your explanation makes sense to me and the patch looks good. Reviewed-by: Javier Martinez Canillas -- Thomas Zimmermann Graphics Driver Developer SUSE Software Solutions Germany GmbH Frankenstrasse 146, 90461 Nuernberg, Germany GF: Ivo Totev, Andrew Myers, Andrew McDonald, Boudien Moerman HRB 36809 (AG Nuernberg) OpenPGP_signature Description: OpenPGP digital signature
Re: [PATCH] drm/client: Send hotplug event after registering a client
Thomas Zimmermann writes: Hello Thomas, > Generate a hotplug event after registering a client to allow the > client to configure its display. Remove the hotplug calls from the > existing clients for fbdev emulation. This change fixes a concurrency > bug between registering a client and receiving events from the DRM > core. The bug is present in the fbdev emulation of all drivers. > > The fbdev emulation currently generates a hotplug event before > registering the client to the device. For each new output, the DRM > core sends an additional hotplug event to each registered client. > > If the DRM core detects first output between sending the artificial > hotplug and registering the device, the output's hotplug event gets > lost. If this is the first output, the fbdev console display remains > dark. This has been observed with amdgpu and fbdev-generic. > > Fix this by adding hotplug generation directly to the client's > register helper drm_client_register(). Registering the client and > receiving events are serialized by struct drm_device.clientlist_mutex. > So an output is either configured by the initial hotplug event, or > the client has already been registered. > > The bug was originally added in commit 6e3f17ee73f7 ("drm/fb-helper: > generic: Call drm_client_add() after setup is done"), in which adding > a client and receiving a hotplug event switched order. It was hidden, > as most hardware and drivers have at least on static output configured. > Other drivers didn't use the internal DRM client or still had struct > drm_mode_config_funcs.output_poll_changed set. That callback handled > hotplug events as well. After not setting the callback in amdgpu in > commit 0e3172bac3f4 ("drm/amdgpu: Don't set struct > drm_driver.output_poll_changed"), amdgpu did not show a framebuffer > console if output events got lost. The bug got copy-pasted from > fbdev-generic into the other fbdev emulation. > > Reported-by: Moritz Duge > Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/2649 Aren't you missing a Fixes: for 0e3172bac3f4 too? Since that's the commit that unmasked the bug for amdgpu, IMO that is the most important to list. > Fixes: 6e3f17ee73f7 ("drm/fb-helper: generic: Call drm_client_add() after > setup is done") > Fixes: 8ab59da26bc0 ("drm/fb-helper: Move generic fbdev emulation into > separate source file") > Fixes: b79fe9abd58b ("drm/fbdev-dma: Implement fbdev emulation for GEM DMA > helpers") > Fixes: 63c381552f69 ("drm/armada: Implement fbdev emulation as in-kernel > client") > Fixes: 49953b70e7d3 ("drm/exynos: Implement fbdev emulation as in-kernel > client") > Fixes: 8f1aaccb04b7 ("drm/gma500: Implement client-based fbdev emulation") > Fixes: 940b869c2f2f ("drm/msm: Implement fbdev emulation as in-kernel client") > Fixes: 9e69bcd88e45 ("drm/omapdrm: Implement fbdev emulation as in-kernel > client") > Fixes: e317a69fe891 ("drm/radeon: Implement client-based fbdev emulation") > Fixes: 71ec16f45ef8 ("drm/tegra: Implement fbdev emulation as in-kernel > client") > Signed-off-by: Thomas Zimmermann > Tested-by: Moritz Duge > Tested-by: Torsten Krah > Tested-by: Paul Schyska > Cc: Daniel Vetter > Cc: David Airlie > Cc: Noralf Trønnes > Cc: Maarten Lankhorst > Cc: Maxime Ripard > Cc: Javier Martinez Canillas > Cc: Russell King > Cc: Inki Dae > Cc: Seung-Woo Kim > Cc: Kyungmin Park > Cc: Krzysztof Kozlowski > Cc: Patrik Jakobsson > Cc: Rob Clark > Cc: Abhinav Kumar > Cc: Dmitry Baryshkov > Cc: Tomi Valkeinen > Cc: Alex Deucher > Cc: "Christian König" > Cc: "Pan, Xinhui" > Cc: Thierry Reding > Cc: Mikko Perttunen > Cc: dri-de...@lists.freedesktop.org > Cc: linux-ker...@vger.kernel.org > Cc: linux-arm-ker...@lists.infradead.org > Cc: linux-samsung-...@vger.kernel.org > Cc: linux-arm-...@vger.kernel.org > Cc: freedr...@lists.freedesktop.org > Cc: amd-gfx@lists.freedesktop.org > Cc: linux-te...@vger.kernel.org > Cc: dri-de...@lists.freedesktop.org > Cc: # v5.2+ While it's true that the but was introduced by commit 6e3f17ee73f7 and that landed in v5.2, I wonder if this patch could even be applied to such olders Linux versions. Probably in practice it would be at most backported to v6.2, which is the release that exposed the bug for the amdgpu driver. Your explanation makes sense to me and the patch looks good. Reviewed-by: Javier Martinez Canillas -- Best regards, Javier Martinez Canillas Core Platforms Red Hat
[PATCH] drm/client: Send hotplug event after registering a client
Generate a hotplug event after registering a client to allow the client to configure its display. Remove the hotplug calls from the existing clients for fbdev emulation. This change fixes a concurrency bug between registering a client and receiving events from the DRM core. The bug is present in the fbdev emulation of all drivers. The fbdev emulation currently generates a hotplug event before registering the client to the device. For each new output, the DRM core sends an additional hotplug event to each registered client. If the DRM core detects first output between sending the artificial hotplug and registering the device, the output's hotplug event gets lost. If this is the first output, the fbdev console display remains dark. This has been observed with amdgpu and fbdev-generic. Fix this by adding hotplug generation directly to the client's register helper drm_client_register(). Registering the client and receiving events are serialized by struct drm_device.clientlist_mutex. So an output is either configured by the initial hotplug event, or the client has already been registered. The bug was originally added in commit 6e3f17ee73f7 ("drm/fb-helper: generic: Call drm_client_add() after setup is done"), in which adding a client and receiving a hotplug event switched order. It was hidden, as most hardware and drivers have at least on static output configured. Other drivers didn't use the internal DRM client or still had struct drm_mode_config_funcs.output_poll_changed set. That callback handled hotplug events as well. After not setting the callback in amdgpu in commit 0e3172bac3f4 ("drm/amdgpu: Don't set struct drm_driver.output_poll_changed"), amdgpu did not show a framebuffer console if output events got lost. The bug got copy-pasted from fbdev-generic into the other fbdev emulation. Reported-by: Moritz Duge Closes: https://gitlab.freedesktop.org/drm/amd/-/issues/2649 Fixes: 6e3f17ee73f7 ("drm/fb-helper: generic: Call drm_client_add() after setup is done") Fixes: 8ab59da26bc0 ("drm/fb-helper: Move generic fbdev emulation into separate source file") Fixes: b79fe9abd58b ("drm/fbdev-dma: Implement fbdev emulation for GEM DMA helpers") Fixes: 63c381552f69 ("drm/armada: Implement fbdev emulation as in-kernel client") Fixes: 49953b70e7d3 ("drm/exynos: Implement fbdev emulation as in-kernel client") Fixes: 8f1aaccb04b7 ("drm/gma500: Implement client-based fbdev emulation") Fixes: 940b869c2f2f ("drm/msm: Implement fbdev emulation as in-kernel client") Fixes: 9e69bcd88e45 ("drm/omapdrm: Implement fbdev emulation as in-kernel client") Fixes: e317a69fe891 ("drm/radeon: Implement client-based fbdev emulation") Fixes: 71ec16f45ef8 ("drm/tegra: Implement fbdev emulation as in-kernel client") Signed-off-by: Thomas Zimmermann Tested-by: Moritz Duge Tested-by: Torsten Krah Tested-by: Paul Schyska Cc: Daniel Vetter Cc: David Airlie Cc: Noralf Trønnes Cc: Maarten Lankhorst Cc: Maxime Ripard Cc: Javier Martinez Canillas Cc: Russell King Cc: Inki Dae Cc: Seung-Woo Kim Cc: Kyungmin Park Cc: Krzysztof Kozlowski Cc: Patrik Jakobsson Cc: Rob Clark Cc: Abhinav Kumar Cc: Dmitry Baryshkov Cc: Tomi Valkeinen Cc: Alex Deucher Cc: "Christian König" Cc: "Pan, Xinhui" Cc: Thierry Reding Cc: Mikko Perttunen Cc: dri-de...@lists.freedesktop.org Cc: linux-ker...@vger.kernel.org Cc: linux-arm-ker...@lists.infradead.org Cc: linux-samsung-...@vger.kernel.org Cc: linux-arm-...@vger.kernel.org Cc: freedr...@lists.freedesktop.org Cc: amd-gfx@lists.freedesktop.org Cc: linux-te...@vger.kernel.org Cc: dri-de...@lists.freedesktop.org Cc: # v5.2+ --- drivers/gpu/drm/armada/armada_fbdev.c | 4 drivers/gpu/drm/drm_client.c | 21 + drivers/gpu/drm/drm_fbdev_dma.c | 4 drivers/gpu/drm/drm_fbdev_generic.c | 4 drivers/gpu/drm/exynos/exynos_drm_fbdev.c | 4 drivers/gpu/drm/gma500/fbdev.c| 4 drivers/gpu/drm/msm/msm_fbdev.c | 4 drivers/gpu/drm/omapdrm/omap_fbdev.c | 4 drivers/gpu/drm/radeon/radeon_fbdev.c | 4 drivers/gpu/drm/tegra/fbdev.c | 4 10 files changed, 21 insertions(+), 36 deletions(-) diff --git a/drivers/gpu/drm/armada/armada_fbdev.c b/drivers/gpu/drm/armada/armada_fbdev.c index 3943e89cc06c..e40a95e51785 100644 --- a/drivers/gpu/drm/armada/armada_fbdev.c +++ b/drivers/gpu/drm/armada/armada_fbdev.c @@ -209,10 +209,6 @@ void armada_fbdev_setup(struct drm_device *dev) goto err_drm_client_init; } - ret = armada_fbdev_client_hotplug(>client); - if (ret) - drm_dbg_kms(dev, "client hotplug ret=%d\n", ret); - drm_client_register(>client); return; diff --git a/drivers/gpu/drm/drm_client.c b/drivers/gpu/drm/drm_client.c index f6292ba0e6fc..037e36f2049c 100644 --- a/drivers/gpu/drm/drm_client.c +++ b/drivers/gpu/drm/drm_client.c @@ -122,13 +122,34 @@ EXPORT_SYMBOL(drm_client_init); *
[PATCH V6 9/9] drm/amd/pm: enable Wifi RFI mitigation feature support for SMU13.0.7
Fulfill the SMU13.0.7 support for Wifi RFI mitigation feature. Signed-off-by: Evan Quan Reviewed-by: Mario Limonciello --- .../drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c | 59 +++ 1 file changed, 59 insertions(+) diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c index bba621615abf..4a680756208b 100644 --- a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c +++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c @@ -126,6 +126,7 @@ static struct cmn2asic_msg_mapping smu_v13_0_7_message_map[SMU_MSG_MAX_COUNT] = MSG_MAP(AllowGpo, PPSMC_MSG_SetGpoAllow, 0), MSG_MAP(GetPptLimit,PPSMC_MSG_GetPptLimit, 0), MSG_MAP(NotifyPowerSource, PPSMC_MSG_NotifyPowerSource, 0), + MSG_MAP(EnableUCLKShadow, PPSMC_MSG_EnableUCLKShadow, 0), }; static struct cmn2asic_mapping smu_v13_0_7_clk_map[SMU_CLK_COUNT] = { @@ -206,6 +207,7 @@ static struct cmn2asic_mapping smu_v13_0_7_table_map[SMU_TABLE_COUNT] = { TAB_MAP(DRIVER_SMU_CONFIG), TAB_MAP(ACTIVITY_MONITOR_COEFF), [SMU_TABLE_COMBO_PPTABLE] = {1, TABLE_COMBO_PPTABLE}, + TAB_MAP(WIFIBAND), }; static struct cmn2asic_mapping smu_v13_0_7_pwr_src_map[SMU_POWER_SOURCE_COUNT] = { @@ -488,6 +490,9 @@ static int smu_v13_0_7_tables_init(struct smu_context *smu) AMDGPU_GEM_DOMAIN_VRAM); SMU_TABLE_INIT(tables, SMU_TABLE_COMBO_PPTABLE, MP0_MP1_DATA_REGION_SIZE_COMBOPPTABLE, PAGE_SIZE, AMDGPU_GEM_DOMAIN_VRAM); + SMU_TABLE_INIT(tables, SMU_TABLE_WIFIBAND, + sizeof(WifiBandEntryTable_t), PAGE_SIZE, + AMDGPU_GEM_DOMAIN_VRAM); smu_table->metrics_table = kzalloc(sizeof(SmuMetricsExternal_t), GFP_KERNEL); if (!smu_table->metrics_table) @@ -1722,6 +1727,57 @@ static int smu_v13_0_7_set_df_cstate(struct smu_context *smu, NULL); } +static bool smu_v13_0_7_wbrf_support_check(struct smu_context *smu) +{ + return smu->smc_fw_version > 0x00524600; +} + +static int smu_v13_0_7_set_wbrf_exclusion_ranges(struct smu_context *smu, +struct exclusion_range *exclusion_ranges) +{ + WifiBandEntryTable_t wifi_bands; + int valid_entries = 0; + int ret, i; + + memset(_bands, 0, sizeof(wifi_bands)); + for (i = 0; i < ARRAY_SIZE(wifi_bands.WifiBandEntry); i++) { + if (!exclusion_ranges[i].start && + !exclusion_ranges[i].end) + break; + + /* PMFW expects the inputs to be in Mhz unit */ + wifi_bands.WifiBandEntry[valid_entries].LowFreq = + DIV_ROUND_DOWN_ULL(exclusion_ranges[i].start, HZ_IN_MHZ); + wifi_bands.WifiBandEntry[valid_entries++].HighFreq = + DIV_ROUND_UP_ULL(exclusion_ranges[i].end, HZ_IN_MHZ); + } + wifi_bands.WifiBandEntryNum = valid_entries; + + /* +* Per confirm with PMFW team, WifiBandEntryNum = 0 is a valid setting. +* Considering the scenarios below: +* - At first the wifi device adds an exclusion range e.g. (2400,2500) to +* BIOS and our driver gets notified. We will set WifiBandEntryNum = 1 +* and pass the WifiBandEntry (2400, 2500) to PMFW. +* +* - Later the wifi device removes the wifiband list added above and +* our driver gets notified again. At this time, driver will set +* WifiBandEntryNum = 0 and pass an empty WifiBandEntry list to PMFW. +* - PMFW may still need to do some uclk shadow update(e.g. switching +* from shadow clock back to primary clock) on receiving this. +*/ + + ret = smu_cmn_update_table(smu, + SMU_TABLE_WIFIBAND, + 0, + (void *)(_bands), + true); + if (ret) + dev_err(smu->adev->dev, "Failed to set wifiband!"); + + return ret; +} + static const struct pptable_funcs smu_v13_0_7_ppt_funcs = { .get_allowed_feature_mask = smu_v13_0_7_get_allowed_feature_mask, .set_default_dpm_table = smu_v13_0_7_set_default_dpm_table, @@ -1787,6 +1843,9 @@ static const struct pptable_funcs smu_v13_0_7_ppt_funcs = { .set_mp1_state = smu_v13_0_7_set_mp1_state, .set_df_cstate = smu_v13_0_7_set_df_cstate, .gpo_control = smu_v13_0_gpo_control, + .is_asic_wbrf_supported = smu_v13_0_7_wbrf_support_check, + .enable_uclk_shadow = smu_v13_0_enable_uclk_shadow, + .set_wbrf_exclusion_ranges = smu_v13_0_7_set_wbrf_exclusion_ranges, }; void smu_v13_0_7_set_ppt_funcs(struct smu_context *smu)
[PATCH V6 8/9] drm/amd/pm: enable Wifi RFI mitigation feature support for SMU13.0.0
Fulfill the SMU13.0.0 support for Wifi RFI mitigation feature. Signed-off-by: Evan Quan Reviewed-by: Mario Limonciello --- drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h | 3 + drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h | 3 +- drivers/gpu/drm/amd/pm/swsmu/inc/smu_v13_0.h | 3 + .../gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c| 9 +++ .../drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c | 60 +++ 5 files changed, 77 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h b/drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h index 5df28d4a8c30..32764c509ba8 100644 --- a/drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h +++ b/drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h @@ -325,6 +325,7 @@ enum smu_table_id SMU_TABLE_PACE, SMU_TABLE_ECCINFO, SMU_TABLE_COMBO_PPTABLE, + SMU_TABLE_WIFIBAND, SMU_TABLE_COUNT, }; @@ -1499,6 +1500,8 @@ enum smu_baco_seq { __dst_size); \ }) +#define HZ_IN_MHZ 100U + #if !defined(SWSMU_CODE_LAYER_L2) && !defined(SWSMU_CODE_LAYER_L3) && !defined(SWSMU_CODE_LAYER_L4) int smu_get_power_limit(void *handle, uint32_t *limit, diff --git a/drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h b/drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h index 297b70b9388f..5bbb60289a79 100644 --- a/drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h +++ b/drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h @@ -245,7 +245,8 @@ __SMU_DUMMY_MAP(AllowGpo), \ __SMU_DUMMY_MAP(Mode2Reset),\ __SMU_DUMMY_MAP(RequestI2cTransaction), \ - __SMU_DUMMY_MAP(GetMetricsTable), + __SMU_DUMMY_MAP(GetMetricsTable), \ + __SMU_DUMMY_MAP(EnableUCLKShadow), #undef __SMU_DUMMY_MAP #define __SMU_DUMMY_MAP(type) SMU_MSG_##type diff --git a/drivers/gpu/drm/amd/pm/swsmu/inc/smu_v13_0.h b/drivers/gpu/drm/amd/pm/swsmu/inc/smu_v13_0.h index df3baaab0037..b6fae9b92303 100644 --- a/drivers/gpu/drm/amd/pm/swsmu/inc/smu_v13_0.h +++ b/drivers/gpu/drm/amd/pm/swsmu/inc/smu_v13_0.h @@ -303,5 +303,8 @@ int smu_v13_0_get_pptable_from_firmware(struct smu_context *smu, uint32_t *size, uint32_t pptable_id); +int smu_v13_0_enable_uclk_shadow(struct smu_context *smu, +bool enablement); + #endif #endif diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c index ca379181081c..7cb24c862720 100644 --- a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c +++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c @@ -2453,3 +2453,12 @@ int smu_v13_0_mode1_reset(struct smu_context *smu) return ret; } + +int smu_v13_0_enable_uclk_shadow(struct smu_context *smu, +bool enablement) +{ + return smu_cmn_send_smc_msg_with_param(smu, + SMU_MSG_EnableUCLKShadow, + enablement, + NULL); +} diff --git a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c index 08577d1b84ec..3e864bd2c5a4 100644 --- a/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c +++ b/drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c @@ -155,6 +155,7 @@ static struct cmn2asic_msg_mapping smu_v13_0_0_message_map[SMU_MSG_MAX_COUNT] = MSG_MAP(AllowGpo, PPSMC_MSG_SetGpoAllow, 0), MSG_MAP(AllowIHHostInterrupt, PPSMC_MSG_AllowIHHostInterrupt, 0), MSG_MAP(ReenableAcDcInterrupt, PPSMC_MSG_ReenableAcDcInterrupt, 0), + MSG_MAP(EnableUCLKShadow, PPSMC_MSG_EnableUCLKShadow, 0), }; static struct cmn2asic_mapping smu_v13_0_0_clk_map[SMU_CLK_COUNT] = { @@ -235,6 +236,7 @@ static struct cmn2asic_mapping smu_v13_0_0_table_map[SMU_TABLE_COUNT] = { TAB_MAP(DRIVER_SMU_CONFIG), TAB_MAP(ACTIVITY_MONITOR_COEFF), [SMU_TABLE_COMBO_PPTABLE] = {1, TABLE_COMBO_PPTABLE}, + TAB_MAP(WIFIBAND), TAB_MAP(I2C_COMMANDS), TAB_MAP(ECCINFO), }; @@ -472,6 +474,9 @@ static int smu_v13_0_0_tables_init(struct smu_context *smu) PAGE_SIZE, AMDGPU_GEM_DOMAIN_VRAM); SMU_TABLE_INIT(tables, SMU_TABLE_ECCINFO, sizeof(EccInfoTable_t), PAGE_SIZE, AMDGPU_GEM_DOMAIN_VRAM); + SMU_TABLE_INIT(tables, SMU_TABLE_WIFIBAND, + sizeof(WifiBandEntryTable_t), PAGE_SIZE, + AMDGPU_GEM_DOMAIN_VRAM); smu_table->metrics_table = kzalloc(sizeof(SmuMetricsExternal_t), GFP_KERNEL); if (!smu_table->metrics_table) @@ -2141,6 +2146,58 @@ static ssize_t smu_v13_0_0_get_ecc_info(struct smu_context *smu, return ret; } +static bool
[PATCH V6 7/9] drm/amd/pm: add flood detection for wbrf events
To protect PMFW from being overloaded. Signed-off-by: Evan Quan Reviewed-by: Mario Limonciello --- drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 31 +++ drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h | 7 + 2 files changed, 32 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c index 83d428e890df..aa7faeafc86b 100644 --- a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +++ b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c @@ -1278,7 +1278,8 @@ static int smu_wbrf_event_handler(struct notifier_block *nb, switch (action) { case WBRF_CHANGED: - smu_wbrf_handle_exclusion_ranges(smu); + schedule_delayed_work(>wbrf_delayed_work, + msecs_to_jiffies(SMU_WBRF_EVENT_HANDLING_PACE)); break; default: return NOTIFY_DONE; @@ -1287,6 +1288,21 @@ static int smu_wbrf_event_handler(struct notifier_block *nb, return NOTIFY_OK; } +/** + * smu_wbrf_delayed_work_handler - callback on delayed work timer expired + * + * @work: struct work_struct pointer + * + * Flood is over and driver will consume the latest exclusion ranges. + */ +static void smu_wbrf_delayed_work_handler(struct work_struct *work) +{ + struct smu_context *smu = + container_of(work, struct smu_context, wbrf_delayed_work.work); + + smu_wbrf_handle_exclusion_ranges(smu); +} + /** * smu_wbrf_support_check - check wbrf support * @@ -1317,12 +1333,14 @@ static void smu_wbrf_support_check(struct smu_context *smu) */ static int smu_wbrf_init(struct smu_context *smu) { - struct amdgpu_device *adev = smu->adev; int ret; if (!smu->wbrf_supported) return 0; + INIT_DELAYED_WORK(>wbrf_delayed_work, + smu_wbrf_delayed_work_handler); + smu->wbrf_notifier.notifier_call = smu_wbrf_event_handler; ret = wbrf_register_notifier(>wbrf_notifier); if (ret) @@ -1333,11 +1351,10 @@ static int smu_wbrf_init(struct smu_context *smu) * before our driver loaded. To make sure our driver * is awared of those exclusion ranges. */ - ret = smu_wbrf_handle_exclusion_ranges(smu); - if (ret) - dev_err(adev->dev, "Failed to handle wbrf exclusion ranges\n"); + schedule_delayed_work(>wbrf_delayed_work, + msecs_to_jiffies(SMU_WBRF_EVENT_HANDLING_PACE)); - return ret; + return 0; } /** @@ -1353,6 +1370,8 @@ static void smu_wbrf_fini(struct smu_context *smu) return; wbrf_unregister_notifier(>wbrf_notifier); + + cancel_delayed_work_sync(>wbrf_delayed_work); } static int smu_smc_hw_setup(struct smu_context *smu) diff --git a/drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h b/drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h index 5b2343cfc69b..5df28d4a8c30 100644 --- a/drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h +++ b/drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h @@ -480,6 +480,12 @@ struct stb_context { #define WORKLOAD_POLICY_MAX 7 +/* + * Configure wbrf event handling pace as there can be only one + * event processed every SMU_WBRF_EVENT_HANDLING_PACE ms. + */ +#define SMU_WBRF_EVENT_HANDLING_PACE 10 + struct smu_context { struct amdgpu_device*adev; @@ -579,6 +585,7 @@ struct smu_context /* data structures for wbrf feature support */ boolwbrf_supported; struct notifier_block wbrf_notifier; + struct delayed_work wbrf_delayed_work; }; struct i2c_adapter; -- 2.34.1
[PATCH V6 6/9] drm/amd/pm: setup the framework to support Wifi RFI mitigation feature
With WBRF feature supported, as a driver responding to the frequencies, amdgpu driver is able to do shadow pstate switching to mitigate possible interference(between its (G-)DDR memory clocks and local radio module frequency bands used by Wifi 6/6e/7). Signed-off-by: Evan Quan Reviewed-by: Mario Limonciello -- v1->v2: - update the prompt for feature support(Lijo) --- drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 19 ++ drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 194 ++ drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h | 23 +++ drivers/gpu/drm/amd/pm/swsmu/smu_internal.h | 3 + 5 files changed, 240 insertions(+) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu.h b/drivers/gpu/drm/amd/amdgpu/amdgpu.h index 02b827785e39..785d9b43f0c4 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu.h @@ -241,6 +241,7 @@ extern int amdgpu_num_kcq; #define AMDGPU_VCNFW_LOG_SIZE (32 * 1024) extern int amdgpu_vcnfw_log; extern int amdgpu_sg_display; +extern int amdgpu_wbrf; #define AMDGPU_VM_MAX_NUM_CTX 4096 #define AMDGPU_SG_THRESHOLD(256*1024*1024) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c index 393b6fb7a71d..d4f3921509a5 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c @@ -191,6 +191,7 @@ int amdgpu_smartshift_bias; int amdgpu_use_xgmi_p2p = 1; int amdgpu_vcnfw_log; int amdgpu_sg_display = -1; /* auto */ +int amdgpu_wbrf = -1; static void amdgpu_drv_delayed_reset_work_handler(struct work_struct *work); @@ -948,6 +949,24 @@ MODULE_PARM_DESC(smu_pptable_id, "specify pptable id to be used (-1 = auto(default) value, 0 = use pptable from vbios, > 0 = soft pptable id)"); module_param_named(smu_pptable_id, amdgpu_smu_pptable_id, int, 0444); +#if IS_ENABLED(CONFIG_WBRF) +/** + * DOC: wbrf (int) + * Enable Wifi RFI interference mitigation feature. + * Due to electrical and mechanical constraints there may be likely interference of + * relatively high-powered harmonics of the (G-)DDR memory clocks with local radio + * module frequency bands used by Wifi 6/6e/7. To mitigate the possible RFI interference, + * with this feature enabled, PMFW will use either “shadowed P-State” or “P-State” based + * on active list of frequencies in-use (to be avoided) as part of initial setting or + * P-state transition. However, there may be potential performance impact with this + * feature enabled. + * (0 = disabled, 1 = enabled, -1 = auto (default setting, will be enabled if supported)) + */ +MODULE_PARM_DESC(wbrf, + "Enable Wifi RFI interference mitigation (0 = disabled, 1 = enabled, -1 = auto(default)"); +module_param_named(wbrf, amdgpu_wbrf, int, 0444); +#endif + /* These devices are not supported by amdgpu. * They are supported by the mach64, r128, radeon drivers */ diff --git a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c index 2ddf5198e5c4..83d428e890df 100644 --- a/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c +++ b/drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c @@ -1188,6 +1188,173 @@ static int smu_get_thermal_temperature_range(struct smu_context *smu) return ret; } +/** + * smu_wbrf_handle_exclusion_ranges - consume the wbrf exclusion ranges + * + * @smu: smu_context pointer + * + * Retrieve the wbrf exclusion ranges and send them to PMFW for proper handling. + * Returns 0 on success, error on failure. + */ +static int smu_wbrf_handle_exclusion_ranges(struct smu_context *smu) +{ + struct wbrf_ranges_out wbrf_exclusion = {0}; + struct exclusion_range *wifi_bands = wbrf_exclusion.band_list; + struct amdgpu_device *adev = smu->adev; + uint64_t start, end; + int ret, i, j; + + ret = wbrf_retrieve_exclusions(adev->dev, _exclusion); + if (ret) { + dev_err(adev->dev, "Failed to retrieve exclusion ranges!\n"); + return ret; + } + + /* +* The exclusion ranges array we got might be filled with holes and duplicate +* entries. For example: +* {(2400, 2500), (0, 0), (6882, 6962), (2400, 2500), (0, 0), (6117, 6189), (0, 0)...} +* We need to do some sortups to eliminate those holes and duplicate entries. +* Expected output: {(2400, 2500), (6117, 6189), (6882, 6962), (0, 0)...} +*/ + for (i = 0; i < MAX_NUM_OF_WBRF_RANGES; i++) { + start = wifi_bands[i].start; + end = wifi_bands[i].end; + + /* get the last valid entry to fill the intermediate hole */ + if (!start && !end) { + for (j = MAX_NUM_OF_WBRF_RANGES - 1; j > i; j--) + if (wifi_bands[j].start && + wifi_bands[j].end) + break; + +
[PATCH V6 5/9] drm/amd/pm: update driver_if and ppsmc headers for coming wbrf feature
Add those data structures to support Wifi RFI mitigation feature. Signed-off-by: Evan Quan Reviewed-by: Mario Limonciello --- .../pm/swsmu/inc/pmfw_if/smu13_driver_if_v13_0_0.h | 14 +- .../pm/swsmu/inc/pmfw_if/smu13_driver_if_v13_0_7.h | 14 +- .../amd/pm/swsmu/inc/pmfw_if/smu_v13_0_0_ppsmc.h | 3 ++- .../amd/pm/swsmu/inc/pmfw_if/smu_v13_0_7_ppsmc.h | 3 ++- 4 files changed, 30 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu13_driver_if_v13_0_0.h b/drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu13_driver_if_v13_0_0.h index b686fb68a6e7..d64188fb5839 100644 --- a/drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu13_driver_if_v13_0_0.h +++ b/drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu13_driver_if_v13_0_0.h @@ -388,6 +388,17 @@ typedef struct { EccInfo_t EccInfo[24]; } EccInfoTable_t; +typedef struct { + uint16_t LowFreq; + uint16_t HighFreq; +} WifiOneBand_t; + +typedef struct { + uint32_t WifiBandEntryNum; + WifiOneBand_tWifiBandEntry[11]; + uint32_t MmHubPadding[8]; +} WifiBandEntryTable_t; + //D3HOT sequences typedef enum { BACO_SEQUENCE, @@ -1592,7 +1603,8 @@ typedef struct { #define TABLE_I2C_COMMANDS9 #define TABLE_DRIVER_INFO 10 #define TABLE_ECCINFO 11 -#define TABLE_COUNT 12 +#define TABLE_WIFIBAND12 +#define TABLE_COUNT 13 //IH Interupt ID #define IH_INTERRUPT_ID_TO_DRIVER 0xFE diff --git a/drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu13_driver_if_v13_0_7.h b/drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu13_driver_if_v13_0_7.h index 4c46a0392451..77483e8485e7 100644 --- a/drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu13_driver_if_v13_0_7.h +++ b/drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu13_driver_if_v13_0_7.h @@ -392,6 +392,17 @@ typedef struct { EccInfo_t EccInfo[24]; } EccInfoTable_t; +typedef struct { + uint16_t LowFreq; + uint16_t HighFreq; +} WifiOneBand_t; + +typedef struct { + uint32_t WifiBandEntryNum; + WifiOneBand_tWifiBandEntry[11]; + uint32_t MmHubPadding[8]; +} WifiBandEntryTable_t; + //D3HOT sequences typedef enum { BACO_SEQUENCE, @@ -1624,7 +1635,8 @@ typedef struct { #define TABLE_I2C_COMMANDS9 #define TABLE_DRIVER_INFO 10 #define TABLE_ECCINFO 11 -#define TABLE_COUNT 12 +#define TABLE_WIFIBAND12 +#define TABLE_COUNT 13 //IH Interupt ID #define IH_INTERRUPT_ID_TO_DRIVER 0xFE diff --git a/drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu_v13_0_0_ppsmc.h b/drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu_v13_0_0_ppsmc.h index 10cff75b44d5..c98cc32d11bd 100644 --- a/drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu_v13_0_0_ppsmc.h +++ b/drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu_v13_0_0_ppsmc.h @@ -138,7 +138,8 @@ #define PPSMC_MSG_SetBadMemoryPagesRetiredFlagsPerChannel 0x4A #define PPSMC_MSG_SetPriorityDeltaGain 0x4B #define PPSMC_MSG_AllowIHHostInterrupt 0x4C -#define PPSMC_Message_Count 0x4D +#define PPSMC_MSG_EnableUCLKShadow 0x51 +#define PPSMC_Message_Count 0x52 //Debug Dump Message #define DEBUGSMC_MSG_TestMessage0x1 diff --git a/drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu_v13_0_7_ppsmc.h b/drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu_v13_0_7_ppsmc.h index 6aaefca9b595..a6bf9cdd130e 100644 --- a/drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu_v13_0_7_ppsmc.h +++ b/drivers/gpu/drm/amd/pm/swsmu/inc/pmfw_if/smu_v13_0_7_ppsmc.h @@ -134,6 +134,7 @@ #define PPSMC_MSG_SetBadMemoryPagesRetiredFlagsPerChannel 0x4A #define PPSMC_MSG_SetPriorityDeltaGain 0x4B #define PPSMC_MSG_AllowIHHostInterrupt 0x4C -#define PPSMC_Message_Count 0x4D +#define PPSMC_MSG_EnableUCLKShadow 0x51 +#define PPSMC_Message_Count 0x52 #endif -- 2.34.1
[PATCH V6 4/9] wifi: mac80211: Add support for ACPI WBRF
To support AMD's WBRF interference mitigation mechanism, Wifi adapters utilized in the system must register the frequencies in use(or unregister those frequencies no longer used) via the dedicated APCI calls. So that, other drivers responding to the frequencies can take proper actions to mitigate possible interference. Co-developed-by: Mario Limonciello Signed-off-by: Mario Limonciello Co-developed-by: Evan Quan Signed-off-by: Evan Quan -- v1->v2: - place the new added member(`wbrf_supported`) in ieee80211_local(Johannes) - handle chandefs change scenario properly(Johannes) - some minor fixes around code sharing and possible invalid input checks(Johannes) v2->v3: - drop unnecessary input checks and intermediate APIs(Mario) - Separate some mac80211 common code(Mario, Johannes) v3->v4: - some minor fixes around return values(Johannes) --- include/linux/ieee80211.h | 1 + net/mac80211/Makefile | 2 + net/mac80211/chan.c| 9 net/mac80211/ieee80211_i.h | 19 +++ net/mac80211/main.c| 2 + net/mac80211/wbrf.c| 103 + 6 files changed, 136 insertions(+) create mode 100644 net/mac80211/wbrf.c diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h index c4cf296e7eaf..0703921547f5 100644 --- a/include/linux/ieee80211.h +++ b/include/linux/ieee80211.h @@ -4319,6 +4319,7 @@ static inline int ieee80211_get_tdls_action(struct sk_buff *skb, u32 hdr_size) /* convert frequencies */ #define MHZ_TO_KHZ(freq) ((freq) * 1000) #define KHZ_TO_MHZ(freq) ((freq) / 1000) +#define KHZ_TO_HZ(freq) ((freq) * 1000) #define PR_KHZ(f) KHZ_TO_MHZ(f), f % 1000 #define KHZ_F "%d.%03d" diff --git a/net/mac80211/Makefile b/net/mac80211/Makefile index b8de44da1fb8..8f8ac567e7c8 100644 --- a/net/mac80211/Makefile +++ b/net/mac80211/Makefile @@ -65,4 +65,6 @@ rc80211_minstrel-$(CONFIG_MAC80211_DEBUGFS) += \ mac80211-$(CONFIG_MAC80211_RC_MINSTREL) += $(rc80211_minstrel-y) +mac80211-$(CONFIG_WBRF) += wbrf.o + ccflags-y += -DDEBUG diff --git a/net/mac80211/chan.c b/net/mac80211/chan.c index 77c90ed8f5d7..9887471028dc 100644 --- a/net/mac80211/chan.c +++ b/net/mac80211/chan.c @@ -506,11 +506,16 @@ static void _ieee80211_change_chanctx(struct ieee80211_local *local, WARN_ON(!cfg80211_chandef_compatible(>conf.def, chandef)); + ieee80211_remove_wbrf(local, >conf.def); + ctx->conf.def = *chandef; /* check if min chanctx also changed */ changed = IEEE80211_CHANCTX_CHANGE_WIDTH | _ieee80211_recalc_chanctx_min_def(local, ctx, rsvd_for); + + ieee80211_add_wbrf(local, >conf.def); + drv_change_chanctx(local, ctx, changed); if (!local->use_chanctx) { @@ -668,6 +673,8 @@ static int ieee80211_add_chanctx(struct ieee80211_local *local, lockdep_assert_held(>mtx); lockdep_assert_held(>chanctx_mtx); + ieee80211_add_wbrf(local, >conf.def); + if (!local->use_chanctx) local->hw.conf.radar_enabled = ctx->conf.radar_enabled; @@ -748,6 +755,8 @@ static void ieee80211_del_chanctx(struct ieee80211_local *local, } ieee80211_recalc_idle(local); + + ieee80211_remove_wbrf(local, >conf.def); } static void ieee80211_free_chanctx(struct ieee80211_local *local, diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index 4159fb65038b..fb984ce7038c 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h @@ -1591,6 +1591,10 @@ struct ieee80211_local { /* extended capabilities provided by mac80211 */ u8 ext_capa[8]; + +#if IS_ENABLED(CONFIG_WBRF) + bool wbrf_supported; +#endif }; static inline struct ieee80211_sub_if_data * @@ -2615,4 +2619,19 @@ ieee80211_eht_cap_ie_to_sta_eht_cap(struct ieee80211_sub_if_data *sdata, const struct ieee80211_eht_cap_elem *eht_cap_ie_elem, u8 eht_cap_len, struct link_sta_info *link_sta); + +#if IS_ENABLED(CONFIG_WBRF) +void ieee80211_check_wbrf_support(struct ieee80211_local *local); +void ieee80211_add_wbrf(struct ieee80211_local *local, + struct cfg80211_chan_def *chandef); +void ieee80211_remove_wbrf(struct ieee80211_local *local, + struct cfg80211_chan_def *chandef); +#else +static inline void ieee80211_check_wbrf_support(struct ieee80211_local *local) { } +static inline void ieee80211_add_wbrf(struct ieee80211_local *local, + struct cfg80211_chan_def *chandef) { } +static inline void ieee80211_remove_wbrf(struct ieee80211_local *local, +struct cfg80211_chan_def *chandef) { } +#endif /* CONFIG_WBRF */ + #endif /* IEEE80211_I_H */ diff --git a/net/mac80211/main.c b/net/mac80211/main.c index 55cdfaef0f5d..0a55626b1546 100644 --- a/net/mac80211/main.c +++
[PATCH V6 3/9] cfg80211: expose nl80211_chan_width_to_mhz for wide sharing
The newly added WBRF feature needs this interface for channel width calculation. Signed-off-by: Evan Quan --- include/net/cfg80211.h | 8 net/wireless/chan.c| 3 ++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index 9e04f69712b1..c6dc337eafce 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h @@ -920,6 +920,14 @@ const struct cfg80211_chan_def * cfg80211_chandef_compatible(const struct cfg80211_chan_def *chandef1, const struct cfg80211_chan_def *chandef2); +/** + * nl80211_chan_width_to_mhz - get the channel width in Mhz + * @chan_width: the channel width from nl80211_chan_width + * Return: channel width in Mhz if the chan_width from nl80211_chan_width + * is valid. -1 otherwise. + */ +int nl80211_chan_width_to_mhz(enum nl80211_chan_width chan_width); + /** * cfg80211_chandef_valid - check if a channel definition is valid * @chandef: the channel definition to check diff --git a/net/wireless/chan.c b/net/wireless/chan.c index 0b7e81db383d..227db04eac42 100644 --- a/net/wireless/chan.c +++ b/net/wireless/chan.c @@ -141,7 +141,7 @@ static bool cfg80211_edmg_chandef_valid(const struct cfg80211_chan_def *chandef) return true; } -static int nl80211_chan_width_to_mhz(enum nl80211_chan_width chan_width) +int nl80211_chan_width_to_mhz(enum nl80211_chan_width chan_width) { int mhz; @@ -190,6 +190,7 @@ static int nl80211_chan_width_to_mhz(enum nl80211_chan_width chan_width) } return mhz; } +EXPORT_SYMBOL(nl80211_chan_width_to_mhz); static int cfg80211_chandef_get_width(const struct cfg80211_chan_def *c) { -- 2.34.1
[PATCH V6 2/9] driver core: add ACPI based WBRF mechanism introduced by AMD
AMD has introduced an ACPI based mechanism to support WBRF for some platforms with AMD dGPU + WLAN. This needs support from BIOS equipped with necessary AML implementations and dGPU firmwares. For those systems without the ACPI mechanism and developing solutions, user can use the generic WBRF solution for diagnosing potential interference issues. Co-developed-by: Mario Limonciello Signed-off-by: Mario Limonciello Co-developed-by: Evan Quan Signed-off-by: Evan Quan -- v4->v5: - promote this to be a more generic solution with input argument taking `struct device` and provide better scalability to support non-ACPI scenarios(Andrew) - update the APIs naming and some other minor fixes(Rafael) v5->v6: - make the code more readable and some other fixes(Andrew) --- drivers/acpi/Makefile | 2 + drivers/acpi/amd_wbrf.c | 269 ++ drivers/base/Kconfig | 29 drivers/base/wbrf.c | 35 - include/linux/acpi_amd_wbrf.h | 24 +++ include/linux/wbrf.h | 2 + 6 files changed, 355 insertions(+), 6 deletions(-) create mode 100644 drivers/acpi/amd_wbrf.c create mode 100644 include/linux/acpi_amd_wbrf.h diff --git a/drivers/acpi/Makefile b/drivers/acpi/Makefile index feb36c0b9446..94b940ddbf88 100644 --- a/drivers/acpi/Makefile +++ b/drivers/acpi/Makefile @@ -131,3 +131,5 @@ obj-y += dptf/ obj-$(CONFIG_ARM64)+= arm64/ obj-$(CONFIG_ACPI_VIOT)+= viot.o + +obj-$(CONFIG_WBRF_AMD_ACPI)+= amd_wbrf.o diff --git a/drivers/acpi/amd_wbrf.c b/drivers/acpi/amd_wbrf.c new file mode 100644 index ..481b1c180a09 --- /dev/null +++ b/drivers/acpi/amd_wbrf.c @@ -0,0 +1,269 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Wifi Band Exclusion Interface (AMD ACPI Implementation) + * Copyright (C) 2023 Advanced Micro Devices + * + */ + +#include +#include + +/* + * Functions bit vector for WBRF method + * + * Bit 0: Supported for any functions other than function 0. + * Bit 1: Function 1 (Add / Remove frequency) is supported. + * Bit 2: Function 2 (Get frequency list) is supported. + */ +#define WBRF_SUPPORT_OTHER_FUNCTION0x0 +#define WBRF_RECORD0x1 +#define WBRF_RETRIEVE 0x2 + +/* record actions */ +#define WBRF_RECORD_ADD0x0 +#define WBRF_RECORD_REMOVE 0x1 + +#define WBRF_REVISION 0x1 + +static const guid_t wifi_acpi_dsm_guid = + GUID_INIT(0x7b7656cf, 0xdc3d, 0x4c1c, + 0x83, 0xe9, 0x66, 0xe7, 0x21, 0xde, 0x30, 0x70); + +static int wbrf_dsm(struct acpi_device *adev, u8 fn, + union acpi_object *argv4, + union acpi_object **out) +{ + union acpi_object *obj; + int rc; + + obj = acpi_evaluate_dsm(adev->handle, _acpi_dsm_guid, + WBRF_REVISION, fn, argv4); + if (!obj) + return -ENXIO; + + switch (obj->type) { + case ACPI_TYPE_BUFFER: + *out = obj; + return 0; + + case ACPI_TYPE_INTEGER: + rc = obj->integer.value ? -EINVAL : 0; + break; + + default: + rc = -EOPNOTSUPP; + } + + ACPI_FREE(obj); + + return rc; +} + +static int wbrf_record(struct acpi_device *adev, uint8_t action, + struct wbrf_ranges_in *in) +{ + union acpi_object argv4; + union acpi_object *tmp; + u32 num_of_ranges = 0; + u32 num_of_elements; + u32 arg_idx = 0; + u32 loop_idx; + int ret; + + if (!in) + return -EINVAL; + + for (loop_idx = 0; loop_idx < ARRAY_SIZE(in->band_list); +loop_idx++) + if (in->band_list[loop_idx].start && + in->band_list[loop_idx].end) + num_of_ranges++; + + /* +* Every range comes with two end points(start and end) and +* each of them is accounted as an element. Meanwhile the range +* count and action type are accounted as an element each. +* So, the total element count = 2 * num_of_ranges + 1 + 1. +*/ + num_of_elements = 2 * num_of_ranges + 1 + 1; + + tmp = kcalloc(num_of_elements, sizeof(*tmp), GFP_KERNEL); + if (!tmp) + return -ENOMEM; + + argv4.package.type = ACPI_TYPE_PACKAGE; + argv4.package.count = num_of_elements; + argv4.package.elements = tmp; + + tmp[arg_idx].integer.type = ACPI_TYPE_INTEGER; + tmp[arg_idx++].integer.value = num_of_ranges; + tmp[arg_idx].integer.type = ACPI_TYPE_INTEGER; + tmp[arg_idx++].integer.value = action; + + for (loop_idx = 0; loop_idx < ARRAY_SIZE(in->band_list); +loop_idx++) { + if (!in->band_list[loop_idx].start || + !in->band_list[loop_idx].end) + continue; + +
[PATCH V6 1/9] drivers core: Add support for Wifi band RF mitigations
Due to electrical and mechanical constraints in certain platform designs there may be likely interference of relatively high-powered harmonics of the (G-)DDR memory clocks with local radio module frequency bands used by Wifi 6/6e/7. To mitigate this, AMD has introduced a mechanism that devices can use to notify active use of particular frequencies so that other devices can make relative internal adjustments as necessary to avoid this resonance. In order for a device to support this, the expected flow for device driver or subsystems: Drivers/subsystems contributing frequencies: 1) During probe, check `wbrf_supported_producer` to see if WBRF supported for the device. 2) If adding frequencies, then call `wbrf_add_exclusion` with the start and end ranges of the frequencies. 3) If removing frequencies, then call `wbrf_remove_exclusion` with start and end ranges of the frequencies. Drivers/subsystems responding to frequencies: 1) During probe, check `wbrf_supported_consumer` to see if WBRF is supported for the device. 2) Call the `wbrf_retrieve_exclusions` to retrieve the current exclusions on receiving an ACPI notification for a new frequency change. Co-developed-by: Mario Limonciello Signed-off-by: Mario Limonciello Co-developed-by: Evan Quan Signed-off-by: Evan Quan -- v4->v5: - promote this to be a more generic solution with input argument taking `struct device` and provide better scalability to support non-ACPI scenarios(Andrew) - update the APIs naming and some other minor fixes(Rafael) --- drivers/base/Kconfig | 8 ++ drivers/base/Makefile | 1 + drivers/base/wbrf.c | 227 ++ include/linux/wbrf.h | 70 + 4 files changed, 306 insertions(+) create mode 100644 drivers/base/wbrf.c create mode 100644 include/linux/wbrf.h diff --git a/drivers/base/Kconfig b/drivers/base/Kconfig index 2b8fd6bb7da0..5b441017b225 100644 --- a/drivers/base/Kconfig +++ b/drivers/base/Kconfig @@ -242,4 +242,12 @@ config FW_DEVLINK_SYNC_STATE_TIMEOUT command line option on every system/board your kernel is expected to work on. +config WBRF + bool "Wifi band RF mitigation mechanism" + default n + help + Wifi band RF mitigation mechanism allows multiple drivers from + different domains to notify the frequencies in use so that hardware + can be reconfigured to avoid harmonic conflicts. + endmenu diff --git a/drivers/base/Makefile b/drivers/base/Makefile index 3079bfe53d04..c844f68a6830 100644 --- a/drivers/base/Makefile +++ b/drivers/base/Makefile @@ -26,6 +26,7 @@ obj-$(CONFIG_GENERIC_MSI_IRQ) += platform-msi.o obj-$(CONFIG_GENERIC_ARCH_TOPOLOGY) += arch_topology.o obj-$(CONFIG_GENERIC_ARCH_NUMA) += arch_numa.o obj-$(CONFIG_ACPI) += physical_location.o +obj-$(CONFIG_WBRF) += wbrf.o obj-y += test/ diff --git a/drivers/base/wbrf.c b/drivers/base/wbrf.c new file mode 100644 index ..2163a8ec8a9a --- /dev/null +++ b/drivers/base/wbrf.c @@ -0,0 +1,227 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Wifi Band Exclusion Interface + * Copyright (C) 2023 Advanced Micro Devices + * + */ + +#include + +static BLOCKING_NOTIFIER_HEAD(wbrf_chain_head); +static DEFINE_MUTEX(wbrf_mutex); +static struct exclusion_range_pool wbrf_pool; + +static int _wbrf_add_exclusion_ranges(struct wbrf_ranges_in *in) +{ + int i, j; + + for (i = 0; i < ARRAY_SIZE(in->band_list); i++) { + if (!in->band_list[i].start && + !in->band_list[i].end) + continue; + + for (j = 0; j < ARRAY_SIZE(wbrf_pool.band_list); j++) { + if (wbrf_pool.band_list[j].start == in->band_list[i].start && + wbrf_pool.band_list[j].end == in->band_list[i].end) { + wbrf_pool.ref_counter[j]++; + break; + } + } + if (j < ARRAY_SIZE(wbrf_pool.band_list)) + continue; + + for (j = 0; j < ARRAY_SIZE(wbrf_pool.band_list); j++) { + if (!wbrf_pool.band_list[j].start && + !wbrf_pool.band_list[j].end) { + wbrf_pool.band_list[j].start = in->band_list[i].start; + wbrf_pool.band_list[j].end = in->band_list[i].end; + wbrf_pool.ref_counter[j] = 1; + break; + } + } + if (j >= ARRAY_SIZE(wbrf_pool.band_list)) + return -ENOSPC; + } + + return 0; +} + +static int _wbrf_remove_exclusion_ranges(struct wbrf_ranges_in *in) +{ + int i, j; + + for (i = 0; i < ARRAY_SIZE(in->band_list); i++) { + if (!in->band_list[i].start && + !in->band_list[i].end) +
[PATCH V6 0/9] Enable Wifi RFI interference mitigation feature support
Due to electrical and mechanical constraints in certain platform designs there may be likely interference of relatively high-powered harmonics of the (G-)DDR memory clocks with local radio module frequency bands used by Wifi 6/6e/7. To mitigate possible RFI interference producers can advertise the frequencies in use and consumers can use this information to avoid using these frequencies for sensitive features. The whole patch set is based on Linux 6.4. With some brief introductions as below: Patch1 - 2: Core functionality setup for WBRF feature support Patch3 - 4: Bring WBRF support to wifi subsystem. Patch5 - 9: Bring WBRF support to AMD graphics driver. Evan Quan (9): drivers core: Add support for Wifi band RF mitigations driver core: add ACPI based WBRF mechanism introduced by AMD cfg80211: expose nl80211_chan_width_to_mhz for wide sharing wifi: mac80211: Add support for ACPI WBRF drm/amd/pm: update driver_if and ppsmc headers for coming wbrf feature drm/amd/pm: setup the framework to support Wifi RFI mitigation feature drm/amd/pm: add flood detection for wbrf events drm/amd/pm: enable Wifi RFI mitigation feature support for SMU13.0.0 drm/amd/pm: enable Wifi RFI mitigation feature support for SMU13.0.7 drivers/acpi/Makefile | 2 + drivers/acpi/amd_wbrf.c | 269 ++ drivers/base/Kconfig | 37 +++ drivers/base/Makefile | 1 + drivers/base/wbrf.c | 250 drivers/gpu/drm/amd/amdgpu/amdgpu.h | 1 + drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 19 ++ drivers/gpu/drm/amd/pm/swsmu/amdgpu_smu.c | 213 ++ drivers/gpu/drm/amd/pm/swsmu/inc/amdgpu_smu.h | 33 +++ .../inc/pmfw_if/smu13_driver_if_v13_0_0.h | 14 +- .../inc/pmfw_if/smu13_driver_if_v13_0_7.h | 14 +- .../pm/swsmu/inc/pmfw_if/smu_v13_0_0_ppsmc.h | 3 +- .../pm/swsmu/inc/pmfw_if/smu_v13_0_7_ppsmc.h | 3 +- drivers/gpu/drm/amd/pm/swsmu/inc/smu_types.h | 3 +- drivers/gpu/drm/amd/pm/swsmu/inc/smu_v13_0.h | 3 + .../gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c| 9 + .../drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c | 60 .../drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c | 59 drivers/gpu/drm/amd/pm/swsmu/smu_internal.h | 3 + include/linux/acpi_amd_wbrf.h | 24 ++ include/linux/ieee80211.h | 1 + include/linux/wbrf.h | 72 + include/net/cfg80211.h| 8 + net/mac80211/Makefile | 2 + net/mac80211/chan.c | 9 + net/mac80211/ieee80211_i.h| 19 ++ net/mac80211/main.c | 2 + net/mac80211/wbrf.c | 103 +++ net/wireless/chan.c | 3 +- 29 files changed, 1233 insertions(+), 6 deletions(-) create mode 100644 drivers/acpi/amd_wbrf.c create mode 100644 drivers/base/wbrf.c create mode 100644 include/linux/acpi_amd_wbrf.h create mode 100644 include/linux/wbrf.h create mode 100644 net/mac80211/wbrf.c -- 2.34.1
Re: [PATCH v5 6/6] drm/doc: Define KMS atomic state set
On Fri, 7 Jul 2023 19:40:59 -0300 André Almeida wrote: > From: Pekka Paalanen > > Specify how the atomic state is maintained between userspace and > kernel, plus the special case for async flips. > > Signed-off-by: Pekka Paalanen > Signed-off-by: André Almeida > --- > v4: total rework by Pekka > --- > Documentation/gpu/drm-uapi.rst | 41 ++ > 1 file changed, 41 insertions(+) Thank you for polishing that email into a proper patch! For patches 1 and 2: Acked-by: Pekka Paalanen Thanks, pq > diff --git a/Documentation/gpu/drm-uapi.rst b/Documentation/gpu/drm-uapi.rst > index 65fb3036a580..6a1662c08901 100644 > --- a/Documentation/gpu/drm-uapi.rst > +++ b/Documentation/gpu/drm-uapi.rst > @@ -486,3 +486,44 @@ and the CRTC index is its position in this array. > > .. kernel-doc:: include/uapi/drm/drm_mode.h > :internal: > + > +KMS atomic state > + > + > +An atomic commit can change multiple KMS properties in an atomic fashion, > +without ever applying intermediate or partial state changes. Either the > whole > +commit succeeds or fails, and it will never be applied partially. This is the > +fundamental improvement of the atomic API over the older non-atomic API > which is > +referred to as the "legacy API". Applying intermediate state could > unexpectedly > +fail, cause visible glitches, or delay reaching the final state. > + > +An atomic commit can be flagged with DRM_MODE_ATOMIC_TEST_ONLY, which means > the > +complete state change is validated but not applied. Userspace should use > this > +flag to validate any state change before asking to apply it. If validation > fails > +for any reason, userspace should attempt to fall back to another, perhaps > +simpler, final state. This allows userspace to probe for various > configurations > +without causing visible glitches on screen and without the need to undo a > +probing change. > + > +The changes recorded in an atomic commit apply on top the current KMS state > in > +the kernel. Hence, the complete new KMS state is the complete old KMS state > with > +the committed property settings done on top. The kernel will automatically > avoid > +no-operation changes, so it is safe and even expected for userspace to send > +redundant property settings. No-operation changes do not count towards > actually > +needed changes, e.g. setting MODE_ID to a different blob with identical > +contents as the current KMS state shall not be a modeset on its own. > + > +A "modeset" is a change in KMS state that might enable, disable, or > temporarily > +disrupt the emitted video signal, possibly causing visible glitches on > screen. A > +modeset may also take considerably more time to complete than other kinds of > +changes, and the video sink might also need time to adapt to the new signal > +properties. Therefore a modeset must be explicitly allowed with the flag > +DRM_MODE_ATOMIC_ALLOW_MODESET. This in combination with > +DRM_MODE_ATOMIC_TEST_ONLY allows userspace to determine if a state change is > +likely to cause visible disruption on screen and avoid such changes when end > +users do not expect them. > + > +An atomic commit with the flag DRM_MODE_PAGE_FLIP_ASYNC is allowed to > +effectively change only the FB_ID property on any planes. No-operation > changes > +are ignored as always. Changing any other property will cause the commit to > be > +rejected. pgpJlYk5YR8xu.pgp Description: OpenPGP digital signature
[PATCH v2 2/2] drm/amdgpu: update kernel vcn ring test
add session context buffer to decoder ring test for vcn v1 to v3. v2 - add the buffer into IB (Leo liu) Signed-off-by: Saleemkhan Jamadar --- drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 12 1 file changed, 12 insertions(+) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c index 76e9a2418286..4c44d76f69de 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c @@ -521,6 +521,7 @@ static int amdgpu_vcn_dec_send_msg(struct amdgpu_ring *ring, struct dma_fence **fence) { u64 addr = AMDGPU_GPU_PAGE_ALIGN(ib_msg->gpu_addr); + uint64_t session_ctx_buf_gaddr = AMDGPU_GPU_PAGE_ALIGN(ib_msg->gpu_addr + 8192); struct amdgpu_device *adev = ring->adev; struct dma_fence *f = NULL; struct amdgpu_job *job; @@ -546,6 +547,17 @@ static int amdgpu_vcn_dec_send_msg(struct amdgpu_ring *ring, } ib->length_dw = 16; + ib->ptr[ib->length_dw++] = PACKET0(adev->vcn.internal.data0, 0); + ib->ptr[ib->length_dw++] = lower_32_bits(session_ctx_buf_gaddr); + ib->ptr[ib->length_dw++] = PACKET0(adev->vcn.internal.data1, 0); + ib->ptr[ib->length_dw++] = upper_32_bits(session_ctx_buf_gaddr); + ib->ptr[ib->length_dw++] = PACKET0(adev->vcn.internal.cmd, 0); + ib->ptr[ib->length_dw++] = 0; + for (i = ib->length_dw; i < 32; i += 2) { + ib->ptr[i] = PACKET0(adev->vcn.internal.nop, 0); + ib->ptr[i+1] = 0; + } + r = amdgpu_job_submit_direct(job, ring, ); if (r) goto err_free; -- 2.25.1
Re: [PATCH v5] drm/amdgpu:update kernel vcn ring test
Am 07.07.23 um 17:20 schrieb Saleemkhan Jamadar: add session context buffer to decoder ring test. v5 - clear the session ct buffer (Christian) v4 - data type, explain change of ib size change (Christian) v3 - indent and v2 changes correction. (Christian) v2 - put the buffer at the end of the IB (Christian) Signed-off-by: Saleemkhan Jamadar Acked-by: Leo Liu Acked-by: Christian König --- drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c | 13 +++-- drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h | 5 - 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c index 2d94f1b63bd6..76e9a2418286 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.c @@ -573,13 +573,15 @@ static int amdgpu_vcn_dec_get_create_msg(struct amdgpu_ring *ring, uint32_t hand int r, i; memset(ib, 0, sizeof(*ib)); - r = amdgpu_ib_get(adev, NULL, AMDGPU_GPU_PAGE_SIZE * 2, + /* 34 pages : 128KiB session context buffer size and 8KiB ib msg */ + r = amdgpu_ib_get(adev, NULL, AMDGPU_GPU_PAGE_SIZE * 34, AMDGPU_IB_POOL_DIRECT, ib); if (r) return r; msg = (uint32_t *)AMDGPU_GPU_PAGE_ALIGN((unsigned long)ib->ptr); + memset(msg, 0, (AMDGPU_GPU_PAGE_SIZE * 34)); msg[0] = cpu_to_le32(0x0028); msg[1] = cpu_to_le32(0x0038); msg[2] = cpu_to_le32(0x0001); @@ -608,13 +610,15 @@ static int amdgpu_vcn_dec_get_destroy_msg(struct amdgpu_ring *ring, uint32_t han int r, i; memset(ib, 0, sizeof(*ib)); - r = amdgpu_ib_get(adev, NULL, AMDGPU_GPU_PAGE_SIZE * 2, + /* 34 pages : 128KiB session context buffer size and 8KiB ib msg */ + r = amdgpu_ib_get(adev, NULL, AMDGPU_GPU_PAGE_SIZE * 34, AMDGPU_IB_POOL_DIRECT, ib); if (r) return r; msg = (uint32_t *)AMDGPU_GPU_PAGE_ALIGN((unsigned long)ib->ptr); + memset(msg, 0, (AMDGPU_GPU_PAGE_SIZE * 34)); msg[0] = cpu_to_le32(0x0028); msg[1] = cpu_to_le32(0x0018); msg[2] = cpu_to_le32(0x); @@ -700,6 +704,7 @@ static int amdgpu_vcn_dec_sw_send_msg(struct amdgpu_ring *ring, struct amdgpu_job *job; struct amdgpu_ib *ib; uint64_t addr = AMDGPU_GPU_PAGE_ALIGN(ib_msg->gpu_addr); + uint64_t session_ctx_buf_gaddr = AMDGPU_GPU_PAGE_ALIGN(ib_msg->gpu_addr + 8192); bool sq = amdgpu_vcn_using_unified_queue(ring); uint32_t *ib_checksum; uint32_t ib_pack_in_dw; @@ -730,6 +735,10 @@ static int amdgpu_vcn_dec_sw_send_msg(struct amdgpu_ring *ring, ib->length_dw += sizeof(struct amdgpu_vcn_decode_buffer) / 4; memset(decode_buffer, 0, sizeof(struct amdgpu_vcn_decode_buffer)); + decode_buffer->valid_buf_flag |= + cpu_to_le32(AMDGPU_VCN_CMD_FLAG_SESSION_CONTEXT_BUFFER); + decode_buffer->session_context_buffer_address_hi = upper_32_bits(session_ctx_buf_gaddr); + decode_buffer->session_context_buffer_address_lo = lower_32_bits(session_ctx_buf_gaddr); decode_buffer->valid_buf_flag |= cpu_to_le32(AMDGPU_VCN_CMD_FLAG_MSG_BUFFER); decode_buffer->msg_buffer_address_hi = cpu_to_le32(addr >> 32); decode_buffer->msg_buffer_address_lo = cpu_to_le32(addr); diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h index f1397ef66fd7..2df43cd76c10 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vcn.h @@ -166,6 +166,7 @@ #define AMDGPU_VCN_IB_FLAG_DECODE_BUFFER 0x0001 #define AMDGPU_VCN_CMD_FLAG_MSG_BUFFER0x0001 +#define AMDGPU_VCN_CMD_FLAG_SESSION_CONTEXT_BUFFER 0x0010 #define VCN_CODEC_DISABLE_MASK_AV1 (1 << 0) #define VCN_CODEC_DISABLE_MASK_VP9 (1 << 1) @@ -357,7 +358,9 @@ struct amdgpu_vcn_decode_buffer { uint32_t valid_buf_flag; uint32_t msg_buffer_address_hi; uint32_t msg_buffer_address_lo; - uint32_t pad[30]; + uint32_t session_context_buffer_address_hi; + uint32_t session_context_buffer_address_lo; + uint32_t pad[28]; }; #define VCN_BLOCK_ENCODE_DISABLE_MASK 0x80
[PATCH] dc_dmub_srv: Use max()/min() function for better coding conventions
It is advisable to utilize the max() function in the dc_dmub_srv.c file, as it conforms better to programming conventions. Signed-off-by: Yang Rong --- drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) mode change 100644 => 100755 drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c diff --git a/drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c b/drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c index c753c6f30dd7..df79aea49a3c --- a/drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c +++ b/drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c @@ -22,7 +22,7 @@ * Authors: AMD * */ - +#include #include "dc.h" #include "dc_dmub_srv.h" #include "../dmub/dmub_srv.h" @@ -481,7 +481,7 @@ static void populate_subvp_cmd_drr_info(struct dc *dc, max_drr_vblank_us = div64_u64((subvp_active_us - prefetch_us - dc->caps.subvp_fw_processing_delay_us - drr_active_us), 2) + drr_active_us; max_drr_mallregion_us = subvp_active_us - prefetch_us - mall_region_us - dc->caps.subvp_fw_processing_delay_us; - max_drr_supported_us = max_drr_vblank_us > max_drr_mallregion_us ? max_drr_vblank_us : max_drr_mallregion_us; + max_drr_supported_us = max(max_drr_vblank_us, max_drr_mallregion_us); max_vtotal_supported = div64_u64(((uint64_t)drr_timing->pix_clk_100hz * 100 * max_drr_supported_us), (((uint64_t)drr_timing->h_total * 100))); @@ -771,7 +771,7 @@ void dc_dmub_setup_subvp_dmub_command(struct dc *dc, wm_val_refclk = context->bw_ctx.bw.dcn.watermarks.a.cstate_pstate.pstate_change_ns * (dc->res_pool->ref_clocks.dchub_ref_clock_inKhz / 1000) / 1000; - cmd.fw_assisted_mclk_switch_v2.config_data.watermark_a_cache = wm_val_refclk < 0x ? wm_val_refclk : 0x; + cmd.fw_assisted_mclk_switch_v2.config_data.watermark_a_cache = min(wm_val_refclk, 0x); } dm_execute_dmub_cmd(dc->ctx, , DM_DMUB_WAIT_TYPE_WAIT); -- 2.35.3
RE: [PATCH] drm/amdgpu/vkms: relax timer deactivation by hrtimer_try_to_cancel
[Public] > -Original Message- > From: Chen, Guchun > Sent: Friday, July 7, 2023 9:06 AM > To: Koenig, Christian ; amd- > g...@lists.freedesktop.org; Deucher, Alexander > ; Zhang, Hawking > ; Milinkovic, Dusica > ; Prica, Nikola ; Cui, > Flora > Cc: sta...@vger.kernel.org > Subject: RE: [PATCH] drm/amdgpu/vkms: relax timer deactivation by > hrtimer_try_to_cancel > > > > > -Original Message- > > From: Koenig, Christian > > Sent: Thursday, July 6, 2023 7:25 PM > > To: Chen, Guchun ; amd- > > g...@lists.freedesktop.org; Deucher, Alexander > > ; Zhang, Hawking > ; > > Milinkovic, Dusica ; Prica, Nikola > > ; Cui, Flora > > Cc: sta...@vger.kernel.org > > Subject: Re: [PATCH] drm/amdgpu/vkms: relax timer deactivation by > > hrtimer_try_to_cancel > > > > Am 06.07.23 um 10:35 schrieb Guchun Chen: > > > In below thousands of screen rotation loop tests with virtual > > > display enabled, a CPU hard lockup issue may happen, leading system > > > to unresponsive and crash. > > > > > > do { > > > xrandr --output Virtual --rotate inverted > > > xrandr --output Virtual --rotate right > > > xrandr --output Virtual --rotate left > > > xrandr --output Virtual --rotate normal } while (1); > > > > > > NMI watchdog: Watchdog detected hard LOCKUP on cpu 4 > > > > > > ? hrtimer_run_softirq+0x140/0x140 > > > ? store_vblank+0xe0/0xe0 [drm] > > > hrtimer_cancel+0x15/0x30 > > > amdgpu_vkms_disable_vblank+0x15/0x30 [amdgpu] > > > drm_vblank_disable_and_save+0x185/0x1f0 [drm] > > > drm_crtc_vblank_off+0x159/0x4c0 [drm] ? > > > record_print_text.cold+0x11/0x11 ? > > > wait_for_completion_timeout+0x232/0x280 > > > ? drm_crtc_wait_one_vblank+0x40/0x40 [drm] ? > > > bit_wait_io_timeout+0xe0/0xe0 ? > > > wait_for_completion_interruptible+0x1d7/0x320 > > > ? mutex_unlock+0x81/0xd0 > > > amdgpu_vkms_crtc_atomic_disable > > > > > > It's caused by a stuck in lock dependency in such scenario on > > > different CPUs. > > > > > > CPU1 CPU2 > > > drm_crtc_vblank_off hrtimer_interrupt > > > grab event_lock (irq disabled) __hrtimer_run_queues > > > grab vbl_lock/vblank_time_block > > amdgpu_vkms_vblank_simulate > > > amdgpu_vkms_disable_vblank > > > drm_handle_vblank > > > hrtimer_cancel grab > > > dev->event_lock > > > > > > So CPU1 stucks in hrtimer_cancel as timer callback is running > > > endless on current clock base, as that timer queue on CPU2 has no > > > chance to finish it because of failing to hold the lock. So NMI > > > watchdog will throw the errors after its threshold, and all later > > > CPUs are > > impacted/blocked. > > > > > > So use hrtimer_try_to_cancel to fix this, as disable_vblank callback > > > does not need to wait the handler to finish. And also it's not > > > necessary to check the return value of hrtimer_try_to_cancel, > > > because even if it's > > > -1 which means current timer callback is running, it will be > > > reprogrammed in hrtimer_start with calling enable_vblank to make it > works. > > > > > > Cc: sta...@vger.kernel.org > > > Suggested-by: Christian König > > > Signed-off-by: Guchun Chen > > > --- > > > drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c | 2 +- > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c > > > b/drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c > > > index 53ff91fc6cf6..70fb0df039e3 100644 > > > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c > > > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c > > > @@ -81,7 +81,7 @@ static void amdgpu_vkms_disable_vblank(struct > > drm_crtc *crtc) > > > { > > > struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); > > > > > > - hrtimer_cancel(_crtc->vblank_timer); > > > + hrtimer_try_to_cancel(_crtc->vblank_timer); > > > > That's a first step, but not sufficient. > > > > You also need to change the "return HRTIMER_RESTART;" in > > amdgpu_vkms_vblank_simulate() to only re-arm the interrupt when it is > > enabled. > > > > Finally I strongly suggest to implement a amdgpu_vkms_destroy() > > function to make sure the HRTIMER is properly cleaned up. > > Good suggestion, will fix it in V2. > Hi Christian, I just sent out patch v2 to address the return value problem in amdgpu_vkms_vblank_simulate. Regarding HRTIMER cleanup, it's handled in sw_fini in amdgpu_vkms code, I think so far it's good. Anyway, we can continue the discussion in the new patch set thread. Regards, Guchun > Regards, > Guchun > > Regards, > > Christian. > > > > > } > > > > > > static bool amdgpu_vkms_get_vblank_timestamp(struct drm_crtc > > > *crtc,
[PATCH v2] drm/amdgpu/vkms: relax timer deactivation by hrtimer_try_to_cancel
In below thousands of screen rotation loop tests with virtual display enabled, a CPU hard lockup issue may happen, leading system to unresponsive and crash. do { xrandr --output Virtual --rotate inverted xrandr --output Virtual --rotate right xrandr --output Virtual --rotate left xrandr --output Virtual --rotate normal } while (1); NMI watchdog: Watchdog detected hard LOCKUP on cpu 1 ? hrtimer_run_softirq+0x140/0x140 ? store_vblank+0xe0/0xe0 [drm] hrtimer_cancel+0x15/0x30 amdgpu_vkms_disable_vblank+0x15/0x30 [amdgpu] drm_vblank_disable_and_save+0x185/0x1f0 [drm] drm_crtc_vblank_off+0x159/0x4c0 [drm] ? record_print_text.cold+0x11/0x11 ? wait_for_completion_timeout+0x232/0x280 ? drm_crtc_wait_one_vblank+0x40/0x40 [drm] ? bit_wait_io_timeout+0xe0/0xe0 ? wait_for_completion_interruptible+0x1d7/0x320 ? mutex_unlock+0x81/0xd0 amdgpu_vkms_crtc_atomic_disable It's caused by a stuck in lock dependency in such scenario on different CPUs. CPU1 CPU2 drm_crtc_vblank_off hrtimer_interrupt grab event_lock (irq disabled) __hrtimer_run_queues grab vbl_lock/vblank_time_block amdgpu_vkms_vblank_simulate amdgpu_vkms_disable_vblank drm_handle_vblank hrtimer_cancel grab dev->event_lock So CPU1 stucks in hrtimer_cancel as timer callback is running endless on current clock base, as that timer queue on CPU2 has no chance to finish it because of failing to hold the lock. So NMI watchdog will throw the errors after its threshold, and all later CPUs are impacted/blocked. So use hrtimer_try_to_cancel to fix this, as disable_vblank callback does not need to wait the handler to finish. And also it's not necessary to check the return value of hrtimer_try_to_cancel, because even if it's -1 which means current timer callback is running, it will be reprogrammed in hrtimer_start with calling enable_vblank to make it works. v2: only re-arm timer when vblank is enabled (Christian) and add a Fixes tag as well Fixes: 84ec374bd580("drm/amdgpu: create amdgpu_vkms (v4)") Cc: sta...@vger.kernel.org Suggested-by: Christian König Signed-off-by: Guchun Chen --- drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c | 15 --- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c index 53ff91fc6cf6..44d704306f44 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c @@ -46,7 +46,10 @@ static enum hrtimer_restart amdgpu_vkms_vblank_simulate(struct hrtimer *timer) struct amdgpu_crtc *amdgpu_crtc = container_of(timer, struct amdgpu_crtc, vblank_timer); struct drm_crtc *crtc = _crtc->base; struct amdgpu_vkms_output *output = drm_crtc_to_amdgpu_vkms_output(crtc); + struct drm_vblank_crtc *vblank; + struct drm_device *dev; u64 ret_overrun; + unsigned int pipe; bool ret; ret_overrun = hrtimer_forward_now(_crtc->vblank_timer, @@ -54,9 +57,15 @@ static enum hrtimer_restart amdgpu_vkms_vblank_simulate(struct hrtimer *timer) if (ret_overrun != 1) DRM_WARN("%s: vblank timer overrun\n", __func__); + dev = crtc->dev; + pipe = drm_crtc_index(crtc); + vblank = >vblank[pipe]; ret = drm_crtc_handle_vblank(crtc); - if (!ret) - DRM_ERROR("amdgpu_vkms failure on handling vblank"); + if (!ret && !READ_ONCE(vblank->enabled)) { + /* Don't queue timer again when vblank is disabled. */ + DRM_WARN("amdgpu_vkms failure on handling vblank\n"); + return HRTIMER_NORESTART; + } return HRTIMER_RESTART; } @@ -81,7 +90,7 @@ static void amdgpu_vkms_disable_vblank(struct drm_crtc *crtc) { struct amdgpu_crtc *amdgpu_crtc = to_amdgpu_crtc(crtc); - hrtimer_cancel(_crtc->vblank_timer); + hrtimer_try_to_cancel(_crtc->vblank_timer); } static bool amdgpu_vkms_get_vblank_timestamp(struct drm_crtc *crtc, -- 2.25.1