Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

drm/msm/a6xx: Add soft fuse detection support

Recent chipsets like Glymur supports a new mechanism for SKU detection.
A new CX_MISC register exposes the combined (or final) speedbin value
from both HW fuse register and the Soft Fuse register. Implement this new
SKU detection along with a new quirk to identify the GPUs that has soft
fuse support.

There is a side effect of this patch on A4x and older series. The
speedbin field in the MSM_PARAM_CHIPID will be 0 instead of 0xffff. This
should be okay as Mesa correctly handles it. Speedbin was not even a
thing when those GPUs' support were added.

Signed-off-by: Akhil P Oommen <akhilpo@oss.qualcomm.com>
Patchwork: https://patchwork.freedesktop.org/patch/714676/
Message-ID: <20260327-a8xx-gpu-batch2-v2-12-2b53c38d2101@oss.qualcomm.com>
Signed-off-by: Rob Clark <robin.clark@oss.qualcomm.com>

authored by

Akhil P Oommen and committed by
Rob Clark
4ac686bf bb79a606

+45 -12
+6
drivers/gpu/drm/msm/adreno/a5xx_gpu.c
··· 1731 1731 struct adreno_gpu *adreno_gpu; 1732 1732 struct msm_gpu *gpu; 1733 1733 unsigned int nr_rings; 1734 + u32 speedbin; 1734 1735 int ret; 1735 1736 1736 1737 a5xx_gpu = kzalloc(sizeof(*a5xx_gpu), GFP_KERNEL); ··· 1757 1756 a5xx_destroy(&(a5xx_gpu->base.base)); 1758 1757 return ERR_PTR(ret); 1759 1758 } 1759 + 1760 + /* Set the speedbin value that is passed to userspace */ 1761 + if (adreno_read_speedbin(&pdev->dev, &speedbin) || !speedbin) 1762 + speedbin = 0xffff; 1763 + adreno_gpu->speedbin = (uint16_t) (0xffff & speedbin); 1760 1764 1761 1765 msm_mmu_set_fault_handler(to_msm_vm(gpu->vm)->mmu, gpu, 1762 1766 a5xx_fault_handler);
+34 -7
drivers/gpu/drm/msm/adreno/a6xx_gpu.c
··· 2546 2546 return UINT_MAX; 2547 2547 } 2548 2548 2549 - static int a6xx_set_supported_hw(struct device *dev, const struct adreno_info *info) 2549 + static int a6xx_read_speedbin(struct device *dev, struct a6xx_gpu *a6xx_gpu, 2550 + const struct adreno_info *info, u32 *speedbin) 2551 + { 2552 + int ret; 2553 + 2554 + /* Use speedbin fuse if present. Otherwise, fallback to softfuse */ 2555 + ret = adreno_read_speedbin(dev, speedbin); 2556 + if (ret != -ENOENT) 2557 + return ret; 2558 + 2559 + if (info->quirks & ADRENO_QUIRK_SOFTFUSE) { 2560 + *speedbin = a6xx_llc_read(a6xx_gpu, REG_A8XX_CX_MISC_SW_FUSE_FREQ_LIMIT_STATUS); 2561 + *speedbin = A8XX_CX_MISC_SW_FUSE_FREQ_LIMIT_STATUS_FINALFREQLIMIT(*speedbin); 2562 + return 0; 2563 + } 2564 + 2565 + return -ENOENT; 2566 + } 2567 + 2568 + static int a6xx_set_supported_hw(struct device *dev, struct a6xx_gpu *a6xx_gpu, 2569 + const struct adreno_info *info) 2550 2570 { 2551 2571 u32 supp_hw; 2552 2572 u32 speedbin; 2553 2573 int ret; 2554 2574 2555 - ret = adreno_read_speedbin(dev, &speedbin); 2575 + ret = a6xx_read_speedbin(dev, a6xx_gpu, info, &speedbin); 2556 2576 /* 2557 2577 * -ENOENT means that the platform doesn't support speedbin which is 2558 2578 * fine ··· 2606 2586 struct msm_drm_private *priv = dev->dev_private; 2607 2587 struct platform_device *pdev = priv->gpu_pdev; 2608 2588 struct adreno_platform_config *config = pdev->dev.platform_data; 2589 + const struct adreno_info *info = config->info; 2609 2590 struct device_node *node; 2610 2591 struct a6xx_gpu *a6xx_gpu; 2611 2592 struct adreno_gpu *adreno_gpu; 2612 2593 struct msm_gpu *gpu; 2613 2594 extern int enable_preemption; 2595 + u32 speedbin; 2614 2596 bool is_a7xx; 2615 2597 int ret, nr_rings = 1; 2616 2598 ··· 2636 2614 adreno_gpu->gmu_is_wrapper = of_device_is_compatible(node, "qcom,adreno-gmu-wrapper"); 2637 2615 2638 2616 adreno_gpu->base.hw_apriv = 2639 - !!(config->info->quirks & ADRENO_QUIRK_HAS_HW_APRIV); 2617 + !!(info->quirks & ADRENO_QUIRK_HAS_HW_APRIV); 2640 2618 2641 2619 /* gpu->info only gets assigned in adreno_gpu_init(). A8x is included intentionally */ 2642 - is_a7xx = config->info->family >= ADRENO_7XX_GEN1; 2620 + is_a7xx = info->family >= ADRENO_7XX_GEN1; 2643 2621 2644 2622 a6xx_llc_slices_init(pdev, a6xx_gpu, is_a7xx); 2645 2623 2646 - ret = a6xx_set_supported_hw(&pdev->dev, config->info); 2624 + ret = a6xx_set_supported_hw(&pdev->dev, a6xx_gpu, info); 2647 2625 if (ret) { 2648 2626 a6xx_llc_slices_destroy(a6xx_gpu); 2649 2627 kfree(a6xx_gpu); ··· 2651 2629 } 2652 2630 2653 2631 if ((enable_preemption == 1) || (enable_preemption == -1 && 2654 - (config->info->quirks & ADRENO_QUIRK_PREEMPTION))) 2632 + (info->quirks & ADRENO_QUIRK_PREEMPTION))) 2655 2633 nr_rings = 4; 2656 2634 2657 - ret = adreno_gpu_init(dev, pdev, adreno_gpu, config->info->funcs, nr_rings); 2635 + ret = adreno_gpu_init(dev, pdev, adreno_gpu, info->funcs, nr_rings); 2658 2636 if (ret) { 2659 2637 a6xx_destroy(&(a6xx_gpu->base.base)); 2660 2638 return ERR_PTR(ret); 2661 2639 } 2640 + 2641 + /* Set the speedbin value that is passed to userspace */ 2642 + if (a6xx_read_speedbin(&pdev->dev, a6xx_gpu, info, &speedbin) || !speedbin) 2643 + speedbin = 0xffff; 2644 + adreno_gpu->speedbin = (uint16_t) (0xffff & speedbin); 2662 2645 2663 2646 /* 2664 2647 * For now only clamp to idle freq for devices where this is known not
-5
drivers/gpu/drm/msm/adreno/adreno_gpu.c
··· 1182 1182 struct msm_gpu_config adreno_gpu_config = { 0 }; 1183 1183 struct msm_gpu *gpu = &adreno_gpu->base; 1184 1184 const char *gpu_name; 1185 - u32 speedbin; 1186 1185 int ret; 1187 1186 1188 1187 adreno_gpu->funcs = funcs; ··· 1209 1210 } else 1210 1211 devm_pm_opp_set_clkname(dev, "core"); 1211 1212 } 1212 - 1213 - if (adreno_read_speedbin(dev, &speedbin) || !speedbin) 1214 - speedbin = 0xffff; 1215 - adreno_gpu->speedbin = (uint16_t) (0xffff & speedbin); 1216 1213 1217 1214 gpu_name = devm_kasprintf(dev, GFP_KERNEL, "%"ADRENO_CHIPID_FMT, 1218 1215 ADRENO_CHIPID_ARGS(config->chip_id));
+1
drivers/gpu/drm/msm/adreno/adreno_gpu.h
··· 63 63 #define ADRENO_QUIRK_PREEMPTION BIT(5) 64 64 #define ADRENO_QUIRK_4GB_VA BIT(6) 65 65 #define ADRENO_QUIRK_IFPC BIT(7) 66 + #define ADRENO_QUIRK_SOFTFUSE BIT(8) 66 67 67 68 /* Helper for formating the chip_id in the way that userspace tools like 68 69 * crashdec expect.
+4
drivers/gpu/drm/msm/registers/adreno/a6xx.xml
··· 5016 5016 <bitfield pos="1" name="LPAC" type="boolean"/> 5017 5017 <bitfield pos="2" name="RAYTRACING" type="boolean"/> 5018 5018 </reg32> 5019 + <reg32 offset="0x0405" name="CX_MISC_SW_FUSE_FREQ_LIMIT_STATUS" variants="A8XX-"> 5020 + <bitfield high="8" low="0" name="FINALFREQLIMIT"/> 5021 + <bitfield pos="24" name="SOFTSKUDISABLED" type="boolean"/> 5022 + </reg32> 5019 5023 </domain> 5020 5024 5021 5025 </database>