Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync Panthor with drm-tip #392

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
607b039
drm/sched: add optional errno to drm_sched_start()
Aug 26, 2024
91ce4a3
drm/scheduler: Improve documentation
ShuichengLin Sep 17, 2024
169eeae
drm/sched: Optimise drm_sched_entity_push_job
Oct 16, 2024
e0c7452
drm/sched: Stop setting current entity in FIFO mode
Oct 16, 2024
e968d86
drm/sched: Re-group and rename the entity run-queue lock
Oct 16, 2024
e6f746d
drm/sched: Further optimise drm_sched_entity_push_job
Oct 16, 2024
9ee2dde
drm/sched: memset() 'job' in drm_sched_job_init()
Oct 21, 2024
e5a270f
drm/sched: warn about drm_sched_job_init()'s partial init
Oct 23, 2024
e7a3106
drm/sched: Mark scheduler work queues with WQ_MEM_RECLAIM
mbrost05 Oct 23, 2024
30c2217
drm/sched: Document purpose of drm_sched_{start,stop}
Oct 29, 2024
376e715
drm/sched: Improve teardown documentation
Nov 5, 2024
58f01b5
drm/panthor: Use the BITS_PER_LONG macro
Sep 2, 2024
fe0dd89
drm/panthor: Add DEV_QUERY_TIMESTAMP_INFO dev query
marysaka Aug 30, 2024
d62e3c1
drm/panthor: Display FW version information
Sep 6, 2024
2b92227
drm/panthor: Add PANTHOR_GROUP_PRIORITY_REALTIME group priority
marysaka Sep 9, 2024
706f2aa
drm/panthor: Add DEV_QUERY_GROUP_PRIORITIES_INFO dev query
marysaka Sep 9, 2024
805a0f4
drm/panthor: introduce job cycle and timestamp accounting
larunbe Sep 23, 2024
3873f87
drm/panthor: record current and maximum device clock frequencies
larunbe Sep 23, 2024
ee5713d
drm/panthor: add sysfs knob for enabling job profiling
larunbe Sep 23, 2024
b8dca40
drm/panthor: Fix firmware initialization on systems with a page size …
bbrezillon Oct 30, 2024
b2b5706
drm/panthor: Fail job creation when the group is dead
bbrezillon Oct 29, 2024
3966558
drm/panthor: Report group as timedout when we fail to properly suspend
bbrezillon Oct 29, 2024
47aec52
drm/panthor: Fix OPP refcnt leaks in devfreq initialisation
larunbe Nov 5, 2024
84c3902
drm/panthor: Lock XArray when getting entries for the VM
dliviu Nov 6, 2024
9a01611
drm/panthor: Be stricter about IO mapping flags
thejh Nov 4, 2024
3deca9d
drm/panthor: Fix handling of partial GPU mapping of BOs
akagoe01 Nov 11, 2024
b6a0de1
drm/panthor: Update memattr programing to align with GPU spec
akagoe01 Oct 30, 2024
dec9cd7
drm/panthor: Explicitly set the coherency mode
akagoe01 Oct 30, 2024
c3b1a86
drm/panthor: Simplify FW fast reset path
Nov 19, 2024
5560644
drm/panthor: Fix compilation failure on panthor_fw.c
dliviu Nov 19, 2024
1bf8f30
drm/panthor: Fix a typo in the FW iface flag definitions
bbrezillon Nov 13, 2024
80dcd16
drm/panthor: Preserve the result returned by panthor_fw_resume()
bbrezillon Dec 11, 2024
9371254
drm/panthor: Be robust against runtime PM resume failures in the susp…
bbrezillon Dec 11, 2024
dcce596
drm/panthor: Ignore devfreq_{suspend, resume}_device() failures
bbrezillon Dec 11, 2024
c20a32d
drm/panthor: Be robust against resume failures
bbrezillon Dec 11, 2024
9b0ad52
drm/panthor: Fix the fast-reset logic
bbrezillon Dec 11, 2024
2ebad64
drm/panthor: Report innocent group kill
bbrezillon Dec 11, 2024
7f68bba
drm/panthor: Remove dead code
Jan 7, 2025
9df1ba7
drm/panthor: fix all mmu kernel-doc comments
rddunlap Jan 11, 2025
4250372
drm/panthor: Fix a race between the reset and suspend path
bbrezillon Dec 17, 2024
552d918
drm/sched: Fix drm_sched_fini() docu generation
bagasme Dec 17, 2024
e608812
drm/sched: Delete unused update_job_credits
Jan 10, 2025
0fd30e9
drm/sched: Remove weak paused submission checks
Jan 14, 2025
2b0c8de
drm/sched: Add helper to check job dependencies
Jan 13, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions Documentation/ABI/testing/sysfs-driver-panthor-profiling
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
What: /sys/bus/platform/drivers/panthor/.../profiling
Date: September 2024
KernelVersion: 6.11.0
Contact: Adrian Larumbe <adrian.larumbe@collabora.com>
Description:
Bitmask to enable drm fdinfo's job profiling measurements.
Valid values are:
0: Don't enable fdinfo job profiling sources.
1: Enable GPU cycle measurements for running jobs.
2: Enable GPU timestamp sampling for running jobs.
46 changes: 46 additions & 0 deletions Documentation/gpu/panthor.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
.. SPDX-License-Identifier: GPL-2.0+

