drm/panfrost: Add initial panfrost driver
Subsystems (3)
Rob Herring
maintainerRFC PATCH 1/1 drm/panfrost: Add initial panfrost driver
From: "Marty E. Plummer" <[email protected]>
This adds the initial driver for panfrost which supports Arm Mali Midgard and Bifrost family of GPUs. Currently, only the T860 Midgard GPU has been tested.
---
Sending this out in the spirit of release early, release often. We're close to parity compared to mesa + the vendor driver. There's a few issues Tomeu is chasing.
There's still some pieces of the h/w setup we've just hardcoded. Locking in various places is probably missing. Error recovery is non-existent (other than module unload/load). There's some work to add tracepoints and perf counters that's not here yet. Bifrost GPUs are definitely not supported yet other than identifying them. Primarily the MMU setup is missing.
How's performance? Great, because I haven't measured it.
This patch and its dependencies are available here[1]. The mesa support is here[2]. Both are likely to change (daily).
Rob
[1] https://gitlab.freedesktop.org/robh/linux-panfrost.git panfrost-rebase
[2] https://gitlab.freedesktop.org/tomeu/mesa.git mainline-driver
drivers/gpu/drm/Kconfig | 2 + drivers/gpu/drm/Makefile | 1 + drivers/gpu/drm/panfrost/Kconfig | 14 + drivers/gpu/drm/panfrost/Makefile | 11 + drivers/gpu/drm/panfrost/panfrost_device.c | 127 ++++ drivers/gpu/drm/panfrost/panfrost_device.h | 83 +++ drivers/gpu/drm/panfrost/panfrost_drv.c | 419 ++++++++++++ drivers/gpu/drm/panfrost/panfrost_features.h | 308 +++++++++ drivers/gpu/drm/panfrost/panfrost_gem.c | 92 +++ drivers/gpu/drm/panfrost/panfrost_gem.h | 29 + drivers/gpu/drm/panfrost/panfrost_gpu.c | 464 +++++++++++++ drivers/gpu/drm/panfrost/panfrost_gpu.h | 15 + drivers/gpu/drm/panfrost/panfrost_issues.h | 175 +++++ drivers/gpu/drm/panfrost/panfrost_job.c | 662 +++++++++++++++++++ drivers/gpu/drm/panfrost/panfrost_job.h | 47 ++ drivers/gpu/drm/panfrost/panfrost_mmu.c | 409 ++++++++++++ drivers/gpu/drm/panfrost/panfrost_mmu.h | 15 + include/uapi/drm/panfrost_drm.h | 138 ++++ 18 files changed, 3011 insertions(+) create mode 100644 drivers/gpu/drm/panfrost/Kconfig create mode 100644 drivers/gpu/drm/panfrost/Makefile create mode 100644 drivers/gpu/drm/panfrost/panfrost_device.c create mode 100644 drivers/gpu/drm/panfrost/panfrost_device.h create mode 100644 drivers/gpu/drm/panfrost/panfrost_drv.c create mode 100644 drivers/gpu/drm/panfrost/panfrost_features.h create mode 100644 drivers/gpu/drm/panfrost/panfrost_gem.c create mode 100644 drivers/gpu/drm/panfrost/panfrost_gem.h create mode 100644 drivers/gpu/drm/panfrost/panfrost_gpu.c create mode 100644 drivers/gpu/drm/panfrost/panfrost_gpu.h create mode 100644 drivers/gpu/drm/panfrost/panfrost_issues.h create mode 100644 drivers/gpu/drm/panfrost/panfrost_job.c create mode 100644 drivers/gpu/drm/panfrost/panfrost_job.h create mode 100644 drivers/gpu/drm/panfrost/panfrost_mmu.c create mode 100644 drivers/gpu/drm/panfrost/panfrost_mmu.h create mode 100644 include/uapi/drm/panfrost_drm.h
drivers/gpu/drm/Kconfig +2 -0
@@ -335,6 +335,8 @@ source "drivers/gpu/drm/tve200/Kconfig" source "drivers/gpu/drm/xen/Kconfig" +source "drivers/gpu/drm/panfrost/Kconfig" + # Keep legacy drivers last menuconfig DRM_LEGACY
drivers/gpu/drm/Makefile +1 -0
@@ -110,3 +110,4 @@ obj-$(CONFIG_DRM_TINYDRM) += tinydrm/ obj-$(CONFIG_DRM_PL111) += pl111/ obj-$(CONFIG_DRM_TVE200) += tve200/ obj-$(CONFIG_DRM_XEN) += xen/ +obj-$(CONFIG_DRM_PANFROST) += panfrost/
drivers/gpu/drm/panfrost/Kconfig new file +14 -0
@@ -0,0 +1,14 @@ +# SPDX-License-Identifier: GPL-2.0 + +config DRM_PANFROST + tristate "Panfrost (DRM support for ARM Mali Midgard/Bifrost GPUs)" + depends on DRM + depends on ARCH_ROCKCHIP + depends on MMU + select DRM_SCHED + select IOMMU_SUPPORT + select IOMMU_IO_PGTABLE_LPAE + select DRM_GEM_SHMEM_HELPER + help + DRM driver for ARM Mali Midgard (t6xx, t7xx, t8xx) and + Bifrost (G3x, G5x, G7x) GPUs.
drivers/gpu/drm/panfrost/Makefile new file +11 -0
@@ -0,0 +1,11 @@ +# SPDX-License-Identifier: GPL-2.0 + +panfrost-y := \ + panfrost_drv.o \ + panfrost_device.o \ + panfrost_gem.o \ + panfrost_gpu.o \ + panfrost_job.o \ + panfrost_mmu.o + +obj-$(CONFIG_DRM_PANFROST) += panfrost.o
drivers/gpu/drm/panfrost/panfrost_device.c new file +127 -0
127 lines not on this page · raw message
drivers/gpu/drm/panfrost/panfrost_device.h new file +83 -0
83 lines not on this page · raw message
drivers/gpu/drm/panfrost/panfrost_drv.c new file +419 -0
419 lines not on this page · raw message
drivers/gpu/drm/panfrost/panfrost_features.h new file +308 -0
308 lines not on this page · raw message
drivers/gpu/drm/panfrost/panfrost_gem.c new file +92 -0
92 lines not on this page · raw message
drivers/gpu/drm/panfrost/panfrost_gem.h new file +29 -0
@@ -0,0 +1,29 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* Copyright 2019 Linaro, Ltd, Rob Herring <[email protected]> */ + +#ifndef __PANFROST_GEM_H__ +#define __PANFROST_GEM_H__ + +#include <drm/drm_gem_shmem_helper.h> +#include <drm/drm_mm.h> + +struct panfrost_gem_object { +struct drm_gem_shmem_object base; + +struct drm_mm_node node; +}; + +static inline +struct panfrost_gem_object *to_panfrost_bo (struct drm_gem_object *obj) +{ + return container_of(to_drm_gem_shmem_obj(obj), struct panfrost_gem_object, base); +} + +struct drm_gem_object *panfrost_gem_create_object (struct drm_device *dev,size_t size); + +struct drm_gem_object * +panfrost_gem_prime_import_sg_table (struct drm_device *dev, +struct dma_buf_attachment *attach, +struct sg_table *sgt); + +#endif /* __PANFROST_GEM_H__ */
drivers/gpu/drm/panfrost/panfrost_gpu.c new file +464 -0
464 lines not on this page · raw message
drivers/gpu/drm/panfrost/panfrost_gpu.h new file +15 -0
@@ -0,0 +1,15 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* Copyright 2018 Marty E. Plummer <[email protected]> */ +/* Copyright 2019 Collabora ltd. */ + +#ifndef __PANFROST_GPU_H__ +#define __PANFROST_GPU_H__ + +struct panfrost_device ; + +int panfrost_gpu_init (struct panfrost_device *pfdev); +void panfrost_gpu_fini (struct panfrost_device *pfdev); + +u32 panfrost_gpu_get_latest_flush_id (struct panfrost_device *pfdev); + +#endif
drivers/gpu/drm/panfrost/panfrost_issues.h new file +175 -0
175 lines not on this page · raw message
drivers/gpu/drm/panfrost/panfrost_job.c new file +662 -0
662 lines not on this page · raw message
drivers/gpu/drm/panfrost/panfrost_job.h new file +47 -0
47 lines not on this page · raw message
drivers/gpu/drm/panfrost/panfrost_mmu.c new file +409 -0
409 lines not on this page · raw message
drivers/gpu/drm/panfrost/panfrost_mmu.h new file +15 -0
@@ -0,0 +1,15 @@ +// SPDX-License-Identifier: GPL-2.0 +/* Copyright 2019 Linaro, Ltd, Rob Herring <[email protected]> */ + +#ifndef __PANFROST_MMU_H__ +#define __PANFROST_MMU_H__ + +struct panfrost_gem_object ; + +int panfrost_mmu_map (struct panfrost_gem_object *bo); +void panfrost_mmu_unmap (struct panfrost_gem_object *bo); + +int panfrost_mmu_init (struct panfrost_device *pfdev); +void panfrost_mmu_fini (struct panfrost_device *pfdev); + +#endif
include/uapi/drm/panfrost_drm.h new file +138 -0
118 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 6 lines
2.19.1 _______________________________________________ dri-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/dri-devel
Part of the diff is not shown here. View the raw message.
Dave Airlie
maintainer +struct drm_panfrost_submit {
Quoted 10 lines
include/uapi/drm/panfrost_drm.h new file +10
-0+ +/** Address to GPU mapping of job descriptor */ +__u64 jc; + +/** An optional sync object to wait on before starting this job. */ +__u32 in_sync; + +/** An optional sync object to place the completion fence in. */ +__u32 out_sync; +
include/uapi/drm/panfrost_drm.h line 57
Quoted 10 lines
include/uapi/drm/panfrost_drm.h new file +10
-0+/** Pointer to a u32 array of the BOs that are referenced by the job. */ +__u64 bo_handles; + +/** Number of BO handles passed in (size is that times 4). */ +__u32 bo_handle_count; + +/** A combination of PANFROST_JD_REQ_* */ +__u32 requirements; +}; +
I really think to write a decent vulkan driver, you need to take arrays of in sync,
Look at the amdgpu chunk API.
Dave.
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 2 lines
I really think to write a decent vulkan driver, you need to take arrays of in sync,
Vulkan? What's that? ;)
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Oh my onions, it's really here! It's really coming! It's really here!
----
drivers/gpu/drm/panfrost/Kconfig line 14
Quoted 2 lines
drivers/gpu/drm/panfrost/Kconfig new file +2
-0+ DRM driver for ARM Mali Midgard (t6xx, t7xx, t8xx) and + Bifrost (G3x, G5x, G7x) GPUs.
Nitpick: the model names should maybe be capitalized? Or at least, the T/G should be consistent? I'm not sure what the vendor marketing names are exactly.
drivers/gpu/drm/panfrost/panfrost_device.h line 43
Quoted 2 lines
drivers/gpu/drm/panfrost/panfrost_device.h new file +2
-0+unsigned long base_hw_features[64 /BITS_PER_LONG ]; +unsigned long hw_issues[64 /BITS_PER_LONG ];
This is confusing...? Is the idea to always have u64, regardless of 32/64-bitness? If so, why not just u64? I'm not totally sure why these aren't just bitmasks, if we are capping to 64 for each. On the other hand, there are a lot more than issues exposed by the kbase, though the vast majority don't apply to kernel space (and should be sorted as a purely userspace affair)..?
Also, nitpick: s/base_hw_features/hw_features/g, for consistency and not inheriting naming cruft.
drivers/gpu/drm/panfrost/panfrost_device.h line 63
Quoted 1 line
drivers/gpu/drm/panfrost/panfrost_device.h new file +1
-0+struct panfrost_job *jobs[3 ];
3 is a bit of a magic number, it feels like. I'm guessing this corresponds to job slots JS0/JS1/JS2? If so, I guess just add a quick comment about that, since otherwise it feels a little random.
(Maybe I'm biased because struct panfrost_job means something totally different in userspace for me...)
Quoted 4 lines
+/*
DRM_AUTHis required on SUBMIT for now, while all clients share a single
+ * address space. Note that render nodes would be able to submit jobs that
+ * could access BOs from clients authenticated with the master node.
+ */
This concerns me. Per-process address spaces (configured natively in the MMU) is essential from both security and stability standpoints. (It's possible I'm misunderstanding what DRM_AUTH means in this context; this is more responding to "share a single address space").
drivers/gpu/drm/panfrost/panfrost_drv.c line 349
Quoted 1 line
drivers/gpu/drm/panfrost/panfrost_drv.c new file +1
-0+drm_mm_init (&pfdev->mm,0 ,SZ_4G );// 4G enough for now. can be 48-bit
What's the rationale for picking 4G (when the virtual address space is 64-bit, physical is 48-bit)? Easier portability to 32-bit for simplicity, or something else?
drivers/gpu/drm/panfrost/panfrost_drv.c line 389
Quoted 5 lines
drivers/gpu/drm/panfrost/panfrost_drv.c new file +5
-0+static const struct of_device_id dt_match[] = { + { .compatible ="arm,mali-t760" }, + { .compatible ="arm,mali-t860" }, + {} +};
Do we want to add compatibles for the rest of the Mali's on the initial merge, or wait until they're actually confirmed working so we don't load and cause problems on untested hardware?
Quoted 1 line
+enum
base_hw_feature{
...
Review
Quoted 1 line
(quoted diff) +1
-0+ HW_FEATURE_PROTECTED_MODE
...
Quoted 1 line
+};
1) I know these names are inherited from kbase, but might we prefer panfrost-prefixed names for consistency?
2) I recall discussing this a bit over IRC, but most of these properties are of more use to userspace than kernelspace. Does it make sense to keep the feature list here rather than just in Mesa, bearing in mind Mesa upgrades are easier than kernel upgrades? (I think you may have been the one to bring up this fact, but hoping it doesn't get lost over IRC).
3) On a matter of principle, I don't like wasting a bit on Digital Rainbow Management (especially when it's not something we're realistically going to implement for numerous reasons...)
drivers/gpu/drm/panfrost/panfrost_drv.c line 4
Quoted 6 lines
+++
b/drivers/gpu/drm/panfrost/panfrost_gpu.cdrivers/gpu/drm/panfrost/panfrost_drv.c new file +4
-0@@ -0,0 +1,464 @@ +// SPDX-License-Identifier: GPL-2.0 +/* Copyright 2018 Marty E. Plummer <[email protected]> */ +/* Copyright 2019 Linaro, Ltd., Rob Herring <[email protected]> */ +/* Copyright 2019 Collabora ltd. */
Given the register definitions are here (including the comments from kbase -- if we strip those, it might be a different story), it might be safer to add a vendor copyright here too.
Alternatively, maybe the registers should be in their own file anyway. I know they were explicitly moved inward earlier, but conceptually I don't see why that's preferable to a centralized panfrost_regs.h file? Copyright/origin is more transparent that way too.
drivers/gpu/drm/panfrost/panfrost_gpu.c line 235
Quoted 1 line
drivers/gpu/drm/panfrost/panfrost_gpu.c new file +1
-0+for (timeout =500 ; timeout >0 ; timeout--) {
500 seems a little arbitrary...?
drivers/gpu/drm/panfrost/panfrost_gpu.c line 258
Quoted 2 lines
drivers/gpu/drm/panfrost/panfrost_gpu.c new file +2
-0+// Need more version detection +if (pfdev->features.id ==0x0860 ) {
Seconded, you have the GPU_MODELs just below...?
drivers/gpu/drm/panfrost/panfrost_gpu.c line 392
Quoted 7 lines
drivers/gpu/drm/panfrost/panfrost_gpu.c new file +7
-0+for (i =0 ; i <MAX_HW_REVS ; i++) { +if ((model->revs[i].revision != rev) && + (model->revs[i].revision != (rev & ~0xf ))) +continue ; + hw_issues |= model->revs[i].issues; +break ; + }
Nitpick: The control flow logic seems a little overcomplicated here.
drivers/gpu/drm/panfrost/panfrost_gpu.c line 446
Quoted 1 line
drivers/gpu/drm/panfrost/panfrost_gpu.c new file +1
-0+msleep (10 );
What kind of race condition are we working around here? ;)
drivers/gpu/drm/panfrost/panfrost_gpu.c line 457
Quoted 4 lines
drivers/gpu/drm/panfrost/panfrost_gpu.c new file +4
-0+void panfrost_gpu_fini (struct panfrost_device *pfdev) +{ + +}
Anything that has to happen here? If no, add a comment in the body saying that. If yes, well, that (or at least /* stub */)...
drivers/gpu/drm/panfrost/panfrost_issues.h line 16
Quoted 6 lines
drivers/gpu/drm/panfrost/panfrost_issues.h new file +6
-0+/* +* This is not a complete list of issues, but only the ones the driver needs +* to care about. +*/ +enum base_hw_issue { +HW_ISSUE_6367 ,
Similar nitpicks as with the feature list. I will say, this is _incredibly opaque_. I realize the vendor driver is _intentionally_ opaque here, but that doesn't make this any easier to follow ;)
The good news is that older vendor driver releases (for T760 and earlier?) had comments documenting what all the errata were, so the vast majority of these we do have documentation on. Plus, if these are just the issues the _kernel_ driver cares about, we have documentation for that given the has_issue calls across kbase. Regardless, something more transparent than an uncommented number might be nice.
drivers/gpu/drm/panfrost/panfrost_issues.h line 44
Quoted 1 line
drivers/gpu/drm/panfrost/panfrost_issues.h new file +1
-0+ GPUCORE_1619,
What's a GPUCORE and what was kbase thinking...? ;)
drivers/gpu/drm/panfrost/panfrost_issues.h line 175
Quoted 1 line
drivers/gpu/drm/panfrost/panfrost_issues.h new file +1
-0+#endif /* _HWCONFIG_ISSUES_H_ */
s/_HWCONFIG_ISSUES_H/__PANFROST_ISSUES_H_/
drivers/gpu/drm/panfrost/panfrost_job.c line 3
Quoted 3 lines
drivers/gpu/drm/panfrost/panfrost_job.c new file +3
-0+// SPDX-License-Identifier: GPL-2.0 +/* Copyright 2019 Linaro, Ltd, Rob Herring <[email protected]> */ +/* Copyright 2019 Collabora ltd. */
See register concerns again.
drivers/gpu/drm/panfrost/panfrost_job.c line 148
Quoted 1 line
drivers/gpu/drm/panfrost/panfrost_job.c new file +1
-0+static int panfrost_job_get_slot (struct panfrost_job *job)
It might help to have a quick comment explaining what JS0/JS1/JS2 are to refresh the reader's (and eventually your) memory. Just a simple, you know:
/* JS0: fragment jobs.
* JS1: vertex/tiler jobs
* JS2: compute jobs
*/
drivers/gpu/drm/panfrost/panfrost_job.c line 154
Quoted 2 lines
drivers/gpu/drm/panfrost/panfrost_job.c new file +2
-0+#if 0 +// Ignore compute for now
Maybe don't ignore compute if it's just this little routine? :)
drivers/gpu/drm/panfrost/panfrost_job.c line 160
Quoted 2 lines
drivers/gpu/drm/panfrost/panfrost_job.c new file +2
-0+if (kbase_hw_has_issue (kbdev,BASE_HW_ISSUE_8987 )) +return 2 ;
It looks like 8987 only applies to the very earliest dev models (based on the issues list) so we shouldn't need to worry about this. t600_r0p0_15dev0 can probably be safely ignored entirely (and deleted from the issues/features/models list, frankly). I doubt that model is even publicly available...
drivers/gpu/drm/panfrost/panfrost_job.c line 166
Quoted 1 line
drivers/gpu/drm/panfrost/panfrost_job.c new file +1
-0+static void panfrost_job_write_affinity(struct panfrost_device *pfdev,
What's affinity? :)
drivers/gpu/drm/panfrost/panfrost_job.c line 219
Quoted 1 line
drivers/gpu/drm/panfrost/panfrost_job.c new file +1
-0+udelay (100 );
(Arbitrary?)
drivers/gpu/drm/panfrost/panfrost_job.c line 244
Quoted 3 lines
drivers/gpu/drm/panfrost/panfrost_job.c new file +3
-0+#if 0 +if (kbase_hw_has_issue (kbdev,BASE_HW_ISSUE_10649 )) + cfg |=JS_CONFIG_START_MMU ;
This issue seems to apply to a lot of GPUs we *do* care about; better handle this.
Quoted 4 lines
drivers/gpu/drm/panfrost/panfrost_job.c new file +4
-0+ +if (panfrost_has_hw_feature (kbdev, +BASE_HW_FEATURE_JOBCHAIN_DISAMBIGUATION )) { +if (!kbdev->hwaccess.backend.slot_rb[js].job_chain_flag) {
drivers/gpu/drm/panfrost/panfrost_job.c line 258
Quoted 10 lines
drivers/gpu/drm/panfrost/panfrost_job.c new file +10
-0+ cfg |=JS_CONFIG_JOB_CHAIN_FLAG ; + katom->atom_flags |=KBASE_KATOM_FLAGS_JOBCHAIN ; + kbdev->hwaccess.backend.slot_rb[js].job_chain_flag = + true; + }else { + katom->atom_flags &= ~KBASE_KATOM_FLAGS_JOBCHAIN ; + kbdev->hwaccess.backend.slot_rb[js].job_chain_flag = + false; + } + }
What does this code do / why is it if 0'd?
drivers/gpu/drm/panfrost/panfrost_job.c line 366
Quoted 3 lines
drivers/gpu/drm/panfrost/panfrost_job.c new file +3
-0+for (i =0 ; i < bo_count; i++) +/* XXX: Use shared fences for read-only objects. */ +reservation_object_add_excl_fence (bos[i]->resv, fence);
I might be paranoid, but 2 lines means braces :)
drivers/gpu/drm/panfrost/panfrost_job.c line 423
Quoted 5 lines
drivers/gpu/drm/panfrost/panfrost_job.c new file +5
-0+for (i =0 ; i < job->bo_count; i++) +drm_gem_object_put_unlocked (job->bos[i]); +kvfree (job->bos); + +kfree (job);
Nitpick: move the blank space up a line.
drivers/gpu/drm/panfrost/panfrost_job.c line 495
Quoted 1 line
drivers/gpu/drm/panfrost/panfrost_job.c new file +1
-0+if (job_read (pfdev,JS_STATUS (js)) ==8 ) {
What does 8 mean?
drivers/gpu/drm/panfrost/panfrost_job.c line 502
Quoted 7 lines
drivers/gpu/drm/panfrost/panfrost_job.c new file +7
-0+// dev_err(pfdev->dev, "reseting gpu"); +// panfrost_gpu_reset(pfdev); + } + +/* For now, just say we're done. No reset and retry. */ +// job_write(pfdev, JS_COMMAND(js), JS_COMMAND_HARD_STOP); +dma_fence_signal (job->done_fence);
That's probably reasonable, at least for now. If our job faults we have bigger issues / retrying is probably futile. That said, if we're not resetting is there a risk of lock-ups?
drivers/gpu/drm/panfrost/panfrost_job.c line 522
Quoted 2 lines
drivers/gpu/drm/panfrost/panfrost_job.c new file +2
-0+/* Non-Fault Status code */ +/* Job exceptions */
I think the "FAULT" suffix implies that loudly enough :)
drivers/gpu/drm/panfrost/panfrost_job.c line 607
Quoted 2 lines
drivers/gpu/drm/panfrost/panfrost_job.c new file +2
-0+job_write (pfdev,JOB_INT_CLEAR ,0x70007 ); +job_write (pfdev,JOB_INT_MASK ,0x70007 );
Meaning of the magic numbers...?
drivers/gpu/drm/panfrost/panfrost_job.h line 10
Quoted 1 line
drivers/gpu/drm/panfrost/panfrost_job.h new file +1
-0+#define NUM_JOB_SLOTS 2/* Don't need 3rd one until we have compute support */
Sure, but there _are_ 3 slots in the hardware; there's no need to lie about that even if we don't presently schedule anything there?
Review line 77
Quoted 2 lines
(quoted diff) +2
-0+// SPDX-License-Identifier: GPL-2.0 +/* Copyright 2019 Linaro, Ltd, Rob Herring <[email protected]> */
(Likewise, register copyright).
drivers/gpu/drm/panfrost/panfrost_mmu.c line 167
Quoted 2 lines
drivers/gpu/drm/panfrost/panfrost_mmu.c new file +2
-0+// if (kbdev->system_coherency == COHERENCY_ACE) +// current_setup->transtab |= AS_TRANSTAB_LPAE_SHARE_OUTER;
Bwap?
drivers/gpu/drm/panfrost/panfrost_mmu.c line 253
Quoted 2 lines
drivers/gpu/drm/panfrost/panfrost_mmu.c new file +2
-0+//struct panfrost_device *pfdev = cookie; +// Wait 1000 GPU cycles!?
?!
drivers/gpu/drm/panfrost/panfrost_mmu.c line 290
Quoted 4 lines
drivers/gpu/drm/panfrost/panfrost_mmu.c new file +4
-0+if (panfrost_has_hw_feature (pfdev,HW_FEATURE_AARCH64_MMU )) +return "ATOMIC" ; +else +return "UNKNOWN" ;
Does it really make sense to check for the feature to determine the name...? I mean, that code path should be unreachable, but still (at least without the check the code is slightly neater..)
drivers/gpu/drm/panfrost/panfrost_mmu.c line 327
Quoted 3 lines
drivers/gpu/drm/panfrost/panfrost_mmu.c new file +3
-0+ fault_status =mmu_read (pfdev,AS_FAULTSTATUS (i)); + addr =mmu_read (pfdev,AS_FAULTADDRESS_LO (i)); + addr |= (u64 )mmu_read (pfdev,AS_FAULTADDRESS_HI (i)) <<32 ;
I don't know if it's necessary for the initial merge, but maybe at least put a TODO comment in here that growable memory (lazy allocations) will be implemented here in the future...?
drivers/gpu/drm/panfrost/panfrost_mmu.c line 409
Quoted 4 lines
drivers/gpu/drm/panfrost/panfrost_mmu.c new file +4
-0+void panfrost_mmu_fini (struct panfrost_device *pfdev) +{ + +}
Empty?
----------------------------
Overall, I'm super happy to see this! Nice work, guys! ^_^
-Alyssa
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 4 lines · Alyssa Rosenzweig
Oh my onions, it's really here! It's really coming! It's really here!
----
<snip>
Quoted 10 lines
drivers/gpu/drm/panfrost/panfrost_drv.c line 389
Quoted 6 lines
drivers/gpu/drm/panfrost/panfrost_drv.c new file +5
-0+static const struct of_device_id dt_match[] = { + { .compatible ="arm,mali-t760" }, + { .compatible ="arm,mali-t860" }, + {} +};Do we want to add compatibles for the rest of the Mali's on the initial merge, or wait until they're actually confirmed working so we don't load and cause problems on untested hardware?
We should definitely stick to the midgard bindings here and add all the compatibles even if we haven't tested yet, maybe by adding a warning mechanism reporting when used on an untested mali core ?
BTW rob, I resent the bifrost binding doc with an unique, "arm,mali-bifrost" compatible, adding it would help starting debugging bifrost aswell !
Quoted 6 lines
Quoted 2 lines
+enum
base_hw_feature{...Review
Quoted 1 line
(quoted diff) +1
-0+ HW_FEATURE_PROTECTED_MODE...Quoted 1 line
+};
<snip>
Quoted 4 lines
----------------------------
Overall, I'm super happy to see this! Nice work, guys! ^_^
Yeah pretty cool work !
I'll run it on a T820 ASAP and push fixes on the gitlab repo.
Neil
Quoted 7 lines
-Alyssa
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 18 lines · Rob Herring
From: "Marty E. Plummer" <[email protected]>
This adds the initial driver for panfrost which supports Arm Mali Midgard and Bifrost family of GPUs. Currently, only the T860 Midgard GPU has been tested.
Cc Maarten Lankhorst <[email protected]>Cc Maxime Ripard <[email protected]>Cc Sean Paul <[email protected]>Cc David Airlie <[email protected]>Cc Daniel Vetter <[email protected]>Cc Alyssa Rosenzweig <[email protected]>Cc Lyude Paul <[email protected]>Cc Eric Anholt <[email protected]>Signed-off-by Marty E. Plummer <[email protected]>Signed-off-by Tomeu Vizoso <[email protected]>Signed-off-by Rob Herring <[email protected]>---
<snip>
Quoted 15 lines
drivers/gpu/drm/panfrost/panfrost_gpu.c new file +15
-0+ +static const struct panfrost_model gpu_models[] = { +/* T60x has an oddball version */ +GPU_MODEL (t600,0x6956 ,0xffff , +GPU_REV_EXT (t600,0 ,0 ,1 , _15dev0)), +GPU_MODEL_MIDGARD (t620,0x620 , +GPU_REV (t620,0 ,1 ),GPU_REV (t620,1 ,0 )), +GPU_MODEL_MIDGARD (t720,0x720 ), +GPU_MODEL_MIDGARD (t760,0x750 , +GPU_REV (t760,0 ,0 ),GPU_REV (t760,0 ,1 ), +GPU_REV_EXT (t760,0 ,1 ,0 , _50rel0), +GPU_REV (t760,0 ,2 ),GPU_REV (t760,0 ,3 )), +GPU_MODEL_MIDGARD (t820,0x820 ), +GPU_MODEL_MIDGARD (t830,0x830 ), +GPU_MODEL_MIDGARD (t860,0x860 ),
drivers/gpu/drm/panfrost/panfrost_gpu.c line 327
Quoted 10 lines
drivers/gpu/drm/panfrost/panfrost_gpu.c new file +10
-0+GPU_MODEL_MIDGARD (t880,0x880 ), + +GPU_MODEL_BIFROST (g71,0x6000 , +GPU_REV_EXT (g71,0 ,0 ,1 , _05dev0)), +GPU_MODEL_BIFROST (g72,0x6001 ), +GPU_MODEL_BIFROST (g51,0x7000 ), +GPU_MODEL_BIFROST (g76,0x7001 ), +GPU_MODEL_BIFROST (g52,0x7002 ), +GPU_MODEL_BIFROST (g31,0x7003 , + GPU_REV(g31, 1, 0)),
G31 r0p0 should be supported, the Amlogic G12A has it :
[ 98.036507] mali ffe40000.gpu: GPU identified as 0x3 arch 7.0.9 r0p0 status 0
as reported by mali_kbase.
Neil
Quoted 10 lines
drivers/gpu/drm/panfrost/panfrost_gpu.c new file +10
-0+}; + +static void panfrost_gpu_init_features (struct panfrost_device *pfdev) +{ +u32 gpu_id, num_js, major, minor, status, rev; +const char *name ="unknown" ; +u64 hw_feat =0 ; +u64 hw_issues = hw_issues_all; +const struct panfrost_model *model; +int i;
<snip>
include/uapi/drm/panfrost_drm.h line 138
Quoted 4 lines
include/uapi/drm/panfrost_drm.h new file +3
-0+#endif + +#endif /* _PANFROST_DRM_H_ */
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Rob Herring
maintainerQuoted 12 lines · Alyssa Rosenzweig
Oh my onions, it's really here! It's really coming! It's really here!
----
drivers/gpu/drm/panfrost/Kconfig line 14
Quoted 2 lines
drivers/gpu/drm/panfrost/Kconfig new file +2
-0+ DRM driver for ARM Mali Midgard (t6xx, t7xx, t8xx) and + Bifrost (G3x, G5x, G7x) GPUs.Nitpick: the model names should maybe be capitalized? Or at least, the T/G should be consistent? I'm not sure what the vendor marketing names are exactly.
Quoted 6 lines
drivers/gpu/drm/panfrost/panfrost_device.h line 43
Quoted 2 lines
drivers/gpu/drm/panfrost/panfrost_device.h new file +2
-0+unsigned long base_hw_features[64 /BITS_PER_LONG ]; +unsigned long hw_issues[64 /BITS_PER_LONG ];This is confusing...? Is the idea to always have u64, regardless of 32/64-bitness? If so, why not just u64? I'm not totally sure why these aren't just bitmasks, if we are capping to 64 for each.
bitmasks in the kernel use unsigned long arrays. A strange choice which I guess was either because it predated 64-bit or enables atomic ops which tend to be on the native size. So this just fixes the size to 64-bits for 32 and 64 bit systems.
Quoted 4 lines
On the other
hand, there are a lot more than issues exposed by the kbase, though the vast majority don't apply to kernel space (and should be sorted as a purely userspace affair)..?
Issues I trimmed down to only the kernel ones. Features were small enough, I just left them all.
Quoted 2 lines
Also, nitpick: s/base_hw_features/hw_features/g, for consistency and not inheriting naming cruft.
+1
Quoted 5 lines
Quoted 1 line
+ struct
panfrost_job*jobs[3];3 is a bit of a magic number, it feels like. I'm guessing this corresponds to job slots JS0/JS1/JS2? If so, I guess just add a quick comment about that, since otherwise it feels a little random.
Job slots, yes. I think I have a define somewhere already I'll use.
Quoted 8 lines
(Maybe I'm biased because
struct panfrost_jobmeans something totally different in userspace for me...)Quoted 4 lines
+/*
DRM_AUTHis required on SUBMIT for now, while all clients share a single
+ * address space. Note that render nodes would be able to submit jobs that
+ * could access BOs from clients authenticated with the master node.
+ */
Quoted 4 lines
This concerns me. Per-process address spaces (configured natively in the MMU) is essential from both security and stability standpoints. (It's possible I'm misunderstanding what
DRM_AUTHmeans in this context; this is more responding to "share a single address space").
We'll get there. I'll just point out that freedreno is also a single address space (though there are patches for that now).
Quoted 5 lines
Quoted 1 line
+
drm_mm_init(&pfdev->mm, 0, SZ_4G); // 4G enough for now. can be 48-bitWhat's the rationale for picking 4G (when the virtual address space is 64-bit, physical is 48-bit)? Easier portability to 32-bit for simplicity, or something else?
Systems simply don't have enough RAM that you'd want to use 4G for graphics memory.
That reminds me, I want to not start at 0 to catch NULL addresses.
Quoted 9 lines
drivers/gpu/drm/panfrost/panfrost_drv.c line 389
Quoted 5 lines
drivers/gpu/drm/panfrost/panfrost_drv.c new file +5
-0+static const struct of_device_id dt_match[] = { + { .compatible ="arm,mali-t760" }, + { .compatible ="arm,mali-t860" }, + {} +};Do we want to add compatibles for the rest of the Mali's on the initial merge, or wait until they're actually confirmed working so we don't load and cause problems on untested hardware?
I'd say wait. I also suggested on the bifrost bindings that we do a more generic fallback as the h/w is pretty much discoverable for model, version and features.
Quoted 8 lines
Quoted 1 line
+enum
base_hw_feature{...Quoted 1 line
+
HW_FEATURE_PROTECTED_MODE...Quoted 1 line
+};
1) I know these names are inherited from kbase, but might we prefer panfrost-prefixed names for consistency?
They aren't exposed outside of the driver, so namespacing them is a bit pointless and just makes the names too long. I will at least rename base_hw_feature.
Quoted 6 lines
2) I recall discussing this a bit over IRC, but most of these properties are of more use to userspace than kernelspace. Does it make sense to keep the feature list here rather than just in Mesa, bearing in mind Mesa upgrades are easier than kernel upgrades? (I think you may have been the one to bring up this fact, but hoping it doesn't get lost over IRC).
Unlike the issues list, it was small enough I didn't really think about it here.
Quoted 3 lines
3) On a matter of principle, I don't like wasting a bit on Digital Rainbow Management (especially when it's not something we're realistically going to implement for numerous reasons...)
If this is ever going to be used in commercial products, it will need to be supported whether in tree or out. We can leave that for another day.
Quoted 12 lines
drivers/gpu/drm/panfrost/panfrost_drv.c line 4
Quoted 7 lines
+++
b/drivers/gpu/drm/panfrost/panfrost_gpu.cdrivers/gpu/drm/panfrost/panfrost_drv.c new file +4
-0@@ -0,0 +1,464 @@ +// SPDX-License-Identifier: GPL-2.0 +/* Copyright 2018 Marty E. Plummer <[email protected]> */ +/* Copyright 2019 Linaro, Ltd., Rob Herring <[email protected]> */ +/* Copyright 2019 Collabora ltd. */ Given the register definitions are here (including the comments from kbase -- if we strip those, it might be a different story), it might be safer to add a vendor copyright here too.
Quoted 3 lines
Alternatively, maybe the registers should be in their own file anyway. I know they were explicitly moved inward earlier, but conceptually I don't see why that's preferable to a centralized
panfrost_regs.hfile?
Primarily to enforce good hygiene to only access a sub-block's registers within its .c file.
Quoted 1 line
Copyright/origin is more transparent that way too.
Good point. Otherwise, I can say "Register definitions from ..., Copyright ARM..."
Quoted 4 lines
drivers/gpu/drm/panfrost/panfrost_gpu.c line 235
Quoted 2 lines
drivers/gpu/drm/panfrost/panfrost_gpu.c new file +1
-0+for (timeout =500 ; timeout >0 ; timeout--) {500 seems a little arbitrary...?
We should should have a udelay in here at least to get a known time rather than how much the compiler optimizes. Though the timeout would still be arbitrary.
Quoted 5 lines
drivers/gpu/drm/panfrost/panfrost_gpu.c line 258
Quoted 3 lines
drivers/gpu/drm/panfrost/panfrost_gpu.c new file +2
-0+// Need more version detection +if (pfdev->features.id ==0x0860 ) {Seconded, you have the
GPU_MODELsjust below...?
This means I just stuffed in fixed values to these registers. The kbase driver uses hw_issues and such to determine the setup.
Quoted 9 lines
drivers/gpu/drm/panfrost/panfrost_gpu.c line 392
Quoted 8 lines
drivers/gpu/drm/panfrost/panfrost_gpu.c new file +7
-0+for (i =0 ; i <MAX_HW_REVS ; i++) { +if ((model->revs[i].revision != rev) && + (model->revs[i].revision != (rev & ~0xf ))) +continue ; + hw_issues |= model->revs[i].issues; +break ; + }
Quoted 5 lines
Nitpick: The control flow logic seems a little overcomplicated here.
drivers/gpu/drm/panfrost/panfrost_gpu.c line 446
Quoted 1 line
drivers/gpu/drm/panfrost/panfrost_gpu.c new file +1
-0+msleep (10 );What kind of race condition are we working around here? ;)
Hard to say with the context deleted...
As powering on h/w takes time, a delay seemed appropriate. i think I can check some status bits though.
Quoted 20 lines
drivers/gpu/drm/panfrost/panfrost_gpu.c line 457
Quoted 5 lines
drivers/gpu/drm/panfrost/panfrost_gpu.c new file +4
-0+void panfrost_gpu_fini (struct panfrost_device *pfdev) +{ + +}Anything that has to happen here? If no, add a comment in the body saying that. If yes, well, that (or at least /* stub */)...
drivers/gpu/drm/panfrost/panfrost_issues.h line 16
Quoted 6 lines
drivers/gpu/drm/panfrost/panfrost_issues.h new file +6
-0+/* +* This is not a complete list of issues, but only the ones the driver needs +* to care about. +*/ +enum base_hw_issue { +HW_ISSUE_6367 ,Similar nitpicks as with the feature list. I will say, this is
_incrediblyopaque_. I realize the vendor driver is _intentionally_ opaque here, but that doesn't make this any easier to follow ;)
Quoted 6 lines
The good news is that older vendor driver releases (for T760 and earlier?) had comments documenting what all the errata were, so the vast majority of these we do have documentation on. Plus, if these are just the issues the _kernel_ driver cares about, we have documentation for that given the
has_issuecalls across kbase. Regardless, something more transparent than an uncommented number might be nice.
It's not always clear looking at the kbase driver. Often it's just if some issue, set or don't set some other bit.
IMO, if someone wants to improve the documentation here, that can come later.
Quoted 4 lines
drivers/gpu/drm/panfrost/panfrost_issues.h line 44
Quoted 2 lines
drivers/gpu/drm/panfrost/panfrost_issues.h new file +1
-0+ GPUCORE_1619,What's a GPUCORE and what was kbase thinking...? ;)
No idea other than it is only for T604 and s/w models.
Quoted 27 lines
drivers/gpu/drm/panfrost/panfrost_issues.h line 175
Quoted 2 lines
drivers/gpu/drm/panfrost/panfrost_issues.h new file +1
-0+#endif /* _HWCONFIG_ISSUES_H_ */ s/_HWCONFIG_ISSUES_H/__PANFROST_ISSUES_H_/
drivers/gpu/drm/panfrost/panfrost_job.c line 3
Quoted 3 lines
drivers/gpu/drm/panfrost/panfrost_job.c new file +3
-0+// SPDX-License-Identifier: GPL-2.0 +/* Copyright 2019 Linaro, Ltd, Rob Herring <[email protected]> */ +/* Copyright 2019 Collabora ltd. */ See register concerns again.
drivers/gpu/drm/panfrost/panfrost_job.c line 148
Quoted 1 line
drivers/gpu/drm/panfrost/panfrost_job.c new file +1
-0+static int panfrost_job_get_slot (struct panfrost_job *job)It might help to have a quick comment explaining what JS0/JS1/JS2 are to refresh the reader's (and eventually your) memory. Just a simple, you know:
/* JS0: fragment jobs.
* JS1: vertex/tiler jobs
* JS2: compute jobs
*/drivers/gpu/drm/panfrost/panfrost_job.c line 154
Quoted 2 lines
drivers/gpu/drm/panfrost/panfrost_job.c new file +2
-0+#if 0 +// Ignore compute for now Maybe don't ignore compute if it's just this little routine? :)
Quoted 8 lines
drivers/gpu/drm/panfrost/panfrost_job.c line 160
Quoted 2 lines
drivers/gpu/drm/panfrost/panfrost_job.c new file +2
-0+if (kbase_hw_has_issue (kbdev,BASE_HW_ISSUE_8987 )) +return 2 ;It looks like 8987 only applies to the very earliest dev models (based on the issues list) so we shouldn't need to worry about this.
t600_r0p0_15dev0can probably be safely ignored entirely (and deleted from the issues/features/models list, frankly). I doubt that model is even publicly available...
Sadly, I confirmed it is sitting on my desk. Samsung chromebook (snow). As to whether anyone still cares about snow and wants to run a current mainline kernel on it, I don't know. It doesn't look to me like there's any effort there. I certainly don't plan to try.
Quoted 3 lines
drivers/gpu/drm/panfrost/panfrost_job.c line 166
Quoted 1 line
drivers/gpu/drm/panfrost/panfrost_job.c new file +1
-0+static void panfrost_job_write_affinity(struct panfrost_device *pfdev,What's affinity? :)
Hard coded ATM.
Quoted 3 lines
drivers/gpu/drm/panfrost/panfrost_job.c line 219
Quoted 1 line
drivers/gpu/drm/panfrost/panfrost_job.c new file +1
-0+udelay (100 );(Arbitrary?)
Tell me what you'd like it to be...
Quoted 23 lines
drivers/gpu/drm/panfrost/panfrost_job.c line 244
Quoted 4 lines
drivers/gpu/drm/panfrost/panfrost_job.c new file +3
-0+#if 0 +if (kbase_hw_has_issue (kbdev,BASE_HW_ISSUE_10649 )) + cfg |=JS_CONFIG_START_MMU ;This issue seems to apply to a lot of GPUs we *do* care about; better handle this.
Quoted 4 lines
drivers/gpu/drm/panfrost/panfrost_job.c new file +4
-0+ +if (panfrost_has_hw_feature (kbdev, +BASE_HW_FEATURE_JOBCHAIN_DISAMBIGUATION )) { +if (!kbdev->hwaccess.backend.slot_rb[js].job_chain_flag) {drivers/gpu/drm/panfrost/panfrost_job.c line 258
Quoted 10 lines
drivers/gpu/drm/panfrost/panfrost_job.c new file +10
-0+ cfg |=JS_CONFIG_JOB_CHAIN_FLAG ; + katom->atom_flags |=KBASE_KATOM_FLAGS_JOBCHAIN ; + kbdev->hwaccess.backend.slot_rb[js].job_chain_flag = + true; + }else { + katom->atom_flags &= ~KBASE_KATOM_FLAGS_JOBCHAIN ; + kbdev->hwaccess.backend.slot_rb[js].job_chain_flag = + false; + } + }
Quoted 1 line
What does this code do / why is it if 0'd?
Isn't it obvious?
It's a TODO we need to figure out.
Quoted 19 lines
drivers/gpu/drm/panfrost/panfrost_job.c line 366
Quoted 4 lines
drivers/gpu/drm/panfrost/panfrost_job.c new file +3
-0+for (i =0 ; i < bo_count; i++) +/* XXX: Use shared fences for read-only objects. */ +reservation_object_add_excl_fence (bos[i]->resv, fence);I might be paranoid, but 2 lines means braces :)
drivers/gpu/drm/panfrost/panfrost_job.c line 423
Quoted 5 lines
drivers/gpu/drm/panfrost/panfrost_job.c new file +5
-0+for (i =0 ; i < job->bo_count; i++) +drm_gem_object_put_unlocked (job->bos[i]); +kvfree (job->bos); + +kfree (job);Nitpick: move the blank space up a line.
drivers/gpu/drm/panfrost/panfrost_job.c line 495
Quoted 1 line
drivers/gpu/drm/panfrost/panfrost_job.c new file +1
-0+if (job_read (pfdev,JS_STATUS (js)) ==8 ) {What does 8 mean?
Quoted 11 lines
drivers/gpu/drm/panfrost/panfrost_job.c line 502
Quoted 7 lines
drivers/gpu/drm/panfrost/panfrost_job.c new file +7
-0+// dev_err(pfdev->dev, "reseting gpu"); +// panfrost_gpu_reset(pfdev); + } + +/* For now, just say we're done. No reset and retry. */ +// job_write(pfdev, JS_COMMAND(js), JS_COMMAND_HARD_STOP); +dma_fence_signal (job->done_fence);That's probably reasonable, at least for now. If our job faults we have bigger issues / retrying is probably futile. That said, if we're not resetting is there a risk of lock-ups?
Maybe? Reloading the module will reset things.
Quoted 21 lines
drivers/gpu/drm/panfrost/panfrost_job.c line 522
Quoted 3 lines
drivers/gpu/drm/panfrost/panfrost_job.c new file +2
-0+/* Non-Fault Status code */ +/* Job exceptions */ I think the "FAULT" suffix implies that loudly enough :)
drivers/gpu/drm/panfrost/panfrost_job.c line 607
Quoted 2 lines
drivers/gpu/drm/panfrost/panfrost_job.c new file +2
-0+job_write (pfdev,JOB_INT_CLEAR ,0x70007 ); +job_write (pfdev,JOB_INT_MASK ,0x70007 );Meaning of the magic numbers...?
drivers/gpu/drm/panfrost/panfrost_job.h line 10
Quoted 1 line
drivers/gpu/drm/panfrost/panfrost_job.h new file +1
-0+#define NUM_JOB_SLOTS 2/* Don't need 3rd one until we have compute support */ Sure, but there _are_ 3 slots in the hardware; there's no need to lie about that even if we don't presently schedule anything there?
Review line 77
Quoted 2 lines
(quoted diff) +2
-0+// SPDX-License-Identifier: GPL-2.0 +/* Copyright 2019 Linaro, Ltd, Rob Herring <[email protected]> */(Likewise, register copyright).
Quoted 4 lines
drivers/gpu/drm/panfrost/panfrost_mmu.c line 167
Quoted 2 lines
drivers/gpu/drm/panfrost/panfrost_mmu.c new file +2
-0+// if (kbdev->system_coherency == COHERENCY_ACE) +// current_setup->transtab |= AS_TRANSTAB_LPAE_SHARE_OUTER; Bwap?
Only matters for bifrost. There for a TODO I guess.
Quoted 5 lines
drivers/gpu/drm/panfrost/panfrost_mmu.c line 253
Quoted 3 lines
drivers/gpu/drm/panfrost/panfrost_mmu.c new file +2
-0+//struct panfrost_device *pfdev = cookie; +// Wait 1000 GPU cycles!? ?!
That's what the kbase driver does...
Quoted 9 lines
drivers/gpu/drm/panfrost/panfrost_mmu.c line 290
Quoted 4 lines
drivers/gpu/drm/panfrost/panfrost_mmu.c new file +4
-0+if (panfrost_has_hw_feature (pfdev,HW_FEATURE_AARCH64_MMU )) +return "ATOMIC" ; +else +return "UNKNOWN" ;Does it really make sense to check for the feature to determine the name...? I mean, that code path should be unreachable, but still (at least without the check the code is slightly neater..)
Quoted 7 lines
drivers/gpu/drm/panfrost/panfrost_mmu.c line 327
Quoted 3 lines
drivers/gpu/drm/panfrost/panfrost_mmu.c new file +3
-0+ fault_status =mmu_read (pfdev,AS_FAULTSTATUS (i)); + addr =mmu_read (pfdev,AS_FAULTADDRESS_LO (i)); + addr |= (u64 )mmu_read (pfdev,AS_FAULTADDRESS_HI (i)) <<32 ;I don't know if it's necessary for the initial merge, but maybe at least put a TODO comment in here that growable memory (lazy allocations) will be implemented here in the future...?
That affects more than just the code here. We probably need a higher level TODO list.
Quoted 6 lines
drivers/gpu/drm/panfrost/panfrost_mmu.c line 409
Quoted 4 lines
drivers/gpu/drm/panfrost/panfrost_mmu.c new file +4
-0+void panfrost_mmu_fini (struct panfrost_device *pfdev) +{ + +}Empty?
Yeah, that needs some cleanup.
Rob
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Rob Herring
maintainerQuoted 20 lines · Neil Armstrong
Quoted 4 lines · Alyssa Rosenzweig
Oh my onions, it's really here! It's really coming! It's really here!
----
<snip>
Quoted 10 lines
drivers/gpu/drm/panfrost/panfrost_drv.c line 389
Quoted 6 lines
drivers/gpu/drm/panfrost/panfrost_drv.c new file +5
-0+static const struct of_device_id dt_match[] = { + { .compatible ="arm,mali-t760" }, + { .compatible ="arm,mali-t860" }, + {} +};Do we want to add compatibles for the rest of the Mali's on the initial merge, or wait until they're actually confirmed working so we don't load and cause problems on untested hardware?
Quoted 3 lines
We should definitely stick to the midgard bindings here and add all the compatibles even if we haven't tested yet, maybe by adding a warning mechanism reporting when used on an untested mali core ?
Compatibles is the only thing we have documenting what's tested or not. So either we add compatibles when tested or remove warnings when tested? Either way a kernel update is needed.
Quoted 2 lines
BTW rob, I resent the bifrost binding doc with an unique, "arm,mali-bifrost" compatible, adding it would help starting debugging bifrost aswell !
There's a lot missing for bifrost, and a compatible string is the least of it. I can probably add most of it, but can't test any of it (and no one can as the mesa side is not done).
Quoted 11 lines
Quoted 7 lines
Quoted 3 lines
+enum
base_hw_feature{...Quoted 1 line
+
HW_FEATURE_PROTECTED_MODE...Quoted 1 line
+};
<snip>
Quoted 1 line
Quoted 7 lines
Quoted 3 lines
----------------------------
Overall, I'm super happy to see this! Nice work, guys! ^_^
Yeah pretty cool work !
I'll run it on a T820 ASAP and push fixes on the gitlab repo.
What SoC is that?
Rob
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 21 lines · Rob Herring
Quoted 20 lines · Neil Armstrong
Quoted 4 lines · Alyssa Rosenzweig
Oh my onions, it's really here! It's really coming! It's really here!
----
<snip>
Quoted 10 lines
drivers/gpu/drm/panfrost/panfrost_drv.c line 389
Quoted 6 lines
drivers/gpu/drm/panfrost/panfrost_drv.c new file +5
-0+static const struct of_device_id dt_match[] = { + { .compatible ="arm,mali-t760" }, + { .compatible ="arm,mali-t860" }, + {} +};Do we want to add compatibles for the rest of the Mali's on the initial merge, or wait until they're actually confirmed working so we don't load and cause problems on untested hardware?
Quoted 7 lines
Quoted 3 lines
We should definitely stick to the midgard bindings here and add all the compatibles even if we haven't tested yet, maybe by adding a warning mechanism reporting when used on an untested mali core ?
Compatibles is the only thing we have documenting what's tested or not. So either we add compatibles when tested or remove warnings when tested? Either way a kernel update is needed.
The kernel will be updated only to remove the warning, since midgard is also HW discoverable, we can add all the bindings compatible without risks.
Quoted 7 lines
Quoted 3 lines
BTW rob, I resent the bifrost binding doc with an unique, "arm,mali-bifrost" compatible, adding it would help starting debugging bifrost aswell !
There's a lot missing for bifrost, and a compatible string is the least of it. I can probably add most of it, but can't test any of it (and no one can as the mesa side is not done).
What's the problem into adding the compatibles and add a warning filtered on tested model on the HW discovered ID instead ?
Quoted 14 lines
Quoted 14 lines
Quoted 8 lines
Quoted 4 lines
+enum
base_hw_feature{...Quoted 1 line
+
HW_FEATURE_PROTECTED_MODE...Quoted 1 line
+};
<snip>
Quoted 3 lines
----------------------------
Quoted 7 lines
Quoted 5 lines
Quoted 1 line
Overall, I'm super happy to see this! Nice work, guys! ^_^
Yeah pretty cool work !
I'll run it on a T820 ASAP and push fixes on the gitlab repo.
What SoC is that?
Amlogic S912
The t820 node is not upstream since it needs a bindings change to handle the soc specific reset lines.
The reset lines are needed because the internal midgard soft-reset does not work, thus needing the external reset lines.
It also needs some other tweaks, but I'll need to work on it to understand what's needed on the drm driver, the mali_kbase needs a hacky tweak to enable all the cores, but you seem to manually enable the core which is fine.
Neil
Quoted 3 lines
Rob
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Rob Herring
maintainerQuoted 51 lines · Neil Armstrong
Quoted 18 lines · Rob Herring
From: "Marty E. Plummer" <[email protected]>
This adds the initial driver for panfrost which supports Arm Mali Midgard and Bifrost family of GPUs. Currently, only the T860 Midgard GPU has been tested.
Cc Maarten Lankhorst <[email protected]>Cc Maxime Ripard <[email protected]>Cc Sean Paul <[email protected]>Cc David Airlie <[email protected]>Cc Daniel Vetter <[email protected]>Cc Alyssa Rosenzweig <[email protected]>Cc Lyude Paul <[email protected]>Cc Eric Anholt <[email protected]>Signed-off-by Marty E. Plummer <[email protected]>Signed-off-by Tomeu Vizoso <[email protected]>Signed-off-by Rob Herring <[email protected]>---
<snip>
Quoted 15 lines
drivers/gpu/drm/panfrost/panfrost_gpu.c new file +15
-0+ +static const struct panfrost_model gpu_models[] = { +/* T60x has an oddball version */ +GPU_MODEL (t600,0x6956 ,0xffff , +GPU_REV_EXT (t600,0 ,0 ,1 , _15dev0)), +GPU_MODEL_MIDGARD (t620,0x620 , +GPU_REV (t620,0 ,1 ),GPU_REV (t620,1 ,0 )), +GPU_MODEL_MIDGARD (t720,0x720 ), +GPU_MODEL_MIDGARD (t760,0x750 , +GPU_REV (t760,0 ,0 ),GPU_REV (t760,0 ,1 ), +GPU_REV_EXT (t760,0 ,1 ,0 , _50rel0), +GPU_REV (t760,0 ,2 ),GPU_REV (t760,0 ,3 )), +GPU_MODEL_MIDGARD (t820,0x820 ), +GPU_MODEL_MIDGARD (t830,0x830 ), +GPU_MODEL_MIDGARD (t860,0x860 ),drivers/gpu/drm/panfrost/panfrost_gpu.c line 327
Quoted 10 lines
drivers/gpu/drm/panfrost/panfrost_gpu.c new file +10
-0+GPU_MODEL_MIDGARD (t880,0x880 ), + +GPU_MODEL_BIFROST (g71,0x6000 , +GPU_REV_EXT (g71,0 ,0 ,1 , _05dev0)), +GPU_MODEL_BIFROST (g72,0x6001 ), +GPU_MODEL_BIFROST (g51,0x7000 ), +GPU_MODEL_BIFROST (g76,0x7001 ), +GPU_MODEL_BIFROST (g52,0x7002 ), +GPU_MODEL_BIFROST (g31,0x7003 , + GPU_REV(g31, 1, 0)),G31 r0p0 should be supported, the Amlogic G12A has it :
Quoted 3 lines
[ 98.036507] mali ffe40000.gpu: GPU identified as 0x3 arch 7.0.9 r0p0 status 0as reported by
mali_kbase.
It is. There are no h/w issues specific to r0p0 that the kernel has to care about. Somehow, r1p0 added a new issue.
We aren't tracking exactly all known and supported versions. Userspace can do this if we want as the kernel doesn't even track all the issues. If we were to have exact matching, we should only add the ones found in h/w supported upstream. I imagine there's lots of revisions in the kbase driver we'll never see.
Rob
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 4 lines
bitmasks in the kernel use unsigned long arrays. A strange choice which I guess was either because it predated 64-bit or enables atomic ops which tend to be on the native size. So this just fixes the size to 64-bits for 32 and 64 bit systems.
Bizarre, but if that's the standard, then OK.
Quoted 2 lines
Issues I trimmed down to only the kernel ones. Features were small enough, I just left them all.
+1
Quoted 1 line
Job slots, yes. I think I have a define somewhere already I'll use.
NUM_JOB_SLOTS
Quoted 2 lines
I'll just point out that freedreno is also a single address space (though there are patches for that now).
Huh. That seems.... huh.
Quoted 2 lines
Systems simply don't have enough RAM that you'd want to use 4G for graphics memory.
Fair enough.
Quoted 1 line
That reminds me, I want to not start at 0 to catch NULL addresses.
+1
Quoted 3 lines
They aren't exposed outside of the driver, so namespacing them is a bit pointless and just makes the names too long. I will at least rename
base_hw_feature.
+1
Quoted 1 line
Unlike the issues list, it was small enough I didn't really think about it here.
+1 though this may change in the future.
Quoted 3 lines
If this is ever going to be used in commercial products, it will need to be supported whether in tree or out. We can leave that for another day.
*angry acceptance noises*
Quoted 7 lines
Primarily to enforce good hygiene to only access a sub-block's registers within its .c file.
Quoted 1 line
Copyright/origin is more transparent that way too.
Good point. Otherwise, I can say "Register definitions from ..., Copyright ARM..."
Perhaps it would make sense to have a regs/ folder with a
.h corresponding to each of the components. So it's separated out but still prevents unintended access (since you'd need to #include the wrong component explicitly, and that'd be immediately vetoed on a patch).
Quoted 2 lines
This means I just stuffed in fixed values to these registers. The kbase driver uses
hw_issuesand such to determine the setup.
Oh, I see.
Quoted 1 line
Hard to say with the context deleted...
Sorry! I'm new to this, bear with me :)
Quoted 2 lines
As powering on h/w takes time, a delay seemed appropriate. i think I can check some status bits though.
That conceptually seems better, I think.
Quoted 1 line
IMO, if someone wants to improve the documentation here, that can come later.
I'd be happy to submit a patch helping with this (either before we upstream or after).
Quoted 2 lines
Sadly, I confirmed it is sitting on my desk. Samsung chromebook (snow).
Any chance that was an earlier dev version of Snow that you got from your employer and this was maybe fixed in the real thing? Or would that be too convenient?
Quoted 1 line
Hard coded ATM.
No, like, what does "affinity" mean in this context? I didn't study kbase too hard so I'm having troubles following any of this.
Quoted 1 line
Tell me what you'd like it to be...
Maybe some nice round number like 64 or 128..? Kidding ;)
Quoted 3 lines
Isn't it obvious?
It's a TODO we need to figure out.
...Ah. Yes, that should have been obvious. My apologies.
Quoted 1 line
Maybe? Reloading the module will reset things.
The issue is that unprivileged userspace apps are able to submit arbitrarily crazy workloads to the kernel (without necessarily needing the driver's permission). It's trivial for unprivileged code to cause a fault (and thanks to driver bugs, WebGL is an attack surface here as well); doing so should not lock up the GPU requiring superuser access to correct. Faults are not catastrophic but they do happen.
Quoted 1 line
Only matters for bifrost. There for a TODO I guess.
Gotcha, alright.
Quoted 1 line
That's what the kbase driver does...
Huh.
Quoted 2 lines
That affects more than just the code here. We probably need a higher level TODO list.
+1
-Alyssa
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Rob Herring
maintainerQuoted 79 lines · Alyssa Rosenzweig
Quoted 5 lines
bitmasks in the kernel use unsigned long arrays. A strange choice which I guess was either because it predated 64-bit or enables atomic ops which tend to be on the native size. So this just fixes the size to 64-bits for 32 and 64 bit systems.
Bizarre, but if that's the standard, then OK.
Quoted 2 lines
Issues I trimmed down to only the kernel ones. Features were small enough, I just left them all.
+1
Quoted 1 line
Job slots, yes. I think I have a define somewhere already I'll use.
NUM_JOB_SLOTSQuoted 2 lines
I'll just point out that freedreno is also a single address space (though there are patches for that now).
Huh. That seems.... huh.
Quoted 2 lines
Systems simply don't have enough RAM that you'd want to use 4G for graphics memory.
Fair enough.
Quoted 1 line
That reminds me, I want to not start at 0 to catch NULL addresses.
+1
Quoted 3 lines
They aren't exposed outside of the driver, so namespacing them is a bit pointless and just makes the names too long. I will at least rename
base_hw_feature.+1
Quoted 1 line
Unlike the issues list, it was small enough I didn't really think about it here.
+1 though this may change in the future.
Quoted 3 lines
If this is ever going to be used in commercial products, it will need to be supported whether in tree or out. We can leave that for another day.
*angry acceptance noises*
Quoted 7 lines
Primarily to enforce good hygiene to only access a sub-block's registers within its .c file.
Quoted 1 line
Copyright/origin is more transparent that way too.
Good point. Otherwise, I can say "Register definitions from ..., Copyright ARM..."
Perhaps it would make sense to have a regs/ folder with a
.h corresponding to each of the components. So it's separated out but still prevents unintended access (since you'd need to #include the wrong component explicitly, and that'd be immediately vetoed on a patch).Quoted 2 lines
This means I just stuffed in fixed values to these registers. The kbase driver uses
hw_issuesand such to determine the setup.Oh, I see.
Quoted 1 line
Hard to say with the context deleted...
Sorry! I'm new to this, bear with me :)
Quoted 2 lines
As powering on h/w takes time, a delay seemed appropriate. i think I can check some status bits though.
That conceptually seems better, I think.
Quoted 1 line
IMO, if someone wants to improve the documentation here, that can come later.
I'd be happy to submit a patch helping with this (either before we upstream or after).
Quoted 6 lines
Quoted 2 lines
Sadly, I confirmed it is sitting on my desk. Samsung chromebook (snow).
Any chance that was an earlier dev version of Snow that you got from your employer and this was maybe fixed in the real thing? Or would that be too convenient?
It was given to me and a bunch of other ARM kernel devs, but I think it was in production by then. It's an A01 rev which matches this:
https://www.notebookcheck.net/Samsung-Chromebook-XE303C12-A01US.84022.0.html
The only other rev is a UK version.
Quoted 5 lines
Quoted 2 lines
Hard coded ATM.
No, like, what does "affinity" mean in this context? I didn't study kbase too hard so I'm having troubles following any of this.
Core affinity. It's which shader cores to use which was based on flags you pass in for the job. Some of the h/w has multiple L2 caches (IIRC just bifrost) and the code is fairly hard to follow which is why it's just hardcoded. Sorry, I don't have a better explanation, but I've already forgotten some of the details and stopped looking at it once I found hardcoding it would work for now...
This and other parts of this code is why I asked if there are other features of the kbase job submit that we may need in the future (besides just compute).
Quoted 10 lines
Quoted 1 line
Tell me what you'd like it to be...
Maybe some nice round number like 64 or 128..? Kidding ;)
Quoted 3 lines
Isn't it obvious?
It's a TODO we need to figure out.
...Ah. Yes, that should have been obvious. My apologies.
Quoted 8 lines
Quoted 1 line
Maybe? Reloading the module will reset things.
The issue is that unprivileged userspace apps are able to submit arbitrarily crazy workloads to the kernel (without necessarily needing the driver's permission). It's trivial for unprivileged code to cause a fault (and thanks to driver bugs, WebGL is an attack surface here as well); doing so should not lock up the GPU requiring superuser access to correct. Faults are not catastrophic but they do happen.
I understand, but wouldn't just running conformance tests likely kill things too? I'm guessing we can't even run a web browser yet, so WebGL problem is solved. ;)
In any case, Tomeu said resetting is next up for him.
Rob
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 29 lines · Rob Herring
From: "Marty E. Plummer" <[email protected]>
This adds the initial driver for panfrost which supports Arm Mali Midgard and Bifrost family of GPUs. Currently, only the T860 Midgard GPU has been tested.
Cc Maarten Lankhorst <[email protected]>Cc Maxime Ripard <[email protected]>Cc Sean Paul <[email protected]>Cc David Airlie <[email protected]>Cc Daniel Vetter <[email protected]>Cc Alyssa Rosenzweig <[email protected]>Cc Lyude Paul <[email protected]>Cc Eric Anholt <[email protected]>Signed-off-by Marty E. Plummer <[email protected]>Signed-off-by Tomeu Vizoso <[email protected]>Signed-off-by Rob Herring <[email protected]>---
Sending this out in the spirit of release early, release often. We're close to parity compared to mesa + the vendor driver. There's a few issues Tomeu is chasing.There's still some pieces of the h/w setup we've just hardcoded. Locking in various places is probably missing. Error recovery is non-existent (other than module unload/load). There's some work to add tracepoints and perf counters that's not here yet. Bifrost GPUs are definitely not supported yet other than identifying them. Primarily the MMU setup is missing.
Quoted 4 lines
How's performance? Great, because I haven't measured it.
This patch and its dependencies are available here[1]. The mesa support is here[2]. Both are likely to change (daily).
My inclination would be to merge this soon, when basic checkpatch is in shape. The UABI looks good, and that's the important part.
Quoted 74 lines
drivers/gpu/drm/panfrost/panfrost_job.c new file +74
-0+static void panfrost_unlock_bo_reservations (struct drm_gem_object **bos, +int bo_count, +struct ww_acquire_ctx *acquire_ctx) +{ +int i; + +for (i =0 ; i < bo_count; i++) { +ww_mutex_unlock (&bos[i]->resv->lock); + } +ww_acquire_fini (acquire_ctx); +} + +/* Takes the reservation lock on all the BOs being referenced, so that +* at queue submit time we can update the reservations. +* +* We don't lock the RCL the tile alloc/state BOs, or overflow memory +* (all of which are on exec->unref_list). They're entirely private +* to panfrost, so we don't attach dma-buf fences to them. +*/ +static int panfrost_lock_bo_reservations (struct drm_gem_object **bos, +int bo_count, +struct ww_acquire_ctx *acquire_ctx) +{ +int contended_lock =-1 ; +int i, ret; + +ww_acquire_init (acquire_ctx, &reservation_ww_class); + +retry: +if (contended_lock !=-1 ) { +struct drm_gem_object *bo = bos[contended_lock]; + + ret =ww_mutex_lock_slow_interruptible (&bo->resv->lock, + acquire_ctx); +if (ret) { +ww_acquire_done (acquire_ctx); +return ret; + } + } + +for (i =0 ; i < bo_count; i++) { +if (i == contended_lock) +continue ; + + ret =ww_mutex_lock_interruptible (&bos[i]->resv->lock, + acquire_ctx); +if (ret) { +int j; + +for (j =0 ; j < i; j++) +ww_mutex_unlock (&bos[j]->resv->lock); + +if (contended_lock !=-1 && contended_lock >= i) { +struct drm_gem_object *bo = bos[contended_lock]; + +ww_mutex_unlock (&bo->resv->lock); + } + +if (ret == -EDEADLK ) { + contended_lock = i; + goto retry; + } + +ww_acquire_done (acquire_ctx); +return ret; + } + } + +ww_acquire_done (acquire_ctx); + +/* Reserve space for our shared (read-only) fence references, +* before we commit the job to the hardware. +*/ +for (i =0 ; i < bo_count; i++) {
drivers/gpu/drm/panfrost/panfrost_job.c line 356
Quoted 10 lines
drivers/gpu/drm/panfrost/panfrost_job.c new file +10
-0+ ret =reservation_object_reserve_shared (bos[i]->resv,1 ); +if (ret) { +panfrost_unlock_bo_reservations (bos, bo_count, + acquire_ctx); +return ret; + } + } + +return 0 ; +}
I just sent out my shared helpers for most of this function, hopefully you can use them.
It looks like you've got v3d's silliness with the fences -- we reserve a shared slot, then use excl only anyway. For v3d I'm planning on moving to just excl -- only one of my entrypoints has info on write vs read-only, and I don't know of a usecase where having multiple read-only consumers of a shared buffer simultaneously matters.
More importantly, I think you also have my bug of not doing implicit synchronization on buffers, which will break X11 rendering sometimes. X11's GL requirements are that previously-submitted rendering by the client fd will execute before X11's rendering on its fd to the same buffers. If you're running a single client, X11's copies are cheap enough that it'll probably work out most of the time.
include/uapi/drm/panfrost_drm.h line 27
Quoted 9 lines
include/uapi/drm/panfrost_drm.h new file +6
-0+#define DRM_IOCTL_PANFROST_SUBMIT DRM_IOWR(DRM_COMMAND_BASE + DRM_PANFROST_SUBMIT, struct drm_panfrost_submit) +#define DRM_IOCTL_PANFROST_WAIT_BO DRM_IOWR(DRM_COMMAND_BASE + DRM_PANFROST_WAIT_BO, struct drm_panfrost_wait_bo) +#define DRM_IOCTL_PANFROST_CREATE_BO DRM_IOWR(DRM_COMMAND_BASE + DRM_PANFROST_CREATE_BO, struct drm_panfrost_create_bo) +#define DRM_IOCTL_PANFROST_MMAP_BO DRM_IOWR(DRM_COMMAND_BASE + DRM_PANFROST_MMAP_BO, struct drm_panfrost_mmap_bo) +#define DRM_IOCTL_PANFROST_GET_PARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_PANFROST_GET_PARAM, struct drm_panfrost_get_param) +#define DRM_IOCTL_PANFROST_GET_BO_OFFSET DRM_IOWR(DRM_COMMAND_BASE + DRM_PANFROST_GET_BO_OFFSET, struct drm_panfrost_get_bo_offset)
SUBMIT and WAIT_BO might be IOR instead of IOWR
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 6 lines
It was given to me and a bunch of other ARM kernel devs, but I think it was in production by then. It's an A01 rev which matches this:
https://www.notebookcheck.net/Samsung-Chromebook-XE303C12-A01US.84022.0.html
The only other rev is a UK version.
Wacky. Something seems decidedly odd about a "-dev" GPU used in production, though I concede snow was an odd machine in the first place.
Quoted 10 lines
Core affinity. It's which shader cores to use which was based on flags you pass in for the job. Some of the h/w has multiple L2 caches (IIRC just bifrost) and the code is fairly hard to follow which is why it's just hardcoded. Sorry, I don't have a better explanation, but I've already forgotten some of the details and stopped looking at it once I found hardcoding it would work for now...
This and other parts of this code is why I asked if there are other features of the kbase job submit that we may need in the future (besides just compute).
Ahh, okay. As far as I can tell, what we have now (plus the basic compute adjustments we've talked about) should be good through GLES3. It's possible the hairier details are maybe exposed in OpenCL (?), but I haven't looked at that yet, so I couldn't say. It's probably fine to keep hardcoding until we can't.
Quoted 3 lines
I understand, but wouldn't just running conformance tests likely kill things too? I'm guessing we can't even run a web browser yet, so WebGL problem is solved. ;)
Hehe, yes, the conformance tests definitely cause everything to go kerplutz, hence why having resetting is essential just from a stability standpoint (even just for dev, let alone security issues -- unlikely most of the above, this *is* a blocker IMO).
Quoted 1 line
In any case, Tomeu said resetting is next up for him.
Ah, good! :)
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Rob Herring
maintainerQuoted 8 lines · Eric Anholt
Quoted 5 lines · Rob Herring
From: "Marty E. Plummer" <[email protected]>
This adds the initial driver for panfrost which supports Arm Mali Midgard and Bifrost family of GPUs. Currently, only the T860 Midgard GPU has been tested.
[...]
Quoted 6 lines
It looks like you've got v3d's silliness with the fences -- we reserve a shared slot, then use excl only anyway. For v3d I'm planning on moving to just excl -- only one of my entrypoints has info on write vs read-only, and I don't know of a usecase where having multiple read-only consumers of a shared buffer simultaneously matters.
Quoted 6 lines
More importantly, I think you also have my bug of not doing implicit synchronization on buffers, which will break X11 rendering sometimes. X11's GL requirements are that previously-submitted rendering by the client fd will execute before X11's rendering on its fd to the same buffers. If you're running a single client, X11's copies are cheap enough that it'll probably work out most of the time.
Is there a fix for this? I didn't find anything that looked like one.
Quoted 4 lines
Quoted 3 lines
include/uapi/drm/panfrost_drm.h new file +0
-0
Quoted 8 lines
include/uapi/drm/panfrost_drm.h line 27
Quoted 6 lines
include/uapi/drm/panfrost_drm.h new file +6
-0+#define DRM_IOCTL_PANFROST_SUBMIT DRM_IOWR(DRM_COMMAND_BASE + DRM_PANFROST_SUBMIT, struct drm_panfrost_submit) +#define DRM_IOCTL_PANFROST_WAIT_BO DRM_IOWR(DRM_COMMAND_BASE + DRM_PANFROST_WAIT_BO, struct drm_panfrost_wait_bo) +#define DRM_IOCTL_PANFROST_CREATE_BO DRM_IOWR(DRM_COMMAND_BASE + DRM_PANFROST_CREATE_BO, struct drm_panfrost_create_bo) +#define DRM_IOCTL_PANFROST_MMAP_BO DRM_IOWR(DRM_COMMAND_BASE + DRM_PANFROST_MMAP_BO, struct drm_panfrost_mmap_bo) +#define DRM_IOCTL_PANFROST_GET_PARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_PANFROST_GET_PARAM, struct drm_panfrost_get_param) +#define DRM_IOCTL_PANFROST_GET_BO_OFFSET DRM_IOWR(DRM_COMMAND_BASE + DRM_PANFROST_GET_BO_OFFSET, struct drm_panfrost_get_bo_offset)SUBMIT and
WAIT_BOmight be IOR instead of IOWR
Huh? Perhaps WAIT_BO should be IOW as we don't update the timeout being absolute, but both have input parameters and SUBMIT has output params.
Rob
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 40 lines · Rob Herring
Quoted 8 lines · Eric Anholt
Quoted 5 lines · Rob Herring
From: "Marty E. Plummer" <[email protected]>
This adds the initial driver for panfrost which supports Arm Mali Midgard and Bifrost family of GPUs. Currently, only the T860 Midgard GPU has been tested.
[...]
Quoted 6 lines
It looks like you've got v3d's silliness with the fences -- we reserve a shared slot, then use excl only anyway. For v3d I'm planning on moving to just excl -- only one of my entrypoints has info on write vs read-only, and I don't know of a usecase where having multiple read-only consumers of a shared buffer simultaneously matters.
Quoted 6 lines
More importantly, I think you also have my bug of not doing implicit synchronization on buffers, which will break X11 rendering sometimes. X11's GL requirements are that previously-submitted rendering by the client fd will execute before X11's rendering on its fd to the same buffers. If you're running a single client, X11's copies are cheap enough that it'll probably work out most of the time.
Is there a fix for this? I didn't find anything that looked like one.
Quoted 4 lines
Quoted 3 lines
include/uapi/drm/panfrost_drm.h new file +0
-0Quoted 8 lines
include/uapi/drm/panfrost_drm.h line 27
Quoted 6 lines
include/uapi/drm/panfrost_drm.h new file +6
-0+#define DRM_IOCTL_PANFROST_SUBMIT DRM_IOWR(DRM_COMMAND_BASE + DRM_PANFROST_SUBMIT, struct drm_panfrost_submit) +#define DRM_IOCTL_PANFROST_WAIT_BO DRM_IOWR(DRM_COMMAND_BASE + DRM_PANFROST_WAIT_BO, struct drm_panfrost_wait_bo) +#define DRM_IOCTL_PANFROST_CREATE_BO DRM_IOWR(DRM_COMMAND_BASE + DRM_PANFROST_CREATE_BO, struct drm_panfrost_create_bo) +#define DRM_IOCTL_PANFROST_MMAP_BO DRM_IOWR(DRM_COMMAND_BASE + DRM_PANFROST_MMAP_BO, struct drm_panfrost_mmap_bo) +#define DRM_IOCTL_PANFROST_GET_PARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_PANFROST_GET_PARAM, struct drm_panfrost_get_param) +#define DRM_IOCTL_PANFROST_GET_BO_OFFSET DRM_IOWR(DRM_COMMAND_BASE + DRM_PANFROST_GET_BO_OFFSET, struct drm_panfrost_get_bo_offset)SUBMIT and
WAIT_BOmight be IOR instead of IOWR
Quoted 3 lines
Huh? Perhaps
WAIT_BOshould be IOW as we don't update the timeout being absolute, but both have input parameters and SUBMIT has output params.
Sorry, IOW was what I meant. I'm not seeing the output param of SUBMIT -- are you thinking of how the syncobj gets updated?
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 18 lines · Rob Herring
Quoted 8 lines · Eric Anholt
Quoted 5 lines · Rob Herring
From: "Marty E. Plummer" <[email protected]>
This adds the initial driver for panfrost which supports Arm Mali Midgard and Bifrost family of GPUs. Currently, only the T860 Midgard GPU has been tested.
[...]
Quoted 6 lines
It looks like you've got v3d's silliness with the fences -- we reserve a shared slot, then use excl only anyway. For v3d I'm planning on moving to just excl -- only one of my entrypoints has info on write vs read-only, and I don't know of a usecase where having multiple read-only consumers of a shared buffer simultaneously matters.
Quoted 8 lines
Quoted 6 lines
More importantly, I think you also have my bug of not doing implicit synchronization on buffers, which will break X11 rendering sometimes. X11's GL requirements are that previously-submitted rendering by the client fd will execute before X11's rendering on its fd to the same buffers. If you're running a single client, X11's copies are cheap enough that it'll probably work out most of the time.
Is there a fix for this? I didn't find anything that looked like one.
Missed this part.
I'm thinking something like what the lima driver has for implicit sync.
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Rob Herring
maintainerQuoted 43 lines · Eric Anholt
Quoted 40 lines · Rob Herring
Quoted 8 lines · Eric Anholt
Quoted 5 lines · Rob Herring
From: "Marty E. Plummer" <[email protected]>
This adds the initial driver for panfrost which supports Arm Mali Midgard and Bifrost family of GPUs. Currently, only the T860 Midgard GPU has been tested.
[...]
Quoted 6 lines
It looks like you've got v3d's silliness with the fences -- we reserve a shared slot, then use excl only anyway. For v3d I'm planning on moving to just excl -- only one of my entrypoints has info on write vs read-only, and I don't know of a usecase where having multiple read-only consumers of a shared buffer simultaneously matters.
Quoted 6 lines
More importantly, I think you also have my bug of not doing implicit synchronization on buffers, which will break X11 rendering sometimes. X11's GL requirements are that previously-submitted rendering by the client fd will execute before X11's rendering on its fd to the same buffers. If you're running a single client, X11's copies are cheap enough that it'll probably work out most of the time.
Is there a fix for this? I didn't find anything that looked like one.
Quoted 12 lines
include/uapi/drm/panfrost_drm.h line 27
Quoted 10 lines
include/uapi/drm/panfrost_drm.h new file +6
-0+#define DRM_IOCTL_PANFROST_SUBMIT DRM_IOWR(DRM_COMMAND_BASE + DRM_PANFROST_SUBMIT, struct drm_panfrost_submit) +#define DRM_IOCTL_PANFROST_WAIT_BO DRM_IOWR(DRM_COMMAND_BASE + DRM_PANFROST_WAIT_BO, struct drm_panfrost_wait_bo) +#define DRM_IOCTL_PANFROST_CREATE_BO DRM_IOWR(DRM_COMMAND_BASE + DRM_PANFROST_CREATE_BO, struct drm_panfrost_create_bo) +#define DRM_IOCTL_PANFROST_MMAP_BO DRM_IOWR(DRM_COMMAND_BASE + DRM_PANFROST_MMAP_BO, struct drm_panfrost_mmap_bo) +#define DRM_IOCTL_PANFROST_GET_PARAM DRM_IOWR(DRM_COMMAND_BASE + DRM_PANFROST_GET_PARAM, struct drm_panfrost_get_param) +#define DRM_IOCTL_PANFROST_GET_BO_OFFSET DRM_IOWR(DRM_COMMAND_BASE + DRM_PANFROST_GET_BO_OFFSET, struct drm_panfrost_get_bo_offset)SUBMIT and
WAIT_BOmight be IOR instead of IOWR
Quoted 6 lines
Quoted 3 lines
Huh? Perhaps
WAIT_BOshould be IOW as we don't update the timeout being absolute, but both have input parameters and SUBMIT has output params.Sorry, IOW was what I meant. I'm not seeing the output param of SUBMIT -- are you thinking of how the syncobj gets updated?
Yeah, I was assuming out_sync was set on output, but now that I actually look at it I see that's not the case as only the object is updated.
Rob
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Quoted 103 lines · Rob Herring
From: "Marty E. Plummer" <[email protected]>
This adds the initial driver for panfrost which supports Arm Mali Midgard and Bifrost family of GPUs. Currently, only the T860 Midgard GPU has been tested.
Cc Maarten Lankhorst <[email protected]>Cc Maxime Ripard <[email protected]>Cc Sean Paul <[email protected]>Cc David Airlie <[email protected]>Cc Daniel Vetter <[email protected]>Cc Alyssa Rosenzweig <[email protected]>Cc Lyude Paul <[email protected]>Cc Eric Anholt <[email protected]>Signed-off-by Marty E. Plummer <[email protected]>Signed-off-by Tomeu Vizoso <[email protected]>Signed-off-by Rob Herring <[email protected]>---
Sending this out in the spirit of release early, release often. We're close to parity compared to mesa + the vendor driver. There's a few issues Tomeu is chasing.There's still some pieces of the h/w setup we've just hardcoded. Locking in various places is probably missing. Error recovery is non-existent (other than module unload/load). There's some work to add tracepoints and perf counters that's not here yet. Bifrost GPUs are definitely not supported yet other than identifying them. Primarily the MMU setup is missing.
How's performance? Great, because I haven't measured it.
This patch and its dependencies are available here[1]. The mesa support is here[2]. Both are likely to change (daily).
Rob
[1] https://gitlab.freedesktop.org/robh/linux-panfrost.git panfrost-rebase
[2] https://gitlab.freedesktop.org/tomeu/mesa.git mainline-driverdrivers/gpu/drm/Kconfig | 2 + drivers/gpu/drm/Makefile | 1 + drivers/gpu/drm/panfrost/Kconfig | 14 + drivers/gpu/drm/panfrost/Makefile | 11 + drivers/gpu/drm/panfrost/panfrost_device.c | 127 ++++ drivers/gpu/drm/panfrost/panfrost_device.h | 83 +++ drivers/gpu/drm/panfrost/panfrost_drv.c | 419 ++++++++++++ drivers/gpu/drm/panfrost/panfrost_features.h | 308 +++++++++ drivers/gpu/drm/panfrost/panfrost_gem.c | 92 +++ drivers/gpu/drm/panfrost/panfrost_gem.h | 29 + drivers/gpu/drm/panfrost/panfrost_gpu.c | 464 +++++++++++++ drivers/gpu/drm/panfrost/panfrost_gpu.h | 15 + drivers/gpu/drm/panfrost/panfrost_issues.h | 175 +++++ drivers/gpu/drm/panfrost/panfrost_job.c | 662 +++++++++++++++++++ drivers/gpu/drm/panfrost/panfrost_job.h | 47 ++ drivers/gpu/drm/panfrost/panfrost_mmu.c | 409 ++++++++++++ drivers/gpu/drm/panfrost/panfrost_mmu.h | 15 + include/uapi/drm/panfrost_drm.h | 138 ++++ 18 files changed, 3011 insertions(+) create mode 100644 drivers/gpu/drm/panfrost/Kconfig create mode 100644 drivers/gpu/drm/panfrost/Makefile create mode 100644 drivers/gpu/drm/panfrost/panfrost_device.c create mode 100644 drivers/gpu/drm/panfrost/panfrost_device.h create mode 100644 drivers/gpu/drm/panfrost/panfrost_drv.c create mode 100644 drivers/gpu/drm/panfrost/panfrost_features.h create mode 100644 drivers/gpu/drm/panfrost/panfrost_gem.c create mode 100644 drivers/gpu/drm/panfrost/panfrost_gem.h create mode 100644 drivers/gpu/drm/panfrost/panfrost_gpu.c create mode 100644 drivers/gpu/drm/panfrost/panfrost_gpu.h create mode 100644 drivers/gpu/drm/panfrost/panfrost_issues.h create mode 100644 drivers/gpu/drm/panfrost/panfrost_job.c create mode 100644 drivers/gpu/drm/panfrost/panfrost_job.h create mode 100644 drivers/gpu/drm/panfrost/panfrost_mmu.c create mode 100644 drivers/gpu/drm/panfrost/panfrost_mmu.h create mode 100644 include/uapi/drm/panfrost_drm.hdrivers/gpu/drm/Kconfig +2
-0@@ -335,6 +335,8 @@ source "drivers/gpu/drm/tve200/Kconfig" source "drivers/gpu/drm/xen/Kconfig" +source "drivers/gpu/drm/panfrost/Kconfig" + # Keep legacy drivers last menuconfig DRM_LEGACYdrivers/gpu/drm/Makefile +1
-0@@ -110,3 +110,4 @@ obj-$(CONFIG_DRM_TINYDRM) += tinydrm/ obj-$(CONFIG_DRM_PL111) += pl111/ obj-$(CONFIG_DRM_TVE200) += tve200/ obj-$(CONFIG_DRM_XEN) += xen/ +obj-$(CONFIG_DRM_PANFROST) += panfrost/drivers/gpu/drm/panfrost/Kconfig new file +0
-0
drivers/gpu/drm/panfrost/Kconfig line 6
Quoted 6 lines
drivers/gpu/drm/panfrost/Kconfig new file +6
-0@@ -0,0 +1,14 @@ +# SPDX-License-Identifier: GPL-2.0 + +config DRM_PANFROST + tristate "Panfrost (DRM support for ARM Mali Midgard/Bifrost GPUs)" + depends on DRM + depends on ARCH_ROCKCHIP
Could you switch to
+ depends on ARM || ARM64 || COMPILE_TEST
instead of ARCH_ROCKHIP ?
It will simply bringup on non-rockchip boards.
Neil
Quoted 8 lines
drivers/gpu/drm/panfrost/Kconfig new file +8
-0+ depends on MMU + select DRM_SCHED + select IOMMU_SUPPORT + select IOMMU_IO_PGTABLE_LPAE + select DRM_GEM_SHMEM_HELPER + help + DRM driver for ARM Mali Midgard (t6xx, t7xx, t8xx) and + Bifrost (G3x, G5x, G7x) GPUs.
[...]
Quoted 7 lines
drivers/gpu/drm/panfrost/Kconfig new file +6
-0+/** + * Returns the offset for the BO in the GPU address space for this DRM fd. + * This is the same value returned by drm_panfrost_create_bo, if that was called + * from this DRM fd. + */ +struct drm_panfrost_get_bo_offset {
drivers/gpu/drm/panfrost/Kconfig
Quoted 10 lines
drivers/gpu/drm/panfrost/Kconfig new file +10
-0+ __u32 handle; + __u32 pad; + __u64 offset; +}; + +#if defined(__cplusplus) +} +#endif + +#endif /* _PANFROST_DRM_H_ */
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Rob Herring
maintainerQuoted 30 lines · Neil Armstrong
Quoted 28 lines · Rob Herring
From: "Marty E. Plummer" <[email protected]>
This adds the initial driver for panfrost which supports Arm Mali Midgard and Bifrost family of GPUs. Currently, only the T860 Midgard GPU has been tested.
Cc Maarten Lankhorst <[email protected]>Cc Maxime Ripard <[email protected]>Cc Sean Paul <[email protected]>Cc David Airlie <[email protected]>Cc Daniel Vetter <[email protected]>Cc Alyssa Rosenzweig <[email protected]>Cc Lyude Paul <[email protected]>Cc Eric Anholt <[email protected]>Signed-off-by Marty E. Plummer <[email protected]>Signed-off-by Tomeu Vizoso <[email protected]>Signed-off-by Rob Herring <[email protected]>---
Sending this out in the spirit of release early, release often. We're close to parity compared to mesa + the vendor driver. There's a few issues Tomeu is chasing.There's still some pieces of the h/w setup we've just hardcoded. Locking in various places is probably missing. Error recovery is non-existent (other than module unload/load). There's some work to add tracepoints and perf counters that's not here yet. Bifrost GPUs are definitely not supported yet other than identifying them. Primarily the MMU setup is missing.
[...]
Quoted 17 lines
drivers/gpu/drm/panfrost/Kconfig line 6
Quoted 12 lines
drivers/gpu/drm/panfrost/Kconfig new file +6
-0@@ -0,0 +1,14 @@ +# SPDX-License-Identifier: GPL-2.0 + +config DRM_PANFROST + tristate "Panfrost (DRM support for ARM Mali Midgard/Bifrost GPUs)" + depends on DRM + depends on ARCH_ROCKCHIPCould you switch to
+ depends on ARM || ARM64 ||COMPILE_TEST
instead ofARCH_ROCKHIP?
Quoted 1 line
It will simply bringup on non-rockchip boards.
Yes, certainly.
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel