From eaf2491c11874782aa6cca5adfbff9ce2fd9b078 Mon Sep 17 00:00:00 2001 From: Albert I Date: Fri, 1 Jun 2018 22:28:49 +0800 Subject: [PATCH] gpu: msm_adreno: Compile only Adreno codes specific to chipset Idea based on YaroST12/Z2_PLUS_Kernel@5d969c68c10c, but instead of completely removing unused parts we only compile Adreno codes that are specific to target qcom chipset(s) we're compiling against. To be warned, this is only tested against msm8953 and msm8996 devices only, and may be revised when this change is later known to break other chipset(s). Change-Id: I6e1856e345d4b3b818e45025ef4a8f8fd8087928 Signed-off-by: Albert I --- drivers/gpu/msm/Makefile | 18 ++++++++++-------- drivers/gpu/msm/adreno-gpulist.h | 6 ++++++ drivers/gpu/msm/adreno_cp_parser.h | 22 ++++++++++++++++++---- 3 files changed, 34 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/msm/Makefile b/drivers/gpu/msm/Makefile index 7a1d32737bac..556355328663 100644 --- a/drivers/gpu/msm/Makefile +++ b/drivers/gpu/msm/Makefile @@ -27,19 +27,21 @@ msm_adreno-y += \ adreno_snapshot.o \ adreno_coresight.o \ adreno_trace.o \ - adreno_a3xx.o \ - adreno_a4xx.o \ - adreno_a5xx.o \ - adreno_a3xx_snapshot.o \ - adreno_a4xx_snapshot.o \ - adreno_a5xx_snapshot.o \ - adreno_a4xx_preempt.o \ - adreno_a5xx_preempt.o \ adreno_sysfs.o \ adreno.o \ adreno_cp_parser.o \ adreno_perfcounter.o +msm_adreno-$(CONFIG_ARCH_MSM8916) += adreno_a4xx.o adreno_a4xx_snapshot.o adreno_a4xx_preempt.o +msm_adreno-$(CONFIG_ARCH_MSM8917) += adreno_a3xx.o adreno_a3xx_snapshot.o +msm_adreno-$(CONFIG_ARCH_MSM8920) += adreno_a3xx.o adreno_a3xx_snapshot.o +msm_adreno-$(CONFIG_ARCH_MSM8937) += adreno_a5xx.o adreno_a5xx_snapshot.o adreno_a5xx_preempt.o +msm_adreno-$(CONFIG_ARCH_MSM8940) += adreno_a5xx.o adreno_a5xx_snapshot.o adreno_a5xx_preempt.o +msm_adreno-$(CONFIG_ARCH_MSM8953) += adreno_a5xx.o adreno_a5xx_snapshot.o adreno_a5xx_preempt.o +msm_adreno-$(CONFIG_ARCH_MSM8996) += adreno_a5xx.o adreno_a5xx_snapshot.o adreno_a5xx_preempt.o +msm_adreno-$(CONFIG_ARCH_MSMCOBALT) += adreno_a5xx.o adreno_a5xx_snapshot.o adreno_a5xx_preempt.o +msm_adreno-$(CONFIG_ARCH_SDM450) += adreno_a5xx.o adreno_a5xx_snapshot.o adreno_a5xx_preempt.o + msm_adreno-$(CONFIG_MSM_KGSL_IOMMU) += adreno_iommu.o msm_adreno-$(CONFIG_DEBUG_FS) += adreno_debugfs.o adreno_profile.o msm_adreno-$(CONFIG_COMPAT) += adreno_compat.o diff --git a/drivers/gpu/msm/adreno-gpulist.h b/drivers/gpu/msm/adreno-gpulist.h index 778c76f52d0b..a2d1da04b3e0 100644 --- a/drivers/gpu/msm/adreno-gpulist.h +++ b/drivers/gpu/msm/adreno-gpulist.h @@ -14,6 +14,7 @@ #define ANY_ID (~0) static const struct adreno_gpu_core adreno_gpulist[] = { +#if defined(CONFIG_ARCH_MSM8917) | defined(CONFIG_ARCH_MSM8920) { .gpurev = ADRENO_REV_A306, .core = 3, @@ -50,6 +51,8 @@ static const struct adreno_gpu_core adreno_gpulist[] = { .gmem_size = (SZ_64K + SZ_32K), .busy_mask = 0x7FFFFFFE, }, +#endif /* CONFIG_ARCH_MSM8917 | CONFIG_ARCH_MSM8920 */ +#ifdef CONFIG_ARCH_MSM8916 { .gpurev = ADRENO_REV_A405, .core = 4, @@ -133,6 +136,8 @@ static const struct adreno_gpu_core adreno_gpulist[] = { .num_protected_regs = 0x18, .busy_mask = 0x7FFFFFFE, }, +#endif /* CONFIG_ARCH_MSM8916 */ +#if defined(CONFIG_ARCH_MSM8937) | defined(CONFIG_ARCH_MSM8940) | defined(CONFIG_ARCH_MSM8953) | defined(CONFIG_ARCH_MSM8996) | defined(CONFIG_ARCH_MSMCOBALT) | defined(CONFIG_ARCH_SDM450) { .gpurev = ADRENO_REV_A530, .core = 5, @@ -261,4 +266,5 @@ static const struct adreno_gpu_core adreno_gpulist[] = { .gpmu_tsens = 0x000C000D, .max_power = 5448, }, +#endif /* CONFIG_ARCH_MSM8937 | CONFIG_ARCH_MSM8940 | CONFIG_ARCH_MSM8953 | CONFIG_ARCH_MSM8996 | CONFIG_ARCH_MSMCOBALT | CONFIG_ARCH_SDM450 */ }; diff --git a/drivers/gpu/msm/adreno_cp_parser.h b/drivers/gpu/msm/adreno_cp_parser.h index f4d6cd99226e..78557ec6330f 100644 --- a/drivers/gpu/msm/adreno_cp_parser.h +++ b/drivers/gpu/msm/adreno_cp_parser.h @@ -15,8 +15,12 @@ #include "adreno.h" +#if defined(CONFIG_ARCH_MSM8917) | defined(CONFIG_ARCH_MSM8920) extern const unsigned int a3xx_cp_addr_regs[]; +#endif +#ifdef CONFIG_ARCH_MSM8916 extern const unsigned int a4xx_cp_addr_regs[]; +#endif /* * struct adreno_ib_object - Structure containing information about an @@ -137,12 +141,17 @@ static inline int adreno_cp_parser_getreg(struct adreno_device *adreno_dev, if (reg_enum == ADRENO_CP_ADDR_MAX) return -EEXIST; +#if defined(CONFIG_ARCH_MSM8917) | defined(CONFIG_ARCH_MSM8920) if (adreno_is_a3xx(adreno_dev)) return a3xx_cp_addr_regs[reg_enum]; - else if (adreno_is_a4xx(adreno_dev)) +#endif +#ifdef CONFIG_ARCH_MSM8916 + if (adreno_is_a4xx(adreno_dev)) return a4xx_cp_addr_regs[reg_enum]; - else +#endif +#if defined(CONFIG_ARCH_MSM8937) | defined(CONFIG_ARCH_MSM8940) | defined(CONFIG_ARCH_MSM8953) | defined(CONFIG_ARCH_MSM8996) | defined(CONFIG_ARCH_MSMCOBALT) | defined(CONFIG_ARCH_SDM450) return -EEXIST; +#endif } /* @@ -162,12 +171,17 @@ static inline int adreno_cp_parser_regindex(struct adreno_device *adreno_dev, { int i; const unsigned int *regs; +#ifdef CONFIG_ARCH_MSM8916 if (adreno_is_a4xx(adreno_dev)) regs = a4xx_cp_addr_regs; - else if (adreno_is_a3xx(adreno_dev)) +#endif +#if defined(CONFIG_ARCH_MSM8917) | defined(CONFIG_ARCH_MSM8920) + if (adreno_is_a3xx(adreno_dev)) regs = a3xx_cp_addr_regs; - else +#endif +#if defined(CONFIG_ARCH_MSM8937) | defined(CONFIG_ARCH_MSM8940) | defined(CONFIG_ARCH_MSM8953) | defined(CONFIG_ARCH_MSM8996) | defined(CONFIG_ARCH_MSMCOBALT) | defined(CONFIG_ARCH_SDM450) return -EEXIST; +#endif for (i = start; i <= end && i < ADRENO_CP_ADDR_MAX; i++) if (regs[i] == offset)