=========================
drm/Panthor CSF driver
=========================

.. _panfrost-usage-stats:

Panthor DRM client usage stats implementation
==============================================

The drm/Panthor driver implements the DRM client usage stats specification as
documented in :ref:`drm-client-usage-stats`.

Example of the output showing the implemented key value pairs and entirety of
the currently possible format options:

::
pos: 0
flags: 02400002
mnt_id: 29
ino: 491
drm-driver: panthor
drm-client-id: 10
drm-engine-panthor: 111110952750 ns
drm-cycles-panthor: 94439687187
drm-maxfreq-panthor: 1000000000 Hz
drm-curfreq-panthor: 1000000000 Hz
drm-total-memory: 16480 KiB
drm-shared-memory: 0
drm-active-memory: 16200 KiB
drm-resident-memory: 16480 KiB
drm-purgeable-memory: 0

Possible `drm-engine-` key names are: `panthor`.
`drm-curfreq-` values convey the current operating frequency for that engine.

Users must bear in mind that engine and cycle sampling are disabled by default,
because of power saving concerns. `fdinfo` users and benchmark applications which
query the fdinfo file must make sure to toggle the job profiling status of the
driver by writing into the appropriate sysfs node::

echo <N> > /sys/bus/platform/drivers/panthor/[a-f0-9]*.gpu/profiling

Where `N` is a bit mask where cycle and timestamp sampling are respectively
enabled by the first and second bits.
4 changes: 2 additions & 2 deletions drivers/gpu/drm/amd/amdgpu/amdgpu_device.c
Original file line number Diff line number Diff line change
Expand Up @@ -5399,7 +5399,7 @@ int amdgpu_device_gpu_recover(struct amdgpu_device *adev,
if (!tmp_adev->asic_reset_res && !job_signaled)
drm_sched_resubmit_jobs(&ring->sched);

drm_sched_start(&ring->sched);
drm_sched_start(&ring->sched, 0);
}

if (adev->enable_mes && adev->ip_versions[GC_HWIP][0] != IP_VERSION(11, 0, 3))
Expand Down Expand Up @@ -5854,7 +5854,7 @@ void amdgpu_pci_resume(struct pci_dev *pdev)


drm_sched_resubmit_jobs(&ring->sched);
drm_sched_start(&ring->sched);
drm_sched_start(&ring->sched, 0);
}

amdgpu_device_unset_mp1_state(adev);
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpu/drm/etnaviv/etnaviv_sched.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ static enum drm_gpu_sched_stat etnaviv_sched_timedout_job(struct drm_sched_job

drm_sched_resubmit_jobs(&gpu->sched);

drm_sched_start(&gpu->sched);
drm_sched_start(&gpu->sched, 0);
return DRM_GPU_SCHED_STAT_NOMINAL;

out_no_timeout:
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpu/drm/lima/lima_sched.c
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ static enum drm_gpu_sched_stat lima_sched_timedout_job(struct drm_sched_job *job
lima_pm_idle(ldev);

drm_sched_resubmit_jobs(&pipe->base);
drm_sched_start(&pipe->base);
drm_sched_start(&pipe->base, 0);

return DRM_GPU_SCHED_STAT_NOMINAL;
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpu/drm/panfrost/panfrost_job.c
Original file line number Diff line number Diff line change
Expand Up @@ -696,7 +696,7 @@ panfrost_reset(struct panfrost_device *pfdev,

/* Restart the schedulers */
for (i = 0; i < NUM_JOB_SLOTS; i++)
drm_sched_start(&pfdev->js->queue[i].sched);
drm_sched_start(&pfdev->js->queue[i].sched, 0);

/* Re-enable job interrupts now that everything has been restarted. */
job_write(pfdev, JOB_INT_MASK,
Expand Down
41 changes: 28 additions & 13 deletions drivers/gpu/drm/panthor/panthor_devfreq.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,20 @@ static void panthor_devfreq_update_utilization(struct panthor_devfreq *pdevfreq)
static int panthor_devfreq_target(struct device *dev, unsigned long *freq,
u32 flags)
{
struct panthor_device *ptdev = dev_get_drvdata(dev);
struct dev_pm_opp *opp;
int err;

opp = devfreq_recommended_opp(dev, freq, flags);
if (IS_ERR(opp))
return PTR_ERR(opp);
dev_pm_opp_put(opp);

return dev_pm_opp_set_rate(dev, *freq);
err = dev_pm_opp_set_rate(dev, *freq);
if (!err)
ptdev->current_frequency = *freq;

return err;
}

static void panthor_devfreq_reset(struct panthor_devfreq *pdevfreq)
Expand Down Expand Up @@ -130,6 +136,7 @@ int panthor_devfreq_init(struct panthor_device *ptdev)
struct panthor_devfreq *pdevfreq;
struct dev_pm_opp *opp;
unsigned long cur_freq;
unsigned long freq = ULONG_MAX;
int ret;

pdevfreq = drmm_kzalloc(&ptdev->base, sizeof(*ptdev->devfreq), GFP_KERNEL);
Expand All @@ -156,12 +163,6 @@ int panthor_devfreq_init(struct panthor_device *ptdev)

cur_freq = clk_get_rate(ptdev->clks.core);

opp = devfreq_recommended_opp(dev, &cur_freq, 0);
if (IS_ERR(opp))
return PTR_ERR(opp);

panthor_devfreq_profile.initial_freq = cur_freq;

/* Regulator coupling only takes care of synchronizing/balancing voltage
* updates, but the coupled regulator needs to be enabled manually.
*
Expand Down Expand Up @@ -192,16 +193,30 @@ int panthor_devfreq_init(struct panthor_device *ptdev)
return ret;
}

opp = devfreq_recommended_opp(dev, &cur_freq, 0);
if (IS_ERR(opp))
return PTR_ERR(opp);

panthor_devfreq_profile.initial_freq = cur_freq;
ptdev->current_frequency = cur_freq;

/*
* Set the recommend OPP this will enable and configure the regulator
* if any and will avoid a switch off by regulator_late_cleanup()
*/
ret = dev_pm_opp_set_opp(dev, opp);
dev_pm_opp_put(opp);
if (ret) {
DRM_DEV_ERROR(dev, "Couldn't set recommended OPP\n");
return ret;
}

/* Find the fastest defined rate */
opp = dev_pm_opp_find_freq_floor(dev, &freq);
if (IS_ERR(opp))
return PTR_ERR(opp);
ptdev->fast_rate = freq;

dev_pm_opp_put(opp);

/*
Expand All @@ -228,26 +243,26 @@ int panthor_devfreq_init(struct panthor_device *ptdev)
return 0;
}

int panthor_devfreq_resume(struct panthor_device *ptdev)
void panthor_devfreq_resume(struct panthor_device *ptdev)
{
struct panthor_devfreq *pdevfreq = ptdev->devfreq;

if (!pdevfreq->devfreq)
return 0;
return;

panthor_devfreq_reset(pdevfreq);

return devfreq_resume_device(pdevfreq->devfreq);
drm_WARN_ON(&ptdev->base, devfreq_resume_device(pdevfreq->devfreq));
}

int panthor_devfreq_suspend(struct panthor_device *ptdev)
void panthor_devfreq_suspend(struct panthor_device *ptdev)
{
struct panthor_devfreq *pdevfreq = ptdev->devfreq;

if (!pdevfreq->devfreq)
return 0;
return;

return devfreq_suspend_device(pdevfreq->devfreq);
drm_WARN_ON(&ptdev->base, devfreq_suspend_device(pdevfreq->devfreq));
}

void panthor_devfreq_record_busy(struct panthor_device *ptdev)
Expand Down
4 changes: 2 additions & 2 deletions drivers/gpu/drm/panthor/panthor_devfreq.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ struct panthor_devfreq;

int panthor_devfreq_init(struct panthor_device *ptdev);

int panthor_devfreq_resume(struct panthor_device *ptdev);
int panthor_devfreq_suspend(struct panthor_device *ptdev);
void panthor_devfreq_resume(struct panthor_device *ptdev);
void panthor_devfreq_suspend(struct panthor_device *ptdev);

void panthor_devfreq_record_busy(struct panthor_device *ptdev);
void panthor_devfreq_record_idle(struct panthor_device *ptdev);
Expand Down
Loading