[PATCH] drm/msm: remove an unused-but-set variable

2024-04-05 Thread Arnd Bergmann
From: Arnd Bergmann 

The modification to a6xx_get_shader_block() had no effect other
than causing a warning:

drivers/gpu/drm/msm/adreno/a6xx_gpu_state.c:843:6: error: variable 'out' set 
but not used [-Werror,-Wunused-but-set-variable]
u64 out = dumper->iova + A6XX_CD_DATA_OFFSET;

Revert this part of the previous patch.

Fixes: 64d6255650d4 ("drm/msm: More fully implement devcoredump for a7xx")
Signed-off-by: Arnd Bergmann 
---
 drivers/gpu/drm/msm/adreno/a6xx_gpu_state.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gpu_state.c 
b/drivers/gpu/drm/msm/adreno/a6xx_gpu_state.c
index 1f5245fc2cdc..d4e1ebfcb021 100644
--- a/drivers/gpu/drm/msm/adreno/a6xx_gpu_state.c
+++ b/drivers/gpu/drm/msm/adreno/a6xx_gpu_state.c
@@ -840,7 +840,6 @@ static void a6xx_get_shader_block(struct msm_gpu *gpu,
struct a6xx_crashdumper *dumper)
 {
u64 *in = dumper->ptr;
-   u64 out = dumper->iova + A6XX_CD_DATA_OFFSET;
size_t datasize = block->size * A6XX_NUM_SHADER_BANKS * sizeof(u32);
int i;
 
@@ -853,8 +852,6 @@ static void a6xx_get_shader_block(struct msm_gpu *gpu,
 
in += CRASHDUMP_READ(in, REG_A6XX_HLSQ_DBG_AHB_READ_APERTURE,
block->size, dumper->iova + A6XX_CD_DATA_OFFSET);
-
-   out += block->size * sizeof(u32);
}
 
CRASHDUMP_FINI(in);
-- 
2.39.2



[Freedreno] [PATCH] drm/msm/a6xx: add QMP dependency

2023-10-16 Thread Arnd Bergmann
From: Arnd Bergmann 

When QMP is in a loadable module, the A6xx GPU driver fails to link
as built-in:

x86_64-linux-ld: drivers/gpu/drm/msm/adreno/a6xx_gmu.o: in function 
`a6xx_gmu_resume':
a6xx_gmu.c:(.text+0xd62): undefined reference to `qmp_send'

Add the usual dependency that still allows compiling without QMP but
otherwise avoids the broken combination of options.

Fixes: 88a0997f2f949 ("drm/msm/a6xx: Send ACD state to QMP at GMU resume")
Signed-off-by: Arnd Bergmann 
---
 drivers/gpu/drm/msm/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/msm/Kconfig b/drivers/gpu/drm/msm/Kconfig
index 6309a857ca312..ad70b611b44f0 100644
--- a/drivers/gpu/drm/msm/Kconfig
+++ b/drivers/gpu/drm/msm/Kconfig
@@ -6,6 +6,7 @@ config DRM_MSM
depends on ARCH_QCOM || SOC_IMX5 || COMPILE_TEST
depends on COMMON_CLK
depends on IOMMU_SUPPORT
+   depends on QCOM_AOSS_QMP || QCOM_AOSS_QMP=n
depends on QCOM_OCMEM || QCOM_OCMEM=n
depends on QCOM_LLCC || QCOM_LLCC=n
depends on QCOM_COMMAND_DB || QCOM_COMMAND_DB=n
-- 
2.39.2



[Freedreno] [PATCH] drm/msm/a6xx: add CONFIG_PM dependency

2023-03-24 Thread Arnd Bergmann
From: Arnd Bergmann 

Selecting CONFIG_PM_GENERIC_DOMAINS causes a build failure when CONFIG_PM
is not enabled:

WARNING: unmet direct dependencies detected for PM_GENERIC_DOMAINS
  Depends on [n]: PM [=n]
  Selected by [m]:
  - DRM_MSM [=m] && HAS_IOMEM [=y] && DRM [=m] && (ARCH_QCOM [=y] || SOC_IMX5 
|| COMPILE_TEST [=y]) && COMMON_CLK [=y] && IOMMU_SUPPORT [=y] && (QCOM_OCMEM 
[=y] || QCOM_OCMEM [=y]=n) && (QCOM_LLCC [=n] || QCOM_LLCC [=n]=n) && 
(QCOM_COMMAND_DB [=y] || QCOM_COMMAND_DB [=y]=n) && DEVFREQ_GOV_SIMPLE_ONDEMAND 
[=y]

drivers/base/power/domain.c:654:13: error: use of undeclared identifier 'pm_wq'
queue_work(pm_wq, >power_off_work);
   ^
drivers/base/power/domain.c:853:26: error: no member named 'ignore_children' in 
'struct dev_pm_info'
if (!dev || dev->power.ignore_children)
~~ ^

Fixes: c11fa1204fe9 ("drm/msm/a6xx: Use genpd notifier to ensure cx-gdsc 
collapse")
Signed-off-by: Arnd Bergmann 
---
 drivers/gpu/drm/msm/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/msm/Kconfig b/drivers/gpu/drm/msm/Kconfig
index 1c417ba53b5b..85f5ab1d552c 100644
--- a/drivers/gpu/drm/msm/Kconfig
+++ b/drivers/gpu/drm/msm/Kconfig
@@ -9,6 +9,7 @@ config DRM_MSM
depends on QCOM_OCMEM || QCOM_OCMEM=n
depends on QCOM_LLCC || QCOM_LLCC=n
depends on QCOM_COMMAND_DB || QCOM_COMMAND_DB=n
+   depends on PM
select IOMMU_IO_PGTABLE
select QCOM_MDT_LOADER if ARCH_QCOM
select REGULATOR
-- 
2.39.2



[Freedreno] [PATCH] drm/msm/gpu: Add proper DEVFREQ_GOV_SIMPLE_ONDEMAND dependency

2023-01-18 Thread Arnd Bergmann
From: Arnd Bergmann 

DRM_MSM can no longer be built when devfreq is disabled:

WARNING: unmet direct dependencies detected for DEVFREQ_GOV_SIMPLE_ONDEMAND
  Depends on [n]: PM_DEVFREQ [=n]
  Selected by [y]:
  - DRM_MSM [=y] && HAS_IOMEM [=y] && DRM [=y] && (ARCH_QCOM [=n] || SOC_IMX5 
[=n] || COMPILE_TEST [=y]) && COMMON_CLK [=y] && IOMMU_SUPPORT [=y] && 
(QCOM_OCMEM [=n] || QCOM_OCMEM [=n]=n) && (QCOM_LLCC [=n] || QCOM_LLCC [=n]=n) 
&& (QCOM_COMMAND_DB [=y] || QCOM_COMMAND_DB [=y]=n)

In file included from drivers/gpu/drm/msm/msm_gpu.h:18,
 from drivers/gpu/drm/msm/adreno/adreno_gpu.h:15,
 from drivers/gpu/drm/msm/adreno/adreno_device.c:9:
drivers/gpu/drm/msm/msm_drv.h:238:45: error: field 'gpu_devfreq_config' has 
incomplete type
  238 | struct devfreq_simple_ondemand_data gpu_devfreq_config;
  | ^~

Device drivers should never select user-visible options, especially
in other subsystems. This one can simply be expressed as a Kconfig
'depends on' statement, though a better approach would be to
let the driver keep working even without devfreq.

Note that the same symbol selects a bunch of other drivers that
should probably be turned into 'depends on' as well, but doing so
has the potential to introduce regressions, so I'm not touching
that here.

Fixes: 6563f60f14cb ("drm/msm/gpu: Add devfreq tuning debugfs")
Signed-off-by: Arnd Bergmann 
---
 drivers/gpu/drm/msm/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/msm/Kconfig b/drivers/gpu/drm/msm/Kconfig
index 871870ddf7ec..7f6f5202648a 100644
--- a/drivers/gpu/drm/msm/Kconfig
+++ b/drivers/gpu/drm/msm/Kconfig
@@ -9,6 +9,7 @@ config DRM_MSM
depends on QCOM_OCMEM || QCOM_OCMEM=n
depends on QCOM_LLCC || QCOM_LLCC=n
depends on QCOM_COMMAND_DB || QCOM_COMMAND_DB=n
+   depends on DEVFREQ_GOV_SIMPLE_ONDEMAND
select IOMMU_IO_PGTABLE
select QCOM_MDT_LOADER if ARCH_QCOM
select REGULATOR
@@ -23,7 +24,6 @@ config DRM_MSM
select SHMEM
select TMPFS
select QCOM_SCM
-   select DEVFREQ_GOV_SIMPLE_ONDEMAND
select WANT_DEV_COREDUMP
select SND_SOC_HDMI_CODEC if SND_SOC
select SYNC_FILE
-- 
2.39.0



[Freedreno] [PATCH] drm/msm/dp: fix missing #include

2021-10-26 Thread Arnd Bergmann
From: Arnd Bergmann 

Some randconfig builds fail when drm/drm_bridge.h is not included
implicitly in this file:

drivers/gpu/drm/msm/dp/dp_parser.c:279:25: error: implicit declaration of 
function 'devm_drm_panel_bridge_add' [-Werror,-Wimplicit-function-declaration]
parser->panel_bridge = devm_drm_panel_bridge_add(dev, panel);

Fixes: 4b296d15b355 ("drm/msm/dp: Allow attaching a drm_panel")
Signed-off-by: Arnd Bergmann 
---
 drivers/gpu/drm/msm/dp/dp_parser.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/msm/dp/dp_parser.c 
b/drivers/gpu/drm/msm/dp/dp_parser.c
index 81dbcc86d08a..a7acc23f742b 100644
--- a/drivers/gpu/drm/msm/dp/dp_parser.c
+++ b/drivers/gpu/drm/msm/dp/dp_parser.c
@@ -8,6 +8,7 @@
 
 #include 
 #include 
+#include 
 
 #include "dp_parser.h"
 #include "dp_reg.h"
-- 
2.29.2



Re: [Freedreno] [PATCH] drm: msm: fix building without CONFIG_COMMON_CLK

2021-10-18 Thread Arnd Bergmann
On Mon, Oct 18, 2021 at 1:40 PM Christian König
 wrote:
> >> I have absolutely no idea how a platform can have IOMMU but no MMU
> >> support but it indeed seems to be the case here.
> > Huh?
> >
> > Parisc has config MMU def_bool y?
>
> Then why vmap isn't available?
>
> See the mail thread: [linux-next:master 3576/7806]
> drivers/gpu/drm/msm/msm_gem.c:624:20: error: implicit declaration of
> function 'vmap'

This is just a missing "#include ". It must be
included indirectly
on some architectures but not other.

   Arnd


[Freedreno] [PATCH] drm: msm: fix building without CONFIG_COMMON_CLK

2021-10-13 Thread Arnd Bergmann
From: Arnd Bergmann 

When CONFIG_COMMON_CLOCK is disabled, the 8996 specific
phy code is left out, which results in a link failure:

ld: drivers/gpu/drm/msm/hdmi/hdmi_phy.o:(.rodata+0x3f0): undefined reference to 
`msm_hdmi_phy_8996_cfg'

This was only exposed after it became possible to build
test the driver without the clock interfaces.

Make COMMON_CLK a hard dependency for compile testing,
and simplify it a little based on that.

Fixes: b3ed524f84f5 ("drm/msm: allow compile_test on !ARM")
Reported-by: Randy Dunlap 
Suggested-by: Geert Uytterhoeven 
Signed-off-by: Arnd Bergmann 
---
 drivers/gpu/drm/msm/Kconfig  | 2 +-
 drivers/gpu/drm/msm/Makefile | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/msm/Kconfig b/drivers/gpu/drm/msm/Kconfig
index f5107b6ded7b..cb204912e0f4 100644
--- a/drivers/gpu/drm/msm/Kconfig
+++ b/drivers/gpu/drm/msm/Kconfig
@@ -4,8 +4,8 @@ config DRM_MSM
tristate "MSM DRM"
depends on DRM
depends on ARCH_QCOM || SOC_IMX5 || COMPILE_TEST
+   depends on COMMON_CLK
depends on IOMMU_SUPPORT
-   depends on (OF && COMMON_CLK) || COMPILE_TEST
depends on QCOM_OCMEM || QCOM_OCMEM=n
depends on QCOM_LLCC || QCOM_LLCC=n
depends on QCOM_COMMAND_DB || QCOM_COMMAND_DB=n
diff --git a/drivers/gpu/drm/msm/Makefile b/drivers/gpu/drm/msm/Makefile
index 904535eda0c4..bbee22b54b0c 100644
--- a/drivers/gpu/drm/msm/Makefile
+++ b/drivers/gpu/drm/msm/Makefile
@@ -23,8 +23,10 @@ msm-y := \
hdmi/hdmi_i2c.o \
hdmi/hdmi_phy.o \
hdmi/hdmi_phy_8960.o \
+   hdmi/hdmi_phy_8996.o \
hdmi/hdmi_phy_8x60.o \
hdmi/hdmi_phy_8x74.o \
+   hdmi/hdmi_pll_8960.o \
edp/edp.o \
edp/edp_aux.o \
edp/edp_bridge.o \
@@ -37,6 +39,7 @@ msm-y := \
disp/mdp4/mdp4_dtv_encoder.o \
disp/mdp4/mdp4_lcdc_encoder.o \
disp/mdp4/mdp4_lvds_connector.o \
+   disp/mdp4/mdp4_lvds_pll.o \
disp/mdp4/mdp4_irq.o \
disp/mdp4/mdp4_kms.o \
disp/mdp4/mdp4_plane.o \
@@ -117,9 +120,6 @@ msm-$(CONFIG_DRM_MSM_DP)+= dp/dp_aux.o \
dp/dp_audio.o
 
 msm-$(CONFIG_DRM_FBDEV_EMULATION) += msm_fbdev.o
-msm-$(CONFIG_COMMON_CLK) += disp/mdp4/mdp4_lvds_pll.o
-msm-$(CONFIG_COMMON_CLK) += hdmi/hdmi_pll_8960.o
-msm-$(CONFIG_COMMON_CLK) += hdmi/hdmi_phy_8996.o
 
 msm-$(CONFIG_DRM_MSM_HDMI_HDCP) += hdmi/hdmi_hdcp.o
 
-- 
2.29.2



Re: [Freedreno] mmotm 2021-10-05-19-53 uploaded (drivers/gpu/drm/msm/hdmi/hdmi_phy.o)

2021-10-13 Thread Arnd Bergmann
On Wed, Oct 13, 2021 at 12:54 PM Arnd Bergmann  wrote:
> On Thu, Oct 7, 2021 at 11:51 AM Geert Uytterhoeven  
> wrote:
>
> -msm-$(CONFIG_DRM_FBDEV_EMULATION) += msm_fbdev.o
> -msm-$(CONFIG_COMMON_CLK) += disp/mdp4/mdp4_lvds_pll.o
> -msm-$(CONFIG_COMMON_CLK) += hdmi/hdmi_pll_8960.o
> -msm-$(CONFIG_COMMON_CLK) += hdmi/hdmi_phy_8996.o
> +msm-$(CONFIG_DRM_FBDEV_EMULATION) += msm_fbdev.o \
> + disp/mdp4/mdp4_lvds_pll.o \
> + hdmi/hdmi_pll_8960.o \
> + hdmi/hdmi_phy_8996.o
>
>  msm-$(CONFIG_DRM_MSM_HDMI_HDCP) += hdmi/hdmi_hdcp.o

I fixed my local copy now after noticing that these should not go
after CONFIG_DRM_FBDEV_EMULATION but the top-level option:

@@ -23,8 +23,10 @@ msm-y := \
hdmi/hdmi_i2c.o \
hdmi/hdmi_phy.o \
hdmi/hdmi_phy_8960.o \
+   hdmi/hdmi_phy_8996.o
hdmi/hdmi_phy_8x60.o \
hdmi/hdmi_phy_8x74.o \
+   hdmi/hdmi_pll_8960.o \
edp/edp.o \
edp/edp_aux.o \
edp/edp_bridge.o \
@@ -37,6 +39,7 @@ msm-y := \
disp/mdp4/mdp4_dtv_encoder.o \
disp/mdp4/mdp4_lcdc_encoder.o \
disp/mdp4/mdp4_lvds_connector.o \
+   disp/mdp4/mdp4_lvds_pll.o \
disp/mdp4/mdp4_irq.o \
disp/mdp4/mdp4_kms.o \
disp/mdp4/mdp4_plane.o \

   Arnd


Re: [Freedreno] mmotm 2021-10-05-19-53 uploaded (drivers/gpu/drm/msm/hdmi/hdmi_phy.o)

2021-10-13 Thread Arnd Bergmann
On Thu, Oct 7, 2021 at 11:51 AM Geert Uytterhoeven  wrote:
> On Wed, Oct 6, 2021 at 9:28 AM Christian König  
> wrote:
> > Am 06.10.21 um 09:20 schrieb Stephen Rothwell:
> > > On Tue, 5 Oct 2021 22:48:03 -0700 Randy Dunlap  
> > > wrote:
> > >> on i386:
> > >>
> > >> ld: drivers/gpu/drm/msm/hdmi/hdmi_phy.o:(.rodata+0x3f0): undefined 
> > >> reference to `msm_hdmi_phy_8996_cfg'

I ran into the same thing now as well.
E_TEST) && COMMON_CLK
>
> I'd make that:
>
> -depends on DRM
> +   depends on COMMON_CLK && DRM && IOMMU_SUPPORT
> depends on ARCH_QCOM || SOC_IMX5 || COMPILE_TEST
> -depends on IOMMU_SUPPORT
> -   depends on (OF && COMMON_CLK) || COMPILE_TEST
> +   depends on OF || COMPILE_TEST
>
> to keep a better separation between hard and soft dependencies.
>
> Note that the "depends on OF || COMPILE_TEST" can even be
> deleted, as the dependency on ARCH_QCOM || SOC_IMX5 implies OF.

Looks good to me, I would also drop that last line in this case, and maybe
add this change as building without COMMON_CLK is no longer possible:

diff --git a/drivers/gpu/drm/msm/Makefile b/drivers/gpu/drm/msm/Makefile
index 904535eda0c4..a5d87e03812f 100644
--- a/drivers/gpu/drm/msm/Makefile
+++ b/drivers/gpu/drm/msm/Makefile
@@ -116,10 +116,10 @@ msm-$(CONFIG_DRM_MSM_DP)+= dp/dp_aux.o \
  dp/dp_power.o \
  dp/dp_audio.o

-msm-$(CONFIG_DRM_FBDEV_EMULATION) += msm_fbdev.o
-msm-$(CONFIG_COMMON_CLK) += disp/mdp4/mdp4_lvds_pll.o
-msm-$(CONFIG_COMMON_CLK) += hdmi/hdmi_pll_8960.o
-msm-$(CONFIG_COMMON_CLK) += hdmi/hdmi_phy_8996.o
+msm-$(CONFIG_DRM_FBDEV_EMULATION) += msm_fbdev.o \
+ disp/mdp4/mdp4_lvds_pll.o \
+ hdmi/hdmi_pll_8960.o \
+ hdmi/hdmi_phy_8996.o

 msm-$(CONFIG_DRM_MSM_HDMI_HDCP) += hdmi/hdmi_hdcp.o

Has anyone submitted a patch already, or should I send the version
that I am using locally now?

Arnd


[Freedreno] [PATCH v2 2/2] qcom_scm: hide Kconfig symbol

2021-10-07 Thread Arnd Bergmann
From: Arnd Bergmann 

Now that SCM can be a loadable module, we have to add another
dependency to avoid link failures when ipa or adreno-gpu are
built-in:

aarch64-linux-ld: drivers/net/ipa/ipa_main.o: in function `ipa_probe':
ipa_main.c:(.text+0xfc4): undefined reference to `qcom_scm_is_available'

ld.lld: error: undefined symbol: qcom_scm_is_available
>>> referenced by adreno_gpu.c
>>>   gpu/drm/msm/adreno/adreno_gpu.o:(adreno_zap_shader_load) in 
>>> archive drivers/built-in.a

This can happen when CONFIG_ARCH_QCOM is disabled and we don't select
QCOM_MDT_LOADER, but some other module selects QCOM_SCM. Ideally we'd
use a similar dependency here to what we have for QCOM_RPROC_COMMON,
but that causes dependency loops from other things selecting QCOM_SCM.

This appears to be an endless problem, so try something different this
time:

 - CONFIG_QCOM_SCM becomes a hidden symbol that nothing 'depends on'
   but that is simply selected by all of its users

 - All the stubs in include/linux/qcom_scm.h can go away

 - arm-smccc.h needs to provide a stub for __arm_smccc_smc() to
   allow compile-testing QCOM_SCM on all architectures.

 - To avoid a circular dependency chain involving RESET_CONTROLLER
   and PINCTRL_SUNXI, drop the 'select RESET_CONTROLLER' statement.
   According to my testing this still builds fine, and the QCOM
   platform selects this symbol already.

Acked-by: Kalle Valo 
Acked-by: Alex Elder 
Signed-off-by: Arnd Bergmann 
---
Changes in v2:
- fix the iommu dependencies

I've queued this version as a bugfix along with patch 1/2
in my asm-generic tree.

 drivers/firmware/Kconfig   |  5 +-
 drivers/gpu/drm/msm/Kconfig|  4 +-
 drivers/iommu/Kconfig  |  3 +-
 drivers/iommu/arm/arm-smmu/Makefile|  3 +-
 drivers/iommu/arm/arm-smmu/arm-smmu-impl.c |  3 +-
 drivers/media/platform/Kconfig |  2 +-
 drivers/mmc/host/Kconfig   |  2 +-
 drivers/net/ipa/Kconfig|  1 +
 drivers/net/wireless/ath/ath10k/Kconfig|  2 +-
 drivers/pinctrl/qcom/Kconfig   |  3 +-
 include/linux/arm-smccc.h  | 10 +++
 include/linux/qcom_scm.h   | 71 --
 12 files changed, 24 insertions(+), 85 deletions(-)

diff --git a/drivers/firmware/Kconfig b/drivers/firmware/Kconfig
index 220a58cf0a44..cda7d7162cbb 100644
--- a/drivers/firmware/Kconfig
+++ b/drivers/firmware/Kconfig
@@ -203,10 +203,7 @@ config INTEL_STRATIX10_RSU
  Say Y here if you want Intel RSU support.
 
 config QCOM_SCM
-   tristate "Qcom SCM driver"
-   depends on ARM || ARM64
-   depends on HAVE_ARM_SMCCC
-   select RESET_CONTROLLER
+   tristate
 
 config QCOM_SCM_DOWNLOAD_MODE_DEFAULT
bool "Qualcomm download mode enabled by default"
diff --git a/drivers/gpu/drm/msm/Kconfig b/drivers/gpu/drm/msm/Kconfig
index e9c6af78b1d7..3ddf739a6f9b 100644
--- a/drivers/gpu/drm/msm/Kconfig
+++ b/drivers/gpu/drm/msm/Kconfig
@@ -17,7 +17,7 @@ config DRM_MSM
select DRM_SCHED
select SHMEM
select TMPFS
-   select QCOM_SCM if ARCH_QCOM
+   select QCOM_SCM
select WANT_DEV_COREDUMP
select SND_SOC_HDMI_CODEC if SND_SOC
select SYNC_FILE
@@ -55,7 +55,7 @@ config DRM_MSM_GPU_SUDO
 
 config DRM_MSM_HDMI_HDCP
bool "Enable HDMI HDCP support in MSM DRM driver"
-   depends on DRM_MSM && QCOM_SCM
+   depends on DRM_MSM
default y
help
  Choose this option to enable HDCP state machine
diff --git a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig
index 124c41adeca1..c5c71b7ab7e8 100644
--- a/drivers/iommu/Kconfig
+++ b/drivers/iommu/Kconfig
@@ -308,7 +308,6 @@ config APPLE_DART
 config ARM_SMMU
tristate "ARM Ltd. System MMU (SMMU) Support"
depends on ARM64 || ARM || (COMPILE_TEST && !GENERIC_ATOMIC64)
-   depends on QCOM_SCM || !QCOM_SCM #if QCOM_SCM=m this can't be =y
select IOMMU_API
select IOMMU_IO_PGTABLE_LPAE
select ARM_DMA_USE_IOMMU if ARM
@@ -438,7 +437,7 @@ config QCOM_IOMMU
# Note: iommu drivers cannot (yet?) be built as modules
bool "Qualcomm IOMMU Support"
depends on ARCH_QCOM || (COMPILE_TEST && !GENERIC_ATOMIC64)
-   depends on QCOM_SCM=y
+   select QCOM_SCM
select IOMMU_API
select IOMMU_IO_PGTABLE_LPAE
select ARM_DMA_USE_IOMMU
diff --git a/drivers/iommu/arm/arm-smmu/Makefile 
b/drivers/iommu/arm/arm-smmu/Makefile
index e240a7bcf310..b0cc01aa20c9 100644
--- a/drivers/iommu/arm/arm-smmu/Makefile
+++ b/drivers/iommu/arm/arm-smmu/Makefile
@@ -1,4 +1,5 @@
 # SPDX-License-Identifier: GPL-2.0
 obj-$(CONFIG_QCOM_IOMMU) += qcom_iommu.o
 obj-$(CONFIG_ARM_SMMU) += arm_smmu.o
-arm_smmu-objs += arm-smmu.o arm-smmu-impl.o arm-smmu-nvidia.o arm-smmu-qcom.o
+arm_smmu-objs += arm-smmu.o arm-smmu-impl.o 

[Freedreno] [PATCH v2 1/2] firmware: include drivers/firmware/Kconfig unconditionally

2021-10-07 Thread Arnd Bergmann
From: Arnd Bergmann 

Compile-testing drivers that require access to a firmware layer
fails when that firmware symbol is unavailable. This happened
twice this week:

 - My proposed to change to rework the QCOM_SCM firmware symbol
   broke on ppc64 and others.

 - The cs_dsp firmware patch added device specific firmware loader
   into drivers/firmware, which broke on the same set of
   architectures.

We should probably do the same thing for other subsystems as well,
but fix this one first as this is a dependency for other patches
getting merged.

Reviewed-by: Bjorn Andersson 
Reviewed-by: Charles Keepax 
Acked-by: Will Deacon 
Acked-by: Bjorn Andersson 
Cc: Mark Brown 
Cc: Liam Girdwood 
Cc: Charles Keepax 
Cc: Simon Trimmer 
Cc: Michael Ellerman 
Reviewed-by: Mark Brown 
Signed-off-by: Arnd Bergmann 
---
No changes in v2, but it's now queued in my asm-generic
tree for v5.15

 arch/arm/Kconfig| 2 --
 arch/arm64/Kconfig  | 2 --
 arch/ia64/Kconfig   | 2 --
 arch/mips/Kconfig   | 2 --
 arch/parisc/Kconfig | 2 --
 arch/riscv/Kconfig  | 2 --
 arch/x86/Kconfig| 2 --
 drivers/Kconfig | 2 ++
 8 files changed, 2 insertions(+), 14 deletions(-)

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index fc196421b2ce..59baf6c132a7 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -1989,8 +1989,6 @@ config ARCH_HIBERNATION_POSSIBLE
 
 endmenu
 
-source "drivers/firmware/Kconfig"
-
 if CRYPTO
 source "arch/arm/crypto/Kconfig"
 endif
diff --git a/arch/arm64/Kconfig b/arch/arm64/Kconfig
index 077f2ec4eeb2..407b4addea36 100644
--- a/arch/arm64/Kconfig
+++ b/arch/arm64/Kconfig
@@ -1931,8 +1931,6 @@ source "drivers/cpufreq/Kconfig"
 
 endmenu
 
-source "drivers/firmware/Kconfig"
-
 source "drivers/acpi/Kconfig"
 
 source "arch/arm64/kvm/Kconfig"
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
index 045792cde481..1e33666fa679 100644
--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@ -388,8 +388,6 @@ config CRASH_DUMP
  help
Generate crash dump after being started by kexec.
 
-source "drivers/firmware/Kconfig"
-
 endmenu
 
 menu "Power management and ACPI options"
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 771ca53af06d..6b8f591c5054 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -3316,8 +3316,6 @@ source "drivers/cpuidle/Kconfig"
 
 endmenu
 
-source "drivers/firmware/Kconfig"
-
 source "arch/mips/kvm/Kconfig"
 
 source "arch/mips/vdso/Kconfig"
diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig
index 4742b6f169b7..27a8b49af11f 100644
--- a/arch/parisc/Kconfig
+++ b/arch/parisc/Kconfig
@@ -384,6 +384,4 @@ config KEXEC_FILE
 
 endmenu
 
-source "drivers/firmware/Kconfig"
-
 source "drivers/parisc/Kconfig"
diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig
index c3f3fd583e04..8bc71ab143e3 100644
--- a/arch/riscv/Kconfig
+++ b/arch/riscv/Kconfig
@@ -561,5 +561,3 @@ menu "Power management options"
 source "kernel/power/Kconfig"
 
 endmenu
-
-source "drivers/firmware/Kconfig"
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 4e001425..4dca39744ee9 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -2828,8 +2828,6 @@ config HAVE_ATOMIC_IOMAP
def_bool y
depends on X86_32
 
-source "drivers/firmware/Kconfig"
-
 source "arch/x86/kvm/Kconfig"
 
 source "arch/x86/Kconfig.assembler"
diff --git a/drivers/Kconfig b/drivers/Kconfig
index 30d2db37cc87..0d399ddaa185 100644
--- a/drivers/Kconfig
+++ b/drivers/Kconfig
@@ -17,6 +17,8 @@ source "drivers/bus/Kconfig"
 
 source "drivers/connector/Kconfig"
 
+source "drivers/firmware/Kconfig"
+
 source "drivers/gnss/Kconfig"
 
 source "drivers/mtd/Kconfig"
-- 
2.29.2



Re: [Freedreno] [PATCH] [RFC] qcom_scm: hide Kconfig symbol

2021-09-29 Thread Arnd Bergmann
On Wed, Sep 29, 2021 at 4:46 PM Bjorn Andersson
 wrote:
>
> On Wed 29 Sep 05:04 CDT 2021, Arnd Bergmann wrote:
>
> > On Wed, Sep 29, 2021 at 11:51 AM Will Deacon  wrote:
> > > On Mon, Sep 27, 2021 at 05:22:13PM +0200, Arnd Bergmann wrote:
> > > >
> > > > diff --git a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig
> > > > index 124c41adeca1..989c83acbfee 100644
> > > > --- a/drivers/iommu/Kconfig
> > > > +++ b/drivers/iommu/Kconfig
> > > > @@ -308,7 +308,7 @@ config APPLE_DART
> > > >  config ARM_SMMU
> > > >   tristate "ARM Ltd. System MMU (SMMU) Support"
> > > >   depends on ARM64 || ARM || (COMPILE_TEST && !GENERIC_ATOMIC64)
> > > > - depends on QCOM_SCM || !QCOM_SCM #if QCOM_SCM=m this can't be =y
> > > > + select QCOM_SCM
> > > >   select IOMMU_API
> > > >   select IOMMU_IO_PGTABLE_LPAE
> > > >   select ARM_DMA_USE_IOMMU if ARM
> > >
> > > I don't want to get in the way of this patch because I'm also tired of the
> > > randconfig failures caused by QCOM_SCM. However, ARM_SMMU is applicable to
> > > a wide variety of (non-qcom) SoCs and so it seems a shame to require the
> > > QCOM_SCM code to be included for all of those when it's not strictly 
> > > needed
> > > at all.
> >
> > Good point, I agree that needs to be fixed. I think this additional
> > change should do the trick:
> >
>
> ARM_SMMU and QCOM_IOMMU are two separate implementations and both uses
> QCOM_SCM. So both of them should select QCOM_SCM.

Right, I figured that out later as well.

> "Unfortunately" the Qualcomm portion of ARM_SMMU is builtin
> unconditionally, so going with something like select QCOM_SCM if
> ARCH_QCOM would still require the stubs in qcom_scm.h.

Yes, sounds good. I also noticed that I still need one hack in there
if I do this:

diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c
b/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c
index 55690af1b25d..36c304a8fc9b 100644
--- a/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c
+++ b/drivers/iommu/arm/arm-smmu/arm-smmu-qcom.c
@@ -427,6 +427,9 @@ struct arm_smmu_device *qcom_smmu_impl_init(struct
arm_smmu_device *smmu)
 {
const struct device_node *np = smmu->dev->of_node;

+   if (!IS_ENABLED(CONFIG_QCOM_SCM))
+   return ERR_PTR(-ENXIO);
+
 #ifdef CONFIG_ACPI
if (np == NULL) {
/* Match platform for ACPI boot */


Otherwise it still breaks with ARM_SMMU=y and QCOM_SCM=m.

Splitting out the qualcomm portion of the arm_smmu driver using
a separate 'bool' symbol should also work, if  you prefer that
and can suggest a name and help text for that symbol. It would
look like

diff --git a/drivers/iommu/arm/arm-smmu/Makefile
b/drivers/iommu/arm/arm-smmu/Makefile
index e240a7bcf310..b0cc01aa20c9 100644
--- a/drivers/iommu/arm/arm-smmu/Makefile
+++ b/drivers/iommu/arm/arm-smmu/Makefile
@@ -1,4 +1,5 @@
 # SPDX-License-Identifier: GPL-2.0
 obj-$(CONFIG_QCOM_IOMMU) += qcom_iommu.o
 obj-$(CONFIG_ARM_SMMU) += arm_smmu.o
-arm_smmu-objs += arm-smmu.o arm-smmu-impl.o arm-smmu-nvidia.o arm-smmu-qcom.o
+arm_smmu-objs += arm-smmu.o arm-smmu-impl.o arm-smmu-nvidia.o
+arm_smmu-$(CONFIG_ARM_SMMU_QCOM) += arm-smmu-qcom.o
diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu-impl.c
b/drivers/iommu/arm/arm-smmu/arm-smmu-impl.c
index 9f465e146799..2c25cce38060 100644
--- a/drivers/iommu/arm/arm-smmu/arm-smmu-impl.c
+++ b/drivers/iommu/arm/arm-smmu/arm-smmu-impl.c
@@ -215,7 +215,8 @@ struct arm_smmu_device *arm_smmu_impl_init(struct
arm_smmu_device *smmu)
of_device_is_compatible(np, "nvidia,tegra186-smmu"))
return nvidia_smmu_impl_init(smmu);

-   smmu = qcom_smmu_impl_init(smmu);
+   if (IS_ENABLED(CONFIG_ARM_SMMU_QCOM))
+   smmu = qcom_smmu_impl_init(smmu);

if (of_device_is_compatible(np, "marvell,ap806-smmu-500"))
smmu->impl = _mmu500_impl;



   Arnd


Re: [Freedreno] [PATCH] [RFC] qcom_scm: hide Kconfig symbol

2021-09-29 Thread Arnd Bergmann
On Wed, Sep 29, 2021 at 11:51 AM Will Deacon  wrote:
> On Mon, Sep 27, 2021 at 05:22:13PM +0200, Arnd Bergmann wrote:
> >
> > diff --git a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig
> > index 124c41adeca1..989c83acbfee 100644
> > --- a/drivers/iommu/Kconfig
> > +++ b/drivers/iommu/Kconfig
> > @@ -308,7 +308,7 @@ config APPLE_DART
> >  config ARM_SMMU
> >   tristate "ARM Ltd. System MMU (SMMU) Support"
> >   depends on ARM64 || ARM || (COMPILE_TEST && !GENERIC_ATOMIC64)
> > - depends on QCOM_SCM || !QCOM_SCM #if QCOM_SCM=m this can't be =y
> > + select QCOM_SCM
> >   select IOMMU_API
> >   select IOMMU_IO_PGTABLE_LPAE
> >   select ARM_DMA_USE_IOMMU if ARM
>
> I don't want to get in the way of this patch because I'm also tired of the
> randconfig failures caused by QCOM_SCM. However, ARM_SMMU is applicable to
> a wide variety of (non-qcom) SoCs and so it seems a shame to require the
> QCOM_SCM code to be included for all of those when it's not strictly needed
> at all.

Good point, I agree that needs to be fixed. I think this additional
change should do the trick:

--- a/drivers/iommu/Kconfig
+++ b/drivers/iommu/Kconfig
@@ -308,7 +308,6 @@ config APPLE_DART
 config ARM_SMMU
tristate "ARM Ltd. System MMU (SMMU) Support"
depends on ARM64 || ARM || (COMPILE_TEST && !GENERIC_ATOMIC64)
-   select QCOM_SCM
select IOMMU_API
select IOMMU_IO_PGTABLE_LPAE
select ARM_DMA_USE_IOMMU if ARM
@@ -438,7 +437,7 @@ config QCOM_IOMMU
# Note: iommu drivers cannot (yet?) be built as modules
bool "Qualcomm IOMMU Support"
depends on ARCH_QCOM || (COMPILE_TEST && !GENERIC_ATOMIC64)
-   depends on QCOM_SCM=y
+   select QCOM_SCM
select IOMMU_API
select IOMMU_IO_PGTABLE_LPAE
select ARM_DMA_USE_IOMMU

I'll see if that causes any problems for the randconfig builds.

   Arnd


[Freedreno] [PATCH 2/2] [v2] qcom_scm: hide Kconfig symbol

2021-09-28 Thread Arnd Bergmann
From: Arnd Bergmann 

Now that SCM can be a loadable module, we have to add another
dependency to avoid link failures when ipa or adreno-gpu are
built-in:

aarch64-linux-ld: drivers/net/ipa/ipa_main.o: in function `ipa_probe':
ipa_main.c:(.text+0xfc4): undefined reference to `qcom_scm_is_available'

ld.lld: error: undefined symbol: qcom_scm_is_available
>>> referenced by adreno_gpu.c
>>>   gpu/drm/msm/adreno/adreno_gpu.o:(adreno_zap_shader_load) in 
>>> archive drivers/built-in.a

This can happen when CONFIG_ARCH_QCOM is disabled and we don't select
QCOM_MDT_LOADER, but some other module selects QCOM_SCM. Ideally we'd
use a similar dependency here to what we have for QCOM_RPROC_COMMON,
but that causes dependency loops from other things selecting QCOM_SCM.

This appears to be an endless problem, so try something different this
time:

 - CONFIG_QCOM_SCM becomes a hidden symbol that nothing 'depends on'
   but that is simply selected by all of its users

 - All the stubs in include/linux/qcom_scm.h can go away

 - arm-smccc.h needs to provide a stub for __arm_smccc_smc() to
   allow compile-testing QCOM_SCM on all architectures.

 - To avoid a circular dependency chain involving RESET_CONTROLLER
   and PINCTRL_SUNXI, drop the 'select RESET_CONTROLLER' statement.
   According to my testing this still builds fine, and the QCOM
   platform selects this symbol already.

Acked-by: Kalle Valo 
Signed-off-by: Arnd Bergmann 
---
Changes in v2:
  - drop the 'select RESET_CONTROLLER' line, rather than adding
more of the same
---
 drivers/firmware/Kconfig|  5 +-
 drivers/gpu/drm/msm/Kconfig |  4 +-
 drivers/iommu/Kconfig   |  2 +-
 drivers/media/platform/Kconfig  |  2 +-
 drivers/mmc/host/Kconfig|  2 +-
 drivers/net/ipa/Kconfig |  1 +
 drivers/net/wireless/ath/ath10k/Kconfig |  2 +-
 drivers/pinctrl/qcom/Kconfig|  3 +-
 include/linux/arm-smccc.h   | 10 
 include/linux/qcom_scm.h| 71 -
 10 files changed, 20 insertions(+), 82 deletions(-)

diff --git a/drivers/firmware/Kconfig b/drivers/firmware/Kconfig
index 220a58cf0a44..cda7d7162cbb 100644
--- a/drivers/firmware/Kconfig
+++ b/drivers/firmware/Kconfig
@@ -203,10 +203,7 @@ config INTEL_STRATIX10_RSU
  Say Y here if you want Intel RSU support.
 
 config QCOM_SCM
-   tristate "Qcom SCM driver"
-   depends on ARM || ARM64
-   depends on HAVE_ARM_SMCCC
-   select RESET_CONTROLLER
+   tristate
 
 config QCOM_SCM_DOWNLOAD_MODE_DEFAULT
bool "Qualcomm download mode enabled by default"
diff --git a/drivers/gpu/drm/msm/Kconfig b/drivers/gpu/drm/msm/Kconfig
index e9c6af78b1d7..3ddf739a6f9b 100644
--- a/drivers/gpu/drm/msm/Kconfig
+++ b/drivers/gpu/drm/msm/Kconfig
@@ -17,7 +17,7 @@ config DRM_MSM
select DRM_SCHED
select SHMEM
select TMPFS
-   select QCOM_SCM if ARCH_QCOM
+   select QCOM_SCM
select WANT_DEV_COREDUMP
select SND_SOC_HDMI_CODEC if SND_SOC
select SYNC_FILE
@@ -55,7 +55,7 @@ config DRM_MSM_GPU_SUDO
 
 config DRM_MSM_HDMI_HDCP
bool "Enable HDMI HDCP support in MSM DRM driver"
-   depends on DRM_MSM && QCOM_SCM
+   depends on DRM_MSM
default y
help
  Choose this option to enable HDCP state machine
diff --git a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig
index 124c41adeca1..989c83acbfee 100644
--- a/drivers/iommu/Kconfig
+++ b/drivers/iommu/Kconfig
@@ -308,7 +308,7 @@ config APPLE_DART
 config ARM_SMMU
tristate "ARM Ltd. System MMU (SMMU) Support"
depends on ARM64 || ARM || (COMPILE_TEST && !GENERIC_ATOMIC64)
-   depends on QCOM_SCM || !QCOM_SCM #if QCOM_SCM=m this can't be =y
+   select QCOM_SCM
select IOMMU_API
select IOMMU_IO_PGTABLE_LPAE
select ARM_DMA_USE_IOMMU if ARM
diff --git a/drivers/media/platform/Kconfig b/drivers/media/platform/Kconfig
index 157c924686e4..80321e03809a 100644
--- a/drivers/media/platform/Kconfig
+++ b/drivers/media/platform/Kconfig
@@ -565,7 +565,7 @@ config VIDEO_QCOM_VENUS
depends on VIDEO_DEV && VIDEO_V4L2 && QCOM_SMEM
depends on (ARCH_QCOM && IOMMU_DMA) || COMPILE_TEST
select QCOM_MDT_LOADER if ARCH_QCOM
-   select QCOM_SCM if ARCH_QCOM
+   select QCOM_SCM
select VIDEOBUF2_DMA_CONTIG
select V4L2_MEM2MEM_DEV
help
diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig
index 71313961cc54..95b3511b0560 100644
--- a/drivers/mmc/host/Kconfig
+++ b/drivers/mmc/host/Kconfig
@@ -547,7 +547,7 @@ config MMC_SDHCI_MSM
depends on MMC_SDHCI_PLTFM
select MMC_SDHCI_IO_ACCESSORS
select MMC_CQHCI
-   select QCOM_SCM if MMC_CRYPTO && ARCH_QCOM
+   select QCOM_SCM if MMC_CRYPTO
help
   

Re: [Freedreno] [PATCH] [RFC] qcom_scm: hide Kconfig symbol

2021-09-28 Thread Arnd Bergmann
On Tue, Sep 28, 2021 at 9:05 AM Kalle Valo  wrote:
> Arnd Bergmann  writes:
> > From: Arnd Bergmann 
> I assume I can continue to build test ATH10K_SNOC with x86 as before?
> That's important for me. If yes, then:
>
> Acked-by: Kalle Valo 
>
> --
> https://patchwork.kernel.org/project/linux-wireless/list/
>
> https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches

Yes, the difference is that this will then also build the qcom_scm module, but
that should not cause any problems after the other changes in this patch.

  Arnd


Re: [Freedreno] [PATCH] [RFC] qcom_scm: hide Kconfig symbol

2021-09-27 Thread Arnd Bergmann
On Mon, Sep 27, 2021 at 10:42 PM Bjorn Andersson
 wrote:
> On Mon 27 Sep 13:15 PDT 2021, Arnd Bergmann wrote:
> > On Mon, Sep 27, 2021 at 9:52 PM Bjorn Andersson 
> >  wrote:
> >
> > An easier option might be to find a way to build QCOM_SCM without
> > RESET_CONTROLLER for compile testing purposes. I don't know
> > what would break from that.
> >
>
> Afaict the reset API is properly stubbed and RESET_CONTROLLER is a bool,
> so I think we can simply drop the "select" and the kernel will still
> compile fine in all combinations.
>
> When it comes to runtime, we currently select RESET_CONTROLLER from the
> Qualcomm common clocks. If that is dropped (why would it...) it seems
> possible to build a custom kernel for msm8916 that we can boot and miss
> the stubbed out "mss restart" reset line from the SCM.
>
>
> So, let's just drop the select RESET_CONTROLLER from SCM for now.

Ok, I've made that change locally, giving it more time on the randconfig
build box now.

   Arnd


Re: [Freedreno] [PATCH] [RFC] qcom_scm: hide Kconfig symbol

2021-09-27 Thread Arnd Bergmann
On Mon, Sep 27, 2021 at 9:52 PM Bjorn Andersson
 wrote:
> On Mon 27 Sep 08:22 PDT 2021, Arnd Bergmann wrote:
> > From: Arnd Bergmann 
> >
> >  - To avoid a circular dependency chain involving RESET_CONTROLLER
> >and PINCTRL_SUNXI, change the 'depends on RESET_CONTROLLER' in
> >the latter one to 'select'.
>
> Can you please help me understand why this is part of the same patch?

This can be done as a preparatory patch if we decide to do it this way,
for the review it seemed better to spell out that this is required.

I still hope that we can avoid adding another 'select RESET_CONTROLLER'
if someone can figure out what to do instead.

The problem here is that QCOM_SCM selects RESET_CONTROLLER,
and turning that into 'depends on' would in turn mean that any driver that
wants to select QCOM_SCM would have to have the same RESET_CONTROLLER
dependency.

An easier option might be to find a way to build QCOM_SCM without
RESET_CONTROLLER for compile testing purposes. I don't know
what would break from that.

 Arnd


[Freedreno] [PATCH] [RFC] qcom_scm: hide Kconfig symbol

2021-09-27 Thread Arnd Bergmann
From: Arnd Bergmann 

Now that SCM can be a loadable module, we have to add another
dependency to avoid link failures when ipa or adreno-gpu are
built-in:

aarch64-linux-ld: drivers/net/ipa/ipa_main.o: in function `ipa_probe':
ipa_main.c:(.text+0xfc4): undefined reference to `qcom_scm_is_available'

ld.lld: error: undefined symbol: qcom_scm_is_available
>>> referenced by adreno_gpu.c
>>>   gpu/drm/msm/adreno/adreno_gpu.o:(adreno_zap_shader_load) in 
>>> archive drivers/built-in.a

This can happen when CONFIG_ARCH_QCOM is disabled and we don't select
QCOM_MDT_LOADER, but some other module selects QCOM_SCM. Ideally we'd
use a similar dependency here to what we have for QCOM_RPROC_COMMON,
but that causes dependency loops from other things selecting QCOM_SCM.

This appears to be an endless problem, so try something different this
time:

 - CONFIG_QCOM_SCM becomes a hidden symbol that nothing 'depends on'
   but that is simply selected by all of its users

 - All the stubs in include/linux/qcom_scm.h can go away

 - arm-smccc.h needs to provide a stub for __arm_smccc_smc() to
   allow compile-testing QCOM_SCM on all architectures.

 - To avoid a circular dependency chain involving RESET_CONTROLLER
   and PINCTRL_SUNXI, change the 'depends on RESET_CONTROLLER' in
   the latter one to 'select'.

The last bit is rather annoying, as drivers should generally never
'select' another subsystem, and about half the users of the reset
controller interface do this anyway.

Nevertheless, this version seems to pass all my randconfig tests
and is more robust than any of the prior versions.

Comments?

Signed-off-by: Arnd Bergmann 
---
 drivers/firmware/Kconfig|  4 +-
 drivers/gpu/drm/msm/Kconfig |  4 +-
 drivers/iommu/Kconfig   |  2 +-
 drivers/media/platform/Kconfig  |  2 +-
 drivers/mmc/host/Kconfig|  2 +-
 drivers/net/ipa/Kconfig |  1 +
 drivers/net/wireless/ath/ath10k/Kconfig |  2 +-
 drivers/pinctrl/qcom/Kconfig|  3 +-
 drivers/pinctrl/sunxi/Kconfig   |  6 +--
 include/linux/arm-smccc.h   | 10 
 include/linux/qcom_scm.h| 71 -
 11 files changed, 23 insertions(+), 84 deletions(-)

diff --git a/drivers/firmware/Kconfig b/drivers/firmware/Kconfig
index 220a58cf0a44..f7dd82ef0b9c 100644
--- a/drivers/firmware/Kconfig
+++ b/drivers/firmware/Kconfig
@@ -203,9 +203,7 @@ config INTEL_STRATIX10_RSU
  Say Y here if you want Intel RSU support.
 
 config QCOM_SCM
-   tristate "Qcom SCM driver"
-   depends on ARM || ARM64
-   depends on HAVE_ARM_SMCCC
+   tristate
select RESET_CONTROLLER
 
 config QCOM_SCM_DOWNLOAD_MODE_DEFAULT
diff --git a/drivers/gpu/drm/msm/Kconfig b/drivers/gpu/drm/msm/Kconfig
index e9c6af78b1d7..3ddf739a6f9b 100644
--- a/drivers/gpu/drm/msm/Kconfig
+++ b/drivers/gpu/drm/msm/Kconfig
@@ -17,7 +17,7 @@ config DRM_MSM
select DRM_SCHED
select SHMEM
select TMPFS
-   select QCOM_SCM if ARCH_QCOM
+   select QCOM_SCM
select WANT_DEV_COREDUMP
select SND_SOC_HDMI_CODEC if SND_SOC
select SYNC_FILE
@@ -55,7 +55,7 @@ config DRM_MSM_GPU_SUDO
 
 config DRM_MSM_HDMI_HDCP
bool "Enable HDMI HDCP support in MSM DRM driver"
-   depends on DRM_MSM && QCOM_SCM
+   depends on DRM_MSM
default y
help
  Choose this option to enable HDCP state machine
diff --git a/drivers/iommu/Kconfig b/drivers/iommu/Kconfig
index 124c41adeca1..989c83acbfee 100644
--- a/drivers/iommu/Kconfig
+++ b/drivers/iommu/Kconfig
@@ -308,7 +308,7 @@ config APPLE_DART
 config ARM_SMMU
tristate "ARM Ltd. System MMU (SMMU) Support"
depends on ARM64 || ARM || (COMPILE_TEST && !GENERIC_ATOMIC64)
-   depends on QCOM_SCM || !QCOM_SCM #if QCOM_SCM=m this can't be =y
+   select QCOM_SCM
select IOMMU_API
select IOMMU_IO_PGTABLE_LPAE
select ARM_DMA_USE_IOMMU if ARM
diff --git a/drivers/media/platform/Kconfig b/drivers/media/platform/Kconfig
index 157c924686e4..80321e03809a 100644
--- a/drivers/media/platform/Kconfig
+++ b/drivers/media/platform/Kconfig
@@ -565,7 +565,7 @@ config VIDEO_QCOM_VENUS
depends on VIDEO_DEV && VIDEO_V4L2 && QCOM_SMEM
depends on (ARCH_QCOM && IOMMU_DMA) || COMPILE_TEST
select QCOM_MDT_LOADER if ARCH_QCOM
-   select QCOM_SCM if ARCH_QCOM
+   select QCOM_SCM
select VIDEOBUF2_DMA_CONTIG
select V4L2_MEM2MEM_DEV
help
diff --git a/drivers/mmc/host/Kconfig b/drivers/mmc/host/Kconfig
index 71313961cc54..95b3511b0560 100644
--- a/drivers/mmc/host/Kconfig
+++ b/drivers/mmc/host/Kconfig
@@ -547,7 +547,7 @@ config MMC_SDHCI_MSM
depends on MMC_SDHCI_PLTFM
select MMC_SDHCI_IO_ACCESSORS
select MMC_CQHCI
-   select QCOM_SCM if MMC_CRYPTO &&am

[Freedreno] [PATCH] drm/msm/submit: fix overflow check on 64-bit architectures

2021-09-27 Thread Arnd Bergmann
From: Arnd Bergmann 

The overflow check does causes a warning from clang-14 when 'sz' is a type
that is smaller than size_t:

drivers/gpu/drm/msm/msm_gem_submit.c:217:10: error: result of comparison of 
constant 18446744073709551615 with expression of type 'unsigned int' is always 
false [-Werror,-Wtautological-constant-out-of-range-compare]
if (sz == SIZE_MAX) {

Change the type accordingly.

Fixes: 20224d715a88 ("drm/msm/submit: Move copy_from_user ahead of locking bos")
Signed-off-by: Arnd Bergmann 
---
 drivers/gpu/drm/msm/msm_gem_submit.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/msm/msm_gem_submit.c 
b/drivers/gpu/drm/msm/msm_gem_submit.c
index fdc5367aecaa..ac23bbdb0bab 100644
--- a/drivers/gpu/drm/msm/msm_gem_submit.c
+++ b/drivers/gpu/drm/msm/msm_gem_submit.c
@@ -171,7 +171,8 @@ static int submit_lookup_objects(struct msm_gem_submit 
*submit,
 static int submit_lookup_cmds(struct msm_gem_submit *submit,
struct drm_msm_gem_submit *args, struct drm_file *file)
 {
-   unsigned i, sz;
+   unsigned i;
+   size_t sz;
int ret = 0;
 
for (i = 0; i < args->nr_cmds; i++) {
-- 
2.29.2



Re: [Freedreno] [PATCH] drm/msm: Avoid potential overflow in timeout_to_jiffies()

2021-09-17 Thread Arnd Bergmann
On Fri, Sep 17, 2021 at 2:59 AM Marek Vasut  wrote:
>
> The return type of ktime_divns() is s64. The timeout_to_jiffies() currently
> assigns the result of this ktime_divns() to unsigned long, which on 32 bit
> systems may overflow. Furthermore, the result of this function is sometimes
> also passed to functions which expect signed long, dma_fence_wait_timeout()
> is one such example.
>
> Fix this by adjusting the type of remaining_jiffies to s64, so we do not
> suffer overflow there, and return a value limited to range of 0..INT_MAX,
> which is safe for all usecases of this timeout.
>
> The above overflow can be triggered if userspace passes in too large timeout
> value, larger than INT_MAX / HZ seconds. The kernel detects it and complains
> about "schedule_timeout: wrong timeout value %lx" and generates a warning
> backtrace.
>
> Note that this fixes commit 6cedb8b377bb ("drm/msm: avoid using 'timespec'"),
> because the previously used timespec_to_jiffies() function returned unsigned
> long instead of s64:
> static inline unsigned long timespec_to_jiffies(const struct timespec *value)
>
> Fixes: 6cedb8b377bb ("drm/msm: avoid using 'timespec'")
> Signed-off-by: Marek Vasut 
> Cc: Arnd Bergmann 
> Cc: Jordan Crouse 
> Cc: Rob Clark 
> Cc: sta...@vger.kernel.org # 5.6+
> ---

Acked-by: Arnd Bergmann 


Re: [Freedreno] [PATCH] drm/msm/gpu: fix link failure with QCOM_SCM=m

2021-08-04 Thread Arnd Bergmann
On Mon, Aug 2, 2021 at 4:53 PM Arnd Bergmann  wrote:
>
> From: Arnd Bergmann 
>
> Another missed dependency when SCM is a loadable module
> and adreno is built-in:
>
> drivers/gpu/drm/msm/adreno/adreno_gpu.o: In function `adreno_zap_shader_load':
> adreno_gpu.c:(.text+0x1e8): undefined reference to `qcom_scm_is_available'
> drivers/gpu/drm/msm/adreno/a5xx_gpu.o: In function `a5xx_hw_init':
> a5xx_gpu.c:(.text+0x28a6): undefined reference to `qcom_scm_set_remote_state'
>
> Change it so the dependency on QCOM_SCM and QCOM_MDT_LOADER can be
> ignored if we are not building for ARCH_QCOM, but prevent the
> link error during compile testing when SCM is a loadable module
> and ARCH_QCOM is disabled.
>
> Fixes: a9e2559c931d ("drm/msm/gpu: Move zap shader loading to adreno")
> Fixes: 5ea4dba68305 ("drm/msm/a6xx: add CONFIG_QCOM_LLCC dependency")
> Signed-off-by: Arnd Bergmann 

Oh, this is still wrong, for two reasons:

> ---
>  drivers/gpu/drm/msm/Kconfig | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/gpu/drm/msm/Kconfig b/drivers/gpu/drm/msm/Kconfig
> index 52536e7adb95..69fbfe4568b2 100644
> --- a/drivers/gpu/drm/msm/Kconfig
> +++ b/drivers/gpu/drm/msm/Kconfig
> @@ -9,14 +9,14 @@ config DRM_MSM
> depends on QCOM_OCMEM || QCOM_OCMEM=n
> depends on QCOM_LLCC || QCOM_LLCC=n
> depends on QCOM_COMMAND_DB || QCOM_COMMAND_DB=n
> +   depends on QCOM_SCM || (QCOM_SCM=n && ARCH_QCOM=n)
> +   depends on QCOM_MDT_LOADER || ARCH_QCOM=n

* Only QCOM_SCM has become user-selectable, but QCOM_MDT_LOADER
   is still meant to only be selected by its users, so we cannot depend on it
   here

* There are two other drivers that have the broken 'select QCOM_SCM if
   ARCH_QCOM', we have to fix them all at once.

 Arnd


[Freedreno] [PATCH] drm/msm/gpu: fix link failure with QCOM_SCM=m

2021-08-02 Thread Arnd Bergmann
From: Arnd Bergmann 

Another missed dependency when SCM is a loadable module
and adreno is built-in:

drivers/gpu/drm/msm/adreno/adreno_gpu.o: In function `adreno_zap_shader_load':
adreno_gpu.c:(.text+0x1e8): undefined reference to `qcom_scm_is_available'
drivers/gpu/drm/msm/adreno/a5xx_gpu.o: In function `a5xx_hw_init':
a5xx_gpu.c:(.text+0x28a6): undefined reference to `qcom_scm_set_remote_state'

Change it so the dependency on QCOM_SCM and QCOM_MDT_LOADER can be
ignored if we are not building for ARCH_QCOM, but prevent the
link error during compile testing when SCM is a loadable module
and ARCH_QCOM is disabled.

Fixes: a9e2559c931d ("drm/msm/gpu: Move zap shader loading to adreno")
Fixes: 5ea4dba68305 ("drm/msm/a6xx: add CONFIG_QCOM_LLCC dependency")
Signed-off-by: Arnd Bergmann 
---
 drivers/gpu/drm/msm/Kconfig | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/msm/Kconfig b/drivers/gpu/drm/msm/Kconfig
index 52536e7adb95..69fbfe4568b2 100644
--- a/drivers/gpu/drm/msm/Kconfig
+++ b/drivers/gpu/drm/msm/Kconfig
@@ -9,14 +9,14 @@ config DRM_MSM
depends on QCOM_OCMEM || QCOM_OCMEM=n
depends on QCOM_LLCC || QCOM_LLCC=n
depends on QCOM_COMMAND_DB || QCOM_COMMAND_DB=n
+   depends on QCOM_SCM || (QCOM_SCM=n && ARCH_QCOM=n)
+   depends on QCOM_MDT_LOADER || ARCH_QCOM=n
select IOMMU_IO_PGTABLE
-   select QCOM_MDT_LOADER if ARCH_QCOM
select REGULATOR
select DRM_KMS_HELPER
select DRM_PANEL
select SHMEM
select TMPFS
-   select QCOM_SCM if ARCH_QCOM
select WANT_DEV_COREDUMP
select SND_SOC_HDMI_CODEC if SND_SOC
select SYNC_FILE
-- 
2.29.2



[Freedreno] [PATCH] drm/msm/dsi: fix 32-bit clang warning

2021-05-14 Thread Arnd Bergmann
From: Arnd Bergmann 

clang is a little overzealous with warning about a constant conversion
in an untaken branch of a ternary expression:

drivers/gpu/drm/msm/dsi/phy/dsi_phy_7nm.c:975:48: error: implicit conversion 
from 'unsigned long long' to 'unsigned long' changes value from 50 to 
705032704 [-Werror,-Wconstant-conversion]
.max_pll_rate = (50ULL < ULONG_MAX) ? 50UL : ULONG_MAX,
  ^~~~

Rewrite this to use a preprocessor conditional instead to avoid the
warning.

Fixes: 076437c9e360 ("drm/msm/dsi: move min/max PLL rate to phy config")
Signed-off-by: Arnd Bergmann 
---
As found with another patch, using __builtin_choose_expr() would
likely also work here, but doesn't seem any more readable.
---
 drivers/gpu/drm/msm/dsi/phy/dsi_phy_7nm.c | 6 +-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/msm/dsi/phy/dsi_phy_7nm.c 
b/drivers/gpu/drm/msm/dsi/phy/dsi_phy_7nm.c
index e76ce40a12ab..accd6b4eb7c2 100644
--- a/drivers/gpu/drm/msm/dsi/phy/dsi_phy_7nm.c
+++ b/drivers/gpu/drm/msm/dsi/phy/dsi_phy_7nm.c
@@ -972,7 +972,11 @@ const struct msm_dsi_phy_cfg dsi_phy_7nm_cfgs = {
.restore_pll_state = dsi_7nm_pll_restore_state,
},
.min_pll_rate = 6UL,
-   .max_pll_rate = (50ULL < ULONG_MAX) ? 50ULL : ULONG_MAX,
+#ifdef CONFIG_64BIT
+   .max_pll_rate = 50UL,
+#else
+   .max_pll_rate = ULONG_MAX,
+#endif
.io_start = { 0xae94400, 0xae96400 },
.num_dsi_phy = 2,
.quirks = DSI_PHY_7NM_QUIRK_V4_1,
-- 
2.29.2

___
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno


[Freedreno] [PATCH] drm/msm/a6xx: add CONFIG_QCOM_LLCC dependency

2021-01-03 Thread Arnd Bergmann
From: Arnd Bergmann 

When LLCC support is in a loadable module, the adreno support
cannot be built-in:

aarch64-linux-ld: drivers/gpu/drm/msm/adreno/a6xx_gpu.o: in function 
`a6xx_gpu_init':
a6xx_gpu.c:(.text+0xe0): undefined reference to `llcc_slice_getd'
a6xx_gpu.c:(.text+0xe0): relocation truncated to fit: R_AARCH64_CALL26 against 
undefined symbol `llcc_slice_getd'
aarch64-linux-ld: a6xx_gpu.c:(.text+0xec): undefined reference to 
`llcc_slice_getd'
a6xx_gpu.c:(.text+0xec): relocation truncated to fit: R_AARCH64_CALL26 against 
undefined symbol `llcc_slice_getd'
aarch64-linux-ld: drivers/gpu/drm/msm/adreno/a6xx_gpu.o: in function 
`a6xx_destroy':
a6xx_gpu.c:(.text+0x274): undefined reference to `llcc_slice_putd'
a6xx_gpu.c:(.text+0x274): relocation truncated to fit: R_AARCH64_CALL26 against 
undefined symbol `llcc_slice_putd'
aarch64-linux-ld: a6xx_gpu.c:(.text+0x27c): undefined reference to 
`llcc_slice_putd'

Add a Kconfig dependency that disallows the broken configuration
but allows all working ones.

Fixes: 474dadb8b0d5 ("drm/msm/a6xx: Add support for using system cache(LLC)")
Signed-off-by: Arnd Bergmann 
---
 drivers/gpu/drm/msm/Kconfig | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/msm/Kconfig b/drivers/gpu/drm/msm/Kconfig
index dabb4a1ccdcf..b8e02859fd92 100644
--- a/drivers/gpu/drm/msm/Kconfig
+++ b/drivers/gpu/drm/msm/Kconfig
@@ -7,6 +7,8 @@ config DRM_MSM
depends on IOMMU_SUPPORT
depends on OF && COMMON_CLK
depends on QCOM_OCMEM || QCOM_OCMEM=n
+   depends on QCOM_LLCC || QCOM_LLCC=n
+   depends on QCOM_COMMAND_DB || QCOM_COMMAND_DB=n
select IOMMU_IO_PGTABLE
select QCOM_MDT_LOADER if ARCH_QCOM
select REGULATOR
@@ -15,7 +17,6 @@ config DRM_MSM
select SHMEM
select TMPFS
select QCOM_SCM if ARCH_QCOM
-   select QCOM_COMMAND_DB if ARCH_QCOM
select WANT_DEV_COREDUMP
select SND_SOC_HDMI_CODEC if SND_SOC
select SYNC_FILE
-- 
2.29.2

___
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno


[Freedreno] [PATCH] drm/msm: add IOMMU_SUPPORT dependency

2020-12-03 Thread Arnd Bergmann
From: Arnd Bergmann 

The iommu pgtable support is only available when IOMMU support
is built into the kernel:

WARNING: unmet direct dependencies detected for IOMMU_IO_PGTABLE
  Depends on [n]: IOMMU_SUPPORT [=n]
  Selected by [y]:
  - DRM_MSM [=y] && HAS_IOMEM [=y] && DRM [=y] && (ARCH_QCOM [=y] || SOC_IMX5 
|| ARM && COMPILE_TEST [=y]) && OF [=y] && COMMON_CLK [=y] && MMU [=y] && 
(QCOM_OCMEM [=y] || QCOM_OCMEM [=y]=n)

Fix the dependency accordingly. There is no need for depending on
CONFIG_MMU any more, as that is implied by the iommu support.

Fixes: b145c6e65eb0 ("drm/msm: Add support to create a local pagetable")
Signed-off-by: Arnd Bergmann 
---
 drivers/gpu/drm/msm/Kconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/msm/Kconfig b/drivers/gpu/drm/msm/Kconfig
index e5816b498494..dabb4a1ccdcf 100644
--- a/drivers/gpu/drm/msm/Kconfig
+++ b/drivers/gpu/drm/msm/Kconfig
@@ -4,8 +4,8 @@ config DRM_MSM
tristate "MSM DRM"
depends on DRM
depends on ARCH_QCOM || SOC_IMX5 || (ARM && COMPILE_TEST)
+   depends on IOMMU_SUPPORT
depends on OF && COMMON_CLK
-   depends on MMU
depends on QCOM_OCMEM || QCOM_OCMEM=n
select IOMMU_IO_PGTABLE
select QCOM_MDT_LOADER if ARCH_QCOM
-- 
2.27.0

___
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno


[Freedreno] [PATCH 3/4] drm/msm: fix -Woverride-init warning

2020-10-26 Thread Arnd Bergmann
From: Arnd Bergmann 

There is one harmless duplicate initialization that causes a warning
with 'make W=1':

drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c:122:19: warning: initialized 
field overwritten [-Woverride-init]
  122 |  .max_linewidth = 4096,
  |   ^~~~
drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c:122:19: note: (near 
initialization for 'sm8250_dpu_caps.max_linewidth')

Remove one of the two identical initializers to avoid the warning.

Fixes: af776a3e1c30 ("drm/msm/dpu: add SM8250 to hw catalog")
Signed-off-by: Arnd Bergmann 
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c
index 60b304b72b7c..9c23f814ccaf 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c
@@ -111,7 +111,6 @@ static const struct dpu_caps sm8150_dpu_caps = {
 static const struct dpu_caps sm8250_dpu_caps = {
.max_mixer_width = DEFAULT_DPU_OUTPUT_LINE_WIDTH,
.max_mixer_blendstages = 0xb,
-   .max_linewidth = 4096,
.qseed_type = DPU_SSPP_SCALER_QSEED3, /* TODO: qseed3 lite */
.smart_dma_rev = DPU_SSPP_SMART_DMA_V2, /* TODO: v2.5 */
.ubwc_version = DPU_HW_UBWC_VER_40,
-- 
2.27.0

___
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno


Re: [Freedreno] stable-rc 4.14: arm64: Internal error: Oops: clk_reparent __clk_set_parent_before on db410c

2020-07-21 Thread Arnd Bergmann
On Tue, Jul 21, 2020 at 10:32 AM Naresh Kamboju
 wrote:
>
> Kernel Internal oops while booting stable-rc 4.14 kernel on qcom db410c device
> this problem happened only once on this specific platform.
> and  rcu_preempt detected stalls on CPUs/tasks detected after this and
> board hung.
>
> metadata:
>   git branch: linux-4.14.y
>   git repo: 
> https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
>   git commit: 5b1e982af0f810358664827a6333affb4f5d8eb5
>   git describe: v4.14.188-126-g5b1e982af0f8
>   make_kernelversion: 4.14.189-rc1
>   kernel-config:
> https://builds.tuxbuild.com/12PM71zBW-5EAp5ztC_yxg/kernel.config

I looked at the object file at
https://builds.tuxbuild.com/12PM71zBW-5EAp5ztC_yxg/vmlinux.xz

> Crash dump:
>
> [5.424958] Unable to handle kernel paging request at virtual
> address 1008
> [5.435485] Mem abort info:
> [5.442509]   Exception class = DABT (current EL), IL = 32 bits
> [5.445203]   SET = 0, FnV = 0
> [[5.451101]   EA = 0, S1PTW =[5.454226] Data abort info:
> [5.457264]   ISV = 0, ISS = 0x0044
> [5.460390]   CM = 0, WnR = 1
> [5.463951] user pgtable: 4k pages, 48-bit VAs, pgd = 80003d66d000
> [5.467078] [1008] *pgd=
> [5.473503] Internal error: Oops: 9644 [#1] PREEMPT SMP
> [5.479838] Modules linked in: adv7511 msm mdt_loader msm_rng
> drm_kms_helper rng_core drm fuse
> [5.485405] Process kworker/2:0 (pid: 21, stack limit = 0x0945)
> [5.494090] CPU: 2 PID: 21 Comm: kworker/2:0 Not tainted 4.14.189-rc1 #1
> [5.501036] Hardware name: Qualcomm Technologies, Inc. APQ 8016 SBC (DT)
> [5.507996] Workqueue: events deferred_probe_work_func
> [5.514935] task: 80003d454380 task.stack: 0945
> [5.520155] pc : clk_reparent+0x60/0xe8
> [5.526058] lr : __clk_set_parent_before+0x40/0x88
> [5.529882] sp : 09453640 pstate : 81c5
> [5.534748] x29: 09453640 x28: 090b7000
> [5.539615] x27: 80003fe7c478 x26: 094537a8
> [5.545175] x25: 0001 x24: 09239038
> [5.550736] x23: 80003b6be688 x22: 
> [5.556297] x21:  x20: 80003c9d8c00
> [5.561858] x19: 80003d798900 x18: fffe
> [5.567419] x17: 7fdbb6a0 x16: 0821ad98
> [5.572980] x15: 0001 x14: 
> [5.578540] x13: 094537c8 x12: 0010
> [5.584102] x11: 0010 x10: 0101010101010101
> [5.589663] x9 :  x8 : 7f7f7f7f7f7f7f7f
> [5.595223] x7 : fefefefefeff6e77 x6 : 0140
> [5.600784] x5 : 0001 x4 : 80003c9d8c00
> [5.606344] x3 : 80003d798900 x2 : 0004
> [5.611905] x1 : 80003d7989a8 x0 : 1000
> [5.617467] Call trace:
> [5.623030]  clk_reparent+0x60/0xe8

We are here:

static void clk_reparent(struct clk_core *core, struct clk_core *new_parent)
{
bool was_orphan = core->orphan;

hlist_del(>child_node);

if (new_parent) {
bool becomes_orphan = new_parent->orphan;

/* avoid duplicate POST_RATE_CHANGE notifications */
if (new_parent->new_child == core)
new_parent->new_child = NULL;

hlist_add_head(>child_node, _parent->children);


and "new_parent->children.first" points to 0x1000, which is not
a valid pointer, so the "first->pprev = >next" in hlist_add_head()
causes a crash.

> [5.625465]  __clk_set_parent_before+0x40/0x88
> [5.628943]  clk_register+0x330/0x618

(speculation) the most likely call chain here would be __clk_core_init(),
implying that there is some random other orphan clock that has a
broken parent:

/*
 * walk the list of orphan clocks and reparent any that newly finds a
 * parent.
 */
hlist_for_each_entry_safe(orphan, tmp2, _orphan_list, child_node) {
struct clk_core *parent = __clk_init_parent(orphan);

/*
 * We need to use __clk_set_parent_before() and _after() to
 * to properly migrate any prepare/enable count of the orphan
 * clock. This is important for CLK_IS_CRITICAL clocks, which
 * are enabled during init but might not have a parent yet.
 */
if (parent) {
/* update the clk tree topology */
__clk_set_parent_before(orphan, parent);

None of the above have changed in stable kernels.

> [5.633668]  pll_28nm_register+0xa4/0x340 [msm]
> [5.637492]  msm_dsi_pll_28nm_init+0xc8/0x1d8 [msm]
> [5.642007]  msm_dsi_pll_init+0x34/0xe0 [msm]
> [5.646870]  dsi_phy_driver_probe+0x1cc/0x310 [msm]

The only changes to the dsi driver in v4.14-stable were:

89e30bb46074 drm/msm/dsi: save pll state before dsi host is powered 

Re: [Freedreno] arm64: Internal error: Oops: qcom_iommu_tlb_inv_context free_io_pgtable_ops on db410c

2020-07-20 Thread Arnd Bergmann
On Mon, Jul 20, 2020 at 8:36 AM Naresh Kamboju
 wrote:
>
> This kernel oops while boot linux mainline kernel on arm64  db410c device.
>
> metadata:
>   git branch: master
>   git repo: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
>   git commit: f8456690ba8eb18ea4714e68554e242a04f65cff
>   git describe: v5.8-rc5-48-gf8456690ba8e
>   make_kernelversion: 5.8.0-rc5
>   kernel-config:
> https://builds.tuxbuild.com/2aLnwV7BLStU0t1R1QPwHQ/kernel.config

Thanks for the report. Adding freedreno folks to Cc, as this may have something
to do with that driver.

>
> [5.444121] Unable to handle kernel NULL pointer dereference at
> virtual address 0018
> [5.456615]   ESR = 0x9604
> [5.464471]   SET = 0, FnV = 0
> [5.464487]   EA = 0, S1PTW = 0
> [5.466521] Data abort info:
> [5.469971]   ISV = 0, ISS = 0x0004
> [5.472768]   CM = 0, WnR = 0
> [5.476172] user pgtable: 4k pages, 48-bit VAs, pgdp=bacba000
> [5.479349] [0018] pgd=, p4d=
> [5.485820] Internal error: Oops: 9604 [#1] PREEMPT SMP
> [5.492448] Modules linked in: crct10dif_ce adv7511(+)
> qcom_spmi_temp_alarm cec msm(+) mdt_loader qcom_camss videobuf2_dma_sg
> drm_kms_helper v4l2_fwnode videobuf2_memops videobuf2_v4l2 qcom_rng
> videobuf2_common i2c_qcom_cci display_connector socinfo drm qrtr ns
> rmtfs_mem fuse
> [5.500256] CPU: 0 PID: 286 Comm: systemd-udevd Not tainted 5.8.0-rc5 #1
> [5.522484] Hardware name: Qualcomm Technologies, Inc. APQ 8016 SBC (DT)
> [5.529170] pstate: 2005 (nzCv daif -PAN -UAO BTYPE=--)
> [5.535856] pc : qcom_iommu_tlb_inv_context+0x18/0xa8
> [5.541148] lr : free_io_pgtable_ops+0x28/0x58
> [5.546350] sp : 80001219b5f0
> [5.550689] x29: 80001219b5f0 x28: 0013
> [5.554078] x27: 0100 x26: 36add3b8
> [5.559459] x25: 8915e910 x24: 3a5458c0
> [5.564753] x23: 0003 x22: 36a37058
> [5.570049] x21: 36a3a100 x20: 36a3a480
> [5.575344] x19: 36a37158 x18: 
> [5.580639] x17:  x16: 
> [5.585935] x15: 0004 x14: 0368
> [5.591229] x13:  x12: 39c61798
> [5.596525] x11: 39c616d0 x10: 4000
> [5.601820] x9 :  x8 : 39c616f8
> [5.607114] x7 :  x6 : 09f699a0
> [5.612410] x5 : 80001219b520 x4 : 36a3a000
> [5.617705] x3 : 09f69904 x2 : 
> [5.623001] x1 : 8000107e27e8 x0 : 3a545810
> [5.628297] Call trace:
> [5.633592]  qcom_iommu_tlb_inv_context+0x18/0xa8

This means that dev_iommu_fwspec_get() has returned NULL
in qcom_iommu_tlb_inv_context(), either because dev->iommu
is NULL, or because dev->iommu->fwspec is NULL.

qcom_iommu_tlb_inv_context() does not check for a NULL
pointer before using the returned object.

The bug is either in the lack of error handling, or the fact
that it's possible to get into this function for a device
that has not been fully set up.

> [5.635764]  free_io_pgtable_ops+0x28/0x58
> [5.640624]  qcom_iommu_domain_free+0x38/0x60
> [5.644617]  iommu_group_release+0x4c/0x70
> [5.649045]  kobject_put+0x6c/0x120
> [5.653035]  kobject_del+0x64/0x90
> [5.656421]  kobject_put+0xfc/0x120
> [5.659893]  iommu_group_remove_device+0xdc/0xf0
> [5.663281]  iommu_release_device+0x44/0x70
> [5.668142]  iommu_bus_notifier+0xbc/0xd0
> [5.672048]  notifier_call_chain+0x54/0x98
> [5.676214]  blocking_notifier_call_chain+0x48/0x70
> [5.680209]  device_del+0x26c/0x3a0
> [5.684981]  platform_device_del.part.0+0x1c/0x88
> [5.688453]  platform_device_unregister+0x24/0x40
> [5.693316]  of_platform_device_destroy+0xe4/0xf8
> [5.698002]  device_for_each_child+0x5c/0xa8
> [5.702689]  of_platform_depopulate+0x3c/0x80
> [5.707144]  msm_pdev_probe+0x1c4/0x308 [msm]

It was triggered by a failure in msm_pdev_probe(), which was
calls of_platform_depopulate() in its error handling code.
This is a combination of two problems:

a) Whatever caused msm_pdev_probe() to fail means that
the gpu won't be usable, though it should not have caused the
kernel to crash.

b) the error handling itself causing additional problems due
to failed unwinding.

> [5.711286]  platform_drv_probe+0x54/0xa8
> [5.715624]  really_probe+0xd8/0x320
> [5.719617]  driver_probe_device+0x58/0xb8
> [5.723263]  device_driver_attach+0x74/0x80
> [5.727168]  __driver_attach+0x58/0xe0
> [5.731248]  bus_for_each_dev+0x70/0xc0
> [5.735067]  driver_attach+0x24/0x30
> [5.738801]  bus_add_driver+0x14c/0x1f0
> [5.742619]  driver_register+0x64/0x120
> [5.746178]  __platform_driver_register+0x48/0x58
> [5.750099]  msm_drm_register+0x58/0x70 [msm]
> [5.754861]  

[Freedreno] [PATCH] drm/msm: fix link error without CONFIG_DEBUG_FS

2020-04-08 Thread Arnd Bergmann
I ran into a randconfig link error with debugfs disabled:

arm-linux-gnueabi-ld:
drivers/gpu/drm/msm/msm_gpu.o: in function `should_dump': 
msm_gpu.c:(.text+0x1cc): undefined reference to `rd_full'

Change the helper to only look at this variable if debugfs is present.

Fixes: e515af8d4a6f ("drm/msm: devcoredump should dump MSM_SUBMIT_BO_DUMP 
buffers")
Signed-off-by: Arnd Bergmann 
---
 drivers/gpu/drm/msm/msm_gem.h | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/msm/msm_gem.h b/drivers/gpu/drm/msm/msm_gem.h
index 30584eaf8cc8..eb4aeaf291ea 100644
--- a/drivers/gpu/drm/msm/msm_gem.h
+++ b/drivers/gpu/drm/msm/msm_gem.h
@@ -167,7 +167,10 @@ static inline bool
 should_dump(struct msm_gem_submit *submit, int idx)
 {
extern bool rd_full;
-   return rd_full || (submit->bos[idx].flags & MSM_SUBMIT_BO_DUMP);
+   if (IS_ENABLED(CONFIG_DEBUG_FS) && rd_full)
+   return true;
+
+   return submit->bos[idx].flags & MSM_SUBMIT_BO_DUMP;
 }
 
 #endif /* __MSM_GEM_H__ */
-- 
2.26.0

___
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno


[Freedreno] [PATCH v2 00/24] drivers, fs: y2038 updates

2019-12-13 Thread Arnd Bergmann
These are updates to devidce drivers and file systems that for some
reason or another were not included in the kernel in the previous
y2038 series.

I've gone through all users of time_t again to make sure the
kernel is in a long-term maintainable state.

Posting these as a series for better organization, but each change
here is applicable standalone.

Please merge, review, ack/nack etc as you see fit. I will
add these to my y2038 branch [1] for linux-next, but can keep
rebasing for feedback and to remove any patches that get
picked up by a maintainer.

Changes since v1 [2]:

- Add Acks I received
- Rebase to v5.5-rc1, droping patches that got merged already
- Add NFS, XFS and the final three patches from another series
- Rewrite etnaviv patches

  Arnd

[1] 
https://git.kernel.org/pub/scm/linux/kernel/git/arnd/playground.git/log/?h=y2038
[2] https://lore.kernel.org/lkml/20191108213257.3097633-1-a...@arndb.de/

Arnd Bergmann (24):
  Input: input_event: fix struct padding on sparc64
  fat: use prandom_u32() for i_generation
  dlm: use SO_SNDTIMEO_NEW instead of SO_SNDTIMEO_OLD
  xtensa: ISS: avoid struct timeval
  um: ubd: use 64-bit time_t where possible
  acct: stop using get_seconds()
  tsacct: add 64-bit btime field
  packet: clarify timestamp overflow
  quota: avoid time_t in v1_disk_dqblk definition
  hostfs: pass 64-bit timestamps to/from user space
  hfs/hfsplus: use 64-bit inode timestamps
  drm/msm: avoid using 'timespec'
  drm/etnaviv: reject timeouts with tv_nsec >= NSEC_PER_SEC
  drm/etnaviv: avoid deprecated timespec
  sunrpc: convert to time64_t for expiry
  nfs: use time64_t internally
  nfs: fix timstamp debug prints
  nfs: fscache: use timespec64 in inode auxdata
  xfs: rename compat_time_t to old_time32_t
  xfs: disallow broken ioctls without compat-32-bit-time
  xfs: quota: move to time64_t interfaces
  y2038: remove obsolete jiffies conversion functions
  y2038: rename itimerval to __kernel_old_itimerval
  y2038: sparc: remove use of struct timex

 arch/sparc/kernel/sys_sparc_64.c  | 29 +-
 arch/um/drivers/cow.h |  2 +-
 arch/um/drivers/cow_user.c|  7 ++-
 arch/um/drivers/ubd_kern.c| 10 ++--
 arch/um/include/shared/os.h   |  2 +-
 arch/um/os-Linux/file.c   |  2 +-
 .../platforms/iss/include/platform/simcall.h  |  4 +-
 drivers/gpu/drm/etnaviv/etnaviv_drv.c | 20 ---
 drivers/gpu/drm/etnaviv/etnaviv_drv.h | 11 ++--
 drivers/gpu/drm/etnaviv/etnaviv_gem.c |  4 +-
 drivers/gpu/drm/etnaviv/etnaviv_gem.h |  2 +-
 drivers/gpu/drm/etnaviv/etnaviv_gpu.c |  5 +-
 drivers/gpu/drm/etnaviv/etnaviv_gpu.h |  5 +-
 drivers/gpu/drm/msm/msm_drv.h |  3 +-
 drivers/input/evdev.c | 14 ++---
 drivers/input/misc/uinput.c   | 14 +++--
 fs/dlm/lowcomms.c |  6 +-
 fs/fat/inode.c|  3 +-
 fs/hfs/hfs_fs.h   | 28 +++--
 fs/hfs/inode.c|  4 +-
 fs/hfsplus/hfsplus_fs.h   | 28 +++--
 fs/hfsplus/inode.c| 12 ++--
 fs/hostfs/hostfs.h| 22 ---
 fs/hostfs/hostfs_kern.c   | 15 +++--
 fs/nfs/fscache-index.c|  6 +-
 fs/nfs/fscache.c  | 18 --
 fs/nfs/fscache.h  |  8 ++-
 fs/nfs/nfs4xdr.c  | 10 ++--
 fs/quota/quotaio_v1.h |  6 +-
 fs/xfs/xfs_dquot.c|  6 +-
 fs/xfs/xfs_ioctl.c| 26 +
 fs/xfs/xfs_ioctl32.c  |  2 +-
 fs/xfs/xfs_ioctl32.h  |  2 +-
 fs/xfs/xfs_qm.h   |  6 +-
 fs/xfs/xfs_quotaops.c |  6 +-
 fs/xfs/xfs_trans_dquot.c  |  8 ++-
 include/linux/jiffies.h   | 20 ---
 include/linux/sunrpc/cache.h  | 42 --
 include/linux/sunrpc/gss_api.h|  4 +-
 include/linux/sunrpc/gss_krb5.h   |  2 +-
 include/linux/syscalls.h  |  9 ++-
 include/uapi/linux/acct.h |  2 +
 include/uapi/linux/input.h|  1 +
 include/uapi/linux/taskstats.h|  6 +-
 include/uapi/linux/time_types.h   |  5 ++
 include/uapi/linux/timex.h|  2 +
 kernel/acct.c |  4 +-
 kernel/time/itimer.c  | 18 +++---
 kernel/time/time.c| 58 ++-
 kernel/tsacct.c   |  9 ++-
 net/packet/af_packet.c| 27 +
 net/sunrpc/auth_gss/gss_krb5_mech.c   | 12 +++-
 net/sunrpc/auth_

[Freedreno] [PATCH v2 12/24] drm/msm: avoid using 'timespec'

2019-12-13 Thread Arnd Bergmann
The timespec structure and associated interfaces are deprecated and will
be removed in the future because of the y2038 overflow.

The use of ktime_to_timespec() in timeout_to_jiffies() does not
suffer from that overflow, but is easy to avoid by just converting
the ktime_t into jiffies directly.

Reviewed-by: Jordan Crouse 
Signed-off-by: Arnd Bergmann 
---
 drivers/gpu/drm/msm/msm_drv.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h
index 71547e756e29..740bf7c70d8f 100644
--- a/drivers/gpu/drm/msm/msm_drv.h
+++ b/drivers/gpu/drm/msm/msm_drv.h
@@ -454,8 +454,7 @@ static inline unsigned long timeout_to_jiffies(const 
ktime_t *timeout)
remaining_jiffies = 0;
} else {
ktime_t rem = ktime_sub(*timeout, now);
-   struct timespec ts = ktime_to_timespec(rem);
-   remaining_jiffies = timespec_to_jiffies();
+   remaining_jiffies = ktime_divns(rem, NSEC_PER_SEC / HZ);
}
 
return remaining_jiffies;
-- 
2.20.0

___
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno


[Freedreno] [PATCH 00/16] drivers: y2038 updates

2019-11-08 Thread Arnd Bergmann
These are updates to devidce drivers and file systems that for some
reason or another were not included in the kernel in the previous
y2038 series.

I've gone through all users of time_t again to make sure the
kernel is in a long-term maintainable state.

Posting these as a series for better organization, but each change
here is applicable standalone.

Please merge, review, ack/nack etc as you see fit. My plan is to
include any patches that don't get a reply this time around in
a future pull request, probably for linux-5.6.

As mentioned before, the full series of 90 patches is available at
https://git.kernel.org/pub/scm/linux/kernel/git/arnd/playground.git/log/?h=y2038-endgame

Arnd

Arnd Bergmann (16):
  staging: exfat: use prandom_u32() for i_generation
  fat: use prandom_u32() for i_generation
  net: sock: use __kernel_old_timespec instead of timespec
  dlm: use SO_SNDTIMEO_NEW instead of SO_SNDTIMEO_OLD
  xtensa: ISS: avoid struct timeval
  um: ubd: use 64-bit time_t where possible
  acct: stop using get_seconds()
  tsacct: add 64-bit btime field
  netfilter: nft_meta: use 64-bit time arithmetic
  packet: clarify timestamp overflow
  quota: avoid time_t in v1_disk_dqblk definition
  hostfs: pass 64-bit timestamps to/from user space
  hfs/hfsplus: use 64-bit inode timestamps
  drm/msm: avoid using 'timespec'
  drm/etnaviv: use ktime_t for timeouts
  firewire: ohci: stop using get_seconds() for BUS_TIME

 arch/um/drivers/cow.h |  2 +-
 arch/um/drivers/cow_user.c|  7 +++--
 arch/um/drivers/ubd_kern.c| 10 +++
 arch/um/include/shared/os.h   |  2 +-
 arch/um/os-Linux/file.c   |  2 +-
 .../platforms/iss/include/platform/simcall.h  |  4 +--
 drivers/firewire/ohci.c   |  2 +-
 drivers/gpu/drm/etnaviv/etnaviv_drv.c | 19 ++---
 drivers/gpu/drm/etnaviv/etnaviv_drv.h | 21 ++
 drivers/gpu/drm/etnaviv/etnaviv_gem.c |  5 ++--
 drivers/gpu/drm/etnaviv/etnaviv_gem.h |  2 +-
 drivers/gpu/drm/etnaviv/etnaviv_gpu.c |  4 +--
 drivers/gpu/drm/etnaviv/etnaviv_gpu.h |  4 +--
 drivers/gpu/drm/msm/msm_drv.h |  3 +-
 drivers/staging/exfat/exfat_super.c   |  4 +--
 fs/dlm/lowcomms.c |  6 ++--
 fs/fat/inode.c|  3 +-
 fs/hfs/hfs_fs.h   | 26 +
 fs/hfs/inode.c|  4 +--
 fs/hfsplus/hfsplus_fs.h   | 26 +
 fs/hfsplus/inode.c| 12 
 fs/hostfs/hostfs.h| 22 +--
 fs/hostfs/hostfs_kern.c   | 15 ++
 fs/quota/quotaio_v1.h |  6 ++--
 include/linux/skbuff.h|  7 +++--
 include/uapi/linux/acct.h |  2 ++
 include/uapi/linux/taskstats.h|  6 +++-
 kernel/acct.c |  4 ++-
 kernel/tsacct.c   |  9 --
 net/compat.c  |  2 +-
 net/ipv4/tcp.c| 28 +++
 net/netfilter/nft_meta.c  | 10 +++
 net/packet/af_packet.c| 27 +++---
 net/socket.c  |  2 +-
 34 files changed, 184 insertions(+), 124 deletions(-)

-- 
2.20.0

Cc: jd...@addtoit.com
Cc: rich...@nod.at
Cc: jcmvb...@gmail.com
Cc: stef...@s5r6.in-berlin.de
Cc: l.st...@pengutronix.de
Cc: linux+etna...@armlinux.org.uk
Cc: christian.gmei...@gmail.com
Cc: airl...@linux.ie
Cc: dan...@ffwll.ch
Cc: robdcl...@gmail.com
Cc: s...@poorly.run
Cc: valdis.kletni...@vt.edu
Cc: gre...@linuxfoundation.org
Cc: ccaul...@redhat.com
Cc: teigl...@redhat.com
Cc: hirof...@mail.parknet.co.jp
Cc: j...@suse.com
Cc: da...@davemloft.net
Cc: eduma...@google.com
Cc: pa...@netfilter.org
Cc: kad...@netfilter.org
Cc: f...@strlen.de
Cc: will...@google.com
Cc: v...@zeniv.linux.org.uk
Cc: rfont...@redhat.com
Cc: t...@linutronix.de
Cc: linux...@lists.infradead.org
Cc: linux-ker...@vger.kernel.org
Cc: linux1394-de...@lists.sourceforge.net
Cc: etna...@lists.freedesktop.org
Cc: dri-de...@lists.freedesktop.org>
Cc: linux-arm-...@vger.kernel.org>
Cc: freedreno@lists.freedesktop.org>
Cc: de...@driverdev.osuosl.org>
Cc: cluster-de...@redhat.com>
Cc: linux-fsde...@vger.kernel.org>
Cc: net...@vger.kernel.org>
Cc: netfilter-de...@vger.kernel.org>
Cc: coret...@netfilter.org>
___
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno

[Freedreno] [PATCH 14/16] drm/msm: avoid using 'timespec'

2019-11-08 Thread Arnd Bergmann
The timespec structure and associated interfaces are deprecated and will
be removed in the future because of the y2038 overflow.

The use of ktime_to_timespec() in timeout_to_jiffies() does not
suffer from that overflow, but is easy to avoid by just converting
the ktime_t into jiffies directly.

Signed-off-by: Arnd Bergmann 
---
 drivers/gpu/drm/msm/msm_drv.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h
index 71547e756e29..740bf7c70d8f 100644
--- a/drivers/gpu/drm/msm/msm_drv.h
+++ b/drivers/gpu/drm/msm/msm_drv.h
@@ -454,8 +454,7 @@ static inline unsigned long timeout_to_jiffies(const 
ktime_t *timeout)
remaining_jiffies = 0;
} else {
ktime_t rem = ktime_sub(*timeout, now);
-   struct timespec ts = ktime_to_timespec(rem);
-   remaining_jiffies = timespec_to_jiffies();
+   remaining_jiffies = ktime_divns(rem, NSEC_PER_SEC / HZ);
}
 
return remaining_jiffies;
-- 
2.20.0

___
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno

[Freedreno] [PATCH] drm/msm: include linux/sched/task.h

2019-09-18 Thread Arnd Bergmann
Without this header file, compile-testing may run into a missing
declaration:

drivers/gpu/drm/msm/msm_gpu.c:444:4: error: implicit declaration of function 
'put_task_struct' [-Werror,-Wimplicit-function-declaration]

Fixes: 482f96324a4e ("drm/msm: Fix task dump in gpu recovery")
Signed-off-by: Arnd Bergmann 
---
 drivers/gpu/drm/msm/msm_gpu.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/msm/msm_gpu.c b/drivers/gpu/drm/msm/msm_gpu.c
index a052364a5d74..edd45f434ccd 100644
--- a/drivers/gpu/drm/msm/msm_gpu.c
+++ b/drivers/gpu/drm/msm/msm_gpu.c
@@ -16,6 +16,7 @@
 #include 
 #include 
 #include 
+#include 
 
 /*
  * Power Management:
-- 
2.20.0

___
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno

[Freedreno] [PATCH 7/7] [stable-4.19] drm/msm: fix address space warning

2018-12-14 Thread Arnd Bergmann
In the linux-4.19 stable kernel, we get a warning about a type
mismatch between phys_addr_t and dma_addr_t:

drivers/gpu/drm/msm/disp/dpu1/dpu_dbg.c: In function 
'_dpu_dbg_dump_dpu_dbg_bus':
drivers/gpu/drm/msm/disp/dpu1/dpu_dbg.c:2003:16: error: passing argument 3 of 
'dma_alloc_coherent' from incompatible pointer type 
[-Werror=incompatible-pointer-types]
 list_size, , GFP_KERNEL);
^
In file included from include/linux/dma-buf.h:31,
 from drivers/gpu/drm/msm/disp/dpu1/dpu_dbg.c:20:
include/linux/dma-mapping.h:561:15: note: expected 'dma_addr_t *' {aka 'long 
long unsigned int *'} but argument is of type 'phys_addr_t *' {aka 'unsigned 
int *'}
   dma_addr_t *dma_handle, gfp_t flag)
   ^~
drivers/gpu/drm/msm/disp/dpu1/dpu_dbg.c: In function 
'_dpu_dbg_dump_vbif_dbg_bus':
drivers/gpu/drm/msm/disp/dpu1/dpu_dbg.c:2154:16: error: passing argument 3 of 
'dma_alloc_coherent' from incompatible pointer type 
[-Werror=incompatible-pointer-types]
 list_size, , GFP_KERNEL);
^
In file included from include/linux/dma-buf.h:31,
 from drivers/gpu/drm/msm/disp/dpu1/dpu_dbg.c:20:
include/linux/dma-mapping.h:561:15: note: expected 'dma_addr_t *' {aka 'long 
long unsigned int *'} but argument is of type 'phys_addr_t *' {aka 'unsigned 
int *'}

This code was removed in linux-4.20 with upstream commit effec874792f
("drm/msm/dpu: Remove dpu_dbg"). Rather than backporting the large
patch, this just fixes the warning by using the correct type.

Fixes: 25fdd5933e4c ("drm/msm: Add SDM845 DPU support")
Signed-off-by: Arnd Bergmann 
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_dbg.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_dbg.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_dbg.c
index ae2aee7ed9e1..e741d26185df 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_dbg.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_dbg.c
@@ -1962,7 +1962,7 @@ static void _dpu_dbg_dump_dpu_dbg_bus(struct 
dpu_dbg_dpu_debug_bus *bus)
u32 *dump_addr = NULL;
u32 status = 0;
struct dpu_debug_bus_entry *head;
-   phys_addr_t phys = 0;
+   dma_addr_t dma = 0;
int list_size;
int i;
u32 offset;
@@ -2000,7 +2000,7 @@ static void _dpu_dbg_dump_dpu_dbg_bus(struct 
dpu_dbg_dpu_debug_bus *bus)
if (in_mem) {
if (!(*dump_mem))
*dump_mem = dma_alloc_coherent(dpu_dbg_base.dev,
-   list_size, , GFP_KERNEL);
+   list_size, , GFP_KERNEL);
 
if (*dump_mem) {
dump_addr = *dump_mem;
@@ -2101,7 +2101,7 @@ static void _dpu_dbg_dump_vbif_dbg_bus(struct 
dpu_dbg_vbif_debug_bus *bus)
u32 value, d0, d1;
unsigned long reg, reg1, reg2;
struct vbif_debug_bus_entry *head;
-   phys_addr_t phys = 0;
+   dma_addr_t dma = 0;
int i, list_size = 0;
void __iomem *mem_base = NULL;
struct vbif_debug_bus_entry *dbg_bus;
@@ -2151,7 +2151,7 @@ static void _dpu_dbg_dump_vbif_dbg_bus(struct 
dpu_dbg_vbif_debug_bus *bus)
if (in_mem) {
if (!(*dump_mem))
*dump_mem = dma_alloc_coherent(dpu_dbg_base.dev,
-   list_size, , GFP_KERNEL);
+   list_size, , GFP_KERNEL);
 
if (*dump_mem) {
dump_addr = *dump_mem;
-- 
2.20.0

___
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno


[Freedreno] [PATCH 0/7] v4.19-stable randconfig fixes

2018-12-14 Thread Arnd Bergmann
Hi Greg,

I did some randconfig testing on linux-4.19 arm/arm64/x86. So far I needed
27 patches, most of which are also still needed in mainline Linux. I
had submitted some before, and others were not submitted previously
for some reason. I'll try to get those fixed in mainline and then
make sure we get them into 4.19 as well.

This series for now contains four patches that did make it into mainline:

2e6ae11dd0d1 ("slimbus: ngd: mark PM functions as __maybe_unused")
33f49571d750 ("staging: olpc_dcon: add a missing dependency")
0eeec01488da ("scsi: raid_attrs: fix unused variable warning")
11d4afd4ff66 ("sched/pelt: Fix warning and clean up IRQ PELT config")

Feel free to either cherry-pick those from mainline or apply the
patch from this series, whichever works best for you.

The other three patches are for warnings in code that got removed in
mainline kernels:

3e9efc3299dd ("i2c: aspeed: Handle master/slave combined irq events properly")
972910948fb6 ("ARM: dts: qcom: Remove Arrow SD600 eval board")
effec874792f ("drm/msm/dpu: Remove dpu_dbg")

My feeling was that it's safer to just address the warning by fixing
the code correctly in each of these cases, but if you disagree,
applying the mainline change should work equally well, so decide
for yourself.

  Arnd

Arnd Bergmann (5):
  scsi: raid_attrs: fix unused variable warning
  slimbus: ngd: mark PM functions as __maybe_unused
  [stable-4.19] i2c: aspeed: fix build warning
  [stable-4.19] ARM: dts: qcom-apq8064-arrow-sd-600eval fix
graph_endpoint warning
  [stable-4.19] drm/msm:  fix address space warning

Lubomir Rintel (1):
  staging: olpc_dcon: add a missing dependency

Vincent Guittot (1):
  sched/pelt: Fix warning and clean up IRQ PELT config

 arch/arm/boot/dts/qcom-apq8064-arrow-sd-600eval.dts | 5 +
 drivers/gpu/drm/msm/disp/dpu1/dpu_dbg.c | 8 
 drivers/i2c/busses/i2c-aspeed.c | 4 +++-
 drivers/scsi/raid_class.c   | 4 +---
 drivers/slimbus/qcom-ngd-ctrl.c | 6 ++
 drivers/staging/olpc_dcon/Kconfig   | 1 +
 init/Kconfig| 5 +
 kernel/sched/core.c | 7 +++
 kernel/sched/fair.c | 2 +-
 kernel/sched/pelt.c | 2 +-
 kernel/sched/pelt.h | 2 +-
 kernel/sched/sched.h| 5 ++---
 12 files changed, 29 insertions(+), 22 deletions(-)

Cc: Andrew Jeffery 
Cc: Andy Gross 
Cc: b...@alien8.de
Cc: Daniel Drake 
Cc: David Brown 
Cc: dou_liy...@163.com
Cc: Ingo Molnar 
Cc: "James E.J. Bottomley" 
Cc: Jens Frederich 
Cc: Lubomir Rintel 
Cc: Mark Rutland 
Cc: "Martin K. Petersen" 
Cc: Peter Zijlstra 
Cc: Rob Clark 
Cc: Rob Herring 
Cc: Srinivas Kandagatla 
Cc: Vincent Guittot 
Cc: linux-arm-...@vger.kernel.org
Cc: devicet...@vger.kernel.org
Cc: linux-ker...@vger.kernel.org
Cc: freedreno@lists.freedesktop.org
Cc: linux-...@vger.kernel.org
Cc: open...@lists.ozlabs.org
Cc: linux-arm-ker...@lists.infradead.org
Cc: linux-asp...@lists.ozlabs.org
Cc: linux-s...@vger.kernel.org


-- 
2.20.0

___
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno


[Freedreno] [PATCH] drm/msm: fix arm64 build error

2018-12-10 Thread Arnd Bergmann
The new a200 GPU MMU support fails to build on arm64 because
of a conflicting macro name:

drivers/gpu/drm/msm/msm_gpummu.c:17: error: "VA_START" redefined [-Werror]
 #define VA_START SZ_16M

In file included from arch/arm64/include/asm/pgtable-hwdef.h:19,
 from arch/arm64/include/asm/processor.h:48,
 from include/linux/mutex.h:19,
 from include/linux/notifier.h:14,
 from include/linux/clk.h:17,
 from drivers/gpu/drm/msm/msm_drv.h:23,
 from drivers/gpu/drm/msm/msm_gpummu.c:4:
arch/arm64/include/asm/memory.h:51: note: this is the location of the previous 
definition
 #define VA_START  (UL(0x) - \

Rename this and the related macros with a GPU_ prefix.

Fixes: 1c0088f255ae ("drm/msm: implement a2xx mmu")
Signed-off-by: Arnd Bergmann 
---
 drivers/gpu/drm/msm/msm_gpummu.c | 24 
 1 file changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/msm/msm_gpummu.c b/drivers/gpu/drm/msm/msm_gpummu.c
index f1dc2b7e5fd3..2a7ddd449d3d 100644
--- a/drivers/gpu/drm/msm/msm_gpummu.c
+++ b/drivers/gpu/drm/msm/msm_gpummu.c
@@ -14,10 +14,10 @@ struct msm_gpummu {
 };
 #define to_msm_gpummu(x) container_of(x, struct msm_gpummu, base)
 
-#define VA_START SZ_16M
-#define VA_RANGE (0xfff * SZ_64K)
-#define MMU_PAGE_SIZE SZ_4K
-#define TABLE_SIZE (sizeof(uint32_t) * VA_RANGE / MMU_PAGE_SIZE)
+#define GPU_VA_START SZ_16M
+#define GPU_VA_RANGE (0xfff * SZ_64K)
+#define GPU_MMU_PAGE_SIZE SZ_4K
+#define GPU_TABLE_SIZE (sizeof(uint32_t) * GPU_VA_RANGE / GPU_MMU_PAGE_SIZE)
 
 static int msm_gpummu_attach(struct msm_mmu *mmu, const char * const *names,
int cnt)
@@ -34,7 +34,7 @@ static int msm_gpummu_map(struct msm_mmu *mmu, uint64_t iova,
struct sg_table *sgt, unsigned len, int prot)
 {
struct msm_gpummu *gpummu = to_msm_gpummu(mmu);
-   unsigned idx = (iova - VA_START) / MMU_PAGE_SIZE;
+   unsigned idx = (iova - GPU_VA_START) / GPU_MMU_PAGE_SIZE;
struct scatterlist *sg;
unsigned prot_bits = 0;
unsigned i, j;
@@ -46,9 +46,9 @@ static int msm_gpummu_map(struct msm_mmu *mmu, uint64_t iova,
 
for_each_sg(sgt->sgl, sg, sgt->nents, i) {
dma_addr_t addr = sg->dma_address;
-   for (j = 0; j < sg->length / MMU_PAGE_SIZE; j++, idx++) {
+   for (j = 0; j < sg->length / GPU_MMU_PAGE_SIZE; j++, idx++) {
gpummu->table[idx] = addr | prot_bits;
-   addr += MMU_PAGE_SIZE;
+   addr += GPU_MMU_PAGE_SIZE;
}
}
 
@@ -62,10 +62,10 @@ static int msm_gpummu_map(struct msm_mmu *mmu, uint64_t 
iova,
 static int msm_gpummu_unmap(struct msm_mmu *mmu, uint64_t iova, unsigned len)
 {
struct msm_gpummu *gpummu = to_msm_gpummu(mmu);
-   unsigned idx = (iova - VA_START) / MMU_PAGE_SIZE;
+   unsigned idx = (iova - GPU_VA_START) / GPU_MMU_PAGE_SIZE;
unsigned i;
 
-   for (i = 0; i < len / MMU_PAGE_SIZE; i++, idx++)
+   for (i = 0; i < len / GPU_MMU_PAGE_SIZE; i++, idx++)
 gpummu->table[idx] = 0;
 
gpu_write(gpummu->gpu, REG_A2XX_MH_MMU_INVALIDATE,
@@ -78,7 +78,7 @@ static void msm_gpummu_destroy(struct msm_mmu *mmu)
 {
struct msm_gpummu *gpummu = to_msm_gpummu(mmu);
 
-   dma_free_attrs(mmu->dev, TABLE_SIZE, gpummu->table, gpummu->pt_base,
+   dma_free_attrs(mmu->dev, GPU_TABLE_SIZE, gpummu->table, gpummu->pt_base,
DMA_ATTR_FORCE_CONTIGUOUS);
 
kfree(gpummu);
@@ -100,7 +100,7 @@ struct msm_mmu *msm_gpummu_new(struct device *dev, struct 
msm_gpu *gpu)
if (!gpummu)
return ERR_PTR(-ENOMEM);
 
-   gpummu->table = dma_alloc_attrs(dev, TABLE_SIZE + 32, >pt_base,
+   gpummu->table = dma_alloc_attrs(dev, GPU_TABLE_SIZE + 32, 
>pt_base,
GFP_KERNEL | __GFP_ZERO, DMA_ATTR_FORCE_CONTIGUOUS);
if (!gpummu->table) {
kfree(gpummu);
@@ -119,5 +119,5 @@ void msm_gpummu_params(struct msm_mmu *mmu, dma_addr_t 
*pt_base,
dma_addr_t base = to_msm_gpummu(mmu)->pt_base;
 
*pt_base = base;
-   *tran_error = base + TABLE_SIZE; /* 32-byte aligned */
+   *tran_error = base + GPU_TABLE_SIZE; /* 32-byte aligned */
 }
-- 
2.20.0

___
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno


Re: [Freedreno] [PATCH 4/4] drm/msm: bump UAPI version

2018-11-30 Thread Arnd Bergmann
On Fri, Nov 30, 2018 at 4:31 PM Rob Clark  wrote:
>
> On Fri, Nov 30, 2018 at 10:12 AM Arnd Bergmann  wrote:
> >
> > On Fri, Nov 30, 2018 at 4:02 PM Rob Clark  wrote:
> > >
> > > Signed-off-by: Rob Clark 
> > > ---
> > >  drivers/gpu/drm/msm/msm_drv.c | 4 +++-
> > >  1 file changed, 3 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c
> > > index 6ebbd5010722..782cc33916d6 100644
> > > --- a/drivers/gpu/drm/msm/msm_drv.c
> > > +++ b/drivers/gpu/drm/msm/msm_drv.c
> > > @@ -36,9 +36,11 @@
> > >   * - 1.3.0 - adds GMEM_BASE + NR_RINGS params, SUBMITQUEUE_NEW +
> > >   *   SUBMITQUEUE_CLOSE ioctls, and MSM_INFO_IOVA flag for
> > >   *   MSM_GEM_INFO ioctl.
> > > + * - 1.4.0 - softpin, MSM_RELOC_BO_DUMP, and GEM_INFO support to set/get
> > > + *   GEM object's debug name
> > >   */
> > >  #define MSM_VERSION_MAJOR  1
> > > -#define MSM_VERSION_MINOR  3
> > > +#define MSM_VERSION_MINOR  4
> > >  #define MSM_VERSION_PATCHLEVEL 0
> > >
> >
> > I don't know the background here, but generally speaking we don't have
> > version numbers for ioctls in kernel drivers. Instead, the old ioctls
> > need to remain functional, but you can add new ioctl commands
> > in addition.
> >
> > Is there something that makes this driver special?
> >
>
> The version # indicates to userspace that some new features are
> supported, so that new userspace on kernel can work.  For example, the
> userspace side of setting a GEM obj debug name is:

Ok, got it.

> static void msm_bo_set_name(struct fd_bo *bo, const char *fmt, va_list ap)
> {
> struct drm_msm_gem_info req = {
> .handle = bo->handle,
> .info = MSM_INFO_SET_NAME,
> };
> char buf[32];
> int sz;
>
> /* bail if kernel doesn't support this: */
> if (bo->dev->version < FD_VERSION_SOFTPIN)
> return;
>
> sz = vsnprintf(buf, sizeof(buf), fmt, ap);
>
> req.value = VOID2U64(buf);
> req.len = MIN2(sz, sizeof(buf));
>
> drmCommandWrite(bo->dev->fd, DRM_MSM_GEM_INFO, , sizeof(req));
> }

So that version check seems harmless, but also not necessary,
at least in this case, right? I would assume that calling into
drmCommandWrite() with an invalid command will only return
an error, which then gets ignored, where with the check, we
would skip the call, knowing that it wont't work.

  Arnd
___
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno


Re: [Freedreno] [PATCH 2/4] drm/msm: rework GEM_INFO ioctl

2018-11-30 Thread Arnd Bergmann
On Fri, Nov 30, 2018 at 4:02 PM Rob Clark  wrote:
>

> -
> -#define MSM_INFO_FLAGS (MSM_INFO_IOVA)
> +/* Get or set GEM buffer info.  The requested value can be passed
> + * directly in 'value', or for data larger than 64b 'value' is a
> + * pointer to userspace buffer, with 'len' specifying the number of
> + * bytes copied into that buffer.  For info returned by pointer,
> + * calling the GEM_INFO ioctl with null 'value' will return the
> + * required buffer size in 'len'
> + */
> +#define MSM_INFO_GET_OFFSET0x00   /* get mmap() offset, returned by 
> value */
> +#define MSM_INFO_GET_IOVA  0x01   /* get iova, returned by value */
>
>  struct drm_msm_gem_info {
> __u32 handle; /* in */
> -   __u32 flags;  /* in - combination of MSM_INFO_* flags */
> -   __u64 offset; /* out, mmap() offset or iova */
> +   __u32 info;   /* in - one of MSM_INFO_* */
> +   __u64 value;  /* in or out */
> +   __u32 len;/* in or out */
>  };

As structure with implicit padding has the problem of possibly leaking
kernel stack data. It's better to make the padding explicit here so you
can zero it from the kernel. Also, as I mentioned in the other patch,
you probably need a new data structure and ioctl command number
to keep compatiblity with the old interface.

 Arnd
___
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno


Re: [Freedreno] [PATCH 4/4] drm/msm: bump UAPI version

2018-11-30 Thread Arnd Bergmann
On Fri, Nov 30, 2018 at 4:02 PM Rob Clark  wrote:
>
> Signed-off-by: Rob Clark 
> ---
>  drivers/gpu/drm/msm/msm_drv.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c
> index 6ebbd5010722..782cc33916d6 100644
> --- a/drivers/gpu/drm/msm/msm_drv.c
> +++ b/drivers/gpu/drm/msm/msm_drv.c
> @@ -36,9 +36,11 @@
>   * - 1.3.0 - adds GMEM_BASE + NR_RINGS params, SUBMITQUEUE_NEW +
>   *   SUBMITQUEUE_CLOSE ioctls, and MSM_INFO_IOVA flag for
>   *   MSM_GEM_INFO ioctl.
> + * - 1.4.0 - softpin, MSM_RELOC_BO_DUMP, and GEM_INFO support to set/get
> + *   GEM object's debug name
>   */
>  #define MSM_VERSION_MAJOR  1
> -#define MSM_VERSION_MINOR  3
> +#define MSM_VERSION_MINOR  4
>  #define MSM_VERSION_PATCHLEVEL 0
>

I don't know the background here, but generally speaking we don't have
version numbers for ioctls in kernel drivers. Instead, the old ioctls
need to remain functional, but you can add new ioctl commands
in addition.

Is there something that makes this driver special?

  Arnd
___
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno


[Freedreno] [PATCH 1/2] drm/msm/gpu: fix msm_gpu_crashstate_capture stub prototype

2018-08-13 Thread Arnd Bergmann
The function prototype recently changed, but the patch missed the
second prototype that is used when CONFIG_DEV_COREDUMP is disabled:

drivers/gpu/drm/msm/msm_gpu.c: In function 'recover_worker':
drivers/gpu/drm/msm/msm_gpu.c:461:34: error: passing argument 2 of 
'msm_gpu_crashstate_capture' from incompatible pointer type 
[-Werror=incompatible-pointer-types]
  msm_gpu_crashstate_capture(gpu, submit, comm, cmd);
  ^~
drivers/gpu/drm/msm/msm_gpu.c:370:67: note: expected 'char *' but argument is 
of type 'struct msm_gem_submit *'
 static void msm_gpu_crashstate_capture(struct msm_gpu *gpu, char *comm,
 ~~^~~~
drivers/gpu/drm/msm/msm_gpu.c:461:2: error: too many arguments to function 
'msm_gpu_crashstate_capture'
  msm_gpu_crashstate_capture(gpu, submit, comm, cmd);
  ^~
drivers/gpu/drm/msm/msm_gpu.c:370:13: note: declared here
 static void msm_gpu_crashstate_capture(struct msm_gpu *gpu, char *comm,

Change the stub to match the normal function.

Fixes: cdb95931dea3 ("drm/msm/gpu: Add the buffer objects from the submit to 
the crash dump")
Signed-off-by: Arnd Bergmann 
---
 drivers/gpu/drm/msm/msm_gpu.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/msm/msm_gpu.c b/drivers/gpu/drm/msm/msm_gpu.c
index 5e808cfec345..46e6b82f7b66 100644
--- a/drivers/gpu/drm/msm/msm_gpu.c
+++ b/drivers/gpu/drm/msm/msm_gpu.c
@@ -367,8 +367,8 @@ static void msm_gpu_crashstate_capture(struct msm_gpu *gpu,
msm_gpu_devcoredump_read, msm_gpu_devcoredump_free);
 }
 #else
-static void msm_gpu_crashstate_capture(struct msm_gpu *gpu, char *comm,
-   char *cmd)
+static void msm_gpu_crashstate_capture(struct msm_gpu *gpu,
+   struct msm_gem_submit *submit, char *comm, char *cmd)
 {
 }
 #endif
-- 
2.18.0

___
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno


[Freedreno] [PATCH] drm/msm/gpu: avoid deprecated do_gettimeofday

2018-07-26 Thread Arnd Bergmann
All users of do_gettimeofday() have been removed, but this one recently
crept in, along with an incorrect printing of the microseconds portion.

This converts it to using ktime_get_real_timespec64() as a direct
replacement, and adds the leading zeroes. I considered using monotonic
times (ktime_get()) instead, but as this timestamp appears to only
be used for humans rather than compared with other timestamps, the
real time domain is probably good enough.

Fixes: e43b045e2c82 ("drm/msm/gpu: Capture the state of the GPU")
Signed-off-by: Arnd Bergmann 
---
 drivers/gpu/drm/msm/adreno/adreno_gpu.c | 2 +-
 drivers/gpu/drm/msm/msm_gpu.c   | 4 ++--
 drivers/gpu/drm/msm/msm_gpu.h   | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/gpu/drm/msm/adreno/adreno_gpu.c 
b/drivers/gpu/drm/msm/adreno/adreno_gpu.c
index 08d3c618b7de..38ac50b73829 100644
--- a/drivers/gpu/drm/msm/adreno/adreno_gpu.c
+++ b/drivers/gpu/drm/msm/adreno/adreno_gpu.c
@@ -376,7 +376,7 @@ int adreno_gpu_state_get(struct msm_gpu *gpu, struct 
msm_gpu_state *state)
 
kref_init(>ref);
 
-   do_gettimeofday(>time);
+   ktime_get_real_ts64(>time);
 
for (i = 0; i < gpu->nr_rings; i++) {
int size = 0, j;
diff --git a/drivers/gpu/drm/msm/msm_gpu.c b/drivers/gpu/drm/msm/msm_gpu.c
index 3cf8e8d29812..f388944c93e2 100644
--- a/drivers/gpu/drm/msm/msm_gpu.c
+++ b/drivers/gpu/drm/msm/msm_gpu.c
@@ -297,8 +297,8 @@ static ssize_t msm_gpu_devcoredump_read(char *buffer, 
loff_t offset,
drm_printf(, "---\n");
drm_printf(, "kernel: " UTS_RELEASE "\n");
drm_printf(, "module: " KBUILD_MODNAME "\n");
-   drm_printf(, "time: %ld.%ld\n",
-   state->time.tv_sec, state->time.tv_usec);
+   drm_printf(, "time: %lld.%09ld\n",
+   state->time.tv_sec, state->time.tv_nsec);
if (state->comm)
drm_printf(, "comm: %s\n", state->comm);
if (state->cmd)
diff --git a/drivers/gpu/drm/msm/msm_gpu.h b/drivers/gpu/drm/msm/msm_gpu.h
index 57380ef8d1f7..1c6105bc55c7 100644
--- a/drivers/gpu/drm/msm/msm_gpu.h
+++ b/drivers/gpu/drm/msm/msm_gpu.h
@@ -189,7 +189,7 @@ struct msm_gpu_state_bo {
 
 struct msm_gpu_state {
struct kref ref;
-   struct timeval time;
+   struct timespec64 time;
 
struct {
u64 iova;
-- 
2.18.0

___
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno


[Freedreno] [PATCH] drm/msm: mark PM functions as __maybe_unused

2018-07-24 Thread Arnd Bergmann
The suspend/resume functions are not referenced when power
management is disabled:

drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c:1288:12: error: 'dpu_runtime_resume' 
defined but not used [-Werror=unused-function]
drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c:1261:12: error: 'dpu_runtime_suspend' 
defined but not used [-Werror=unused-function]

This marks them as __maybe_unused to let the compiler
drop the functions without complaining.

Fixes: 591225291ca2 ("drm/msm: Add SDM845 DPU support")
Signed-off-by: Arnd Bergmann 
---
 drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c 
b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
index 8d4678d29cc7..1c0838801e78 100644
--- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
+++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c
@@ -1258,7 +1258,7 @@ static int dpu_dev_remove(struct platform_device *pdev)
return 0;
 }
 
-static int dpu_runtime_suspend(struct device *dev)
+static int __maybe_unused dpu_runtime_suspend(struct device *dev)
 {
int rc = -1;
struct platform_device *pdev = to_platform_device(dev);
@@ -1285,7 +1285,7 @@ static int dpu_runtime_suspend(struct device *dev)
return rc;
 }
 
-static int dpu_runtime_resume(struct device *dev)
+static int __maybe_unused dpu_runtime_resume(struct device *dev)
 {
int rc = -1;
struct platform_device *pdev = to_platform_device(dev);
-- 
2.18.0

___
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno


Re: [Freedreno] [PATCH] drm/msm: avoid using 'timespec'

2018-07-10 Thread Arnd Bergmann
On Tue, Jul 10, 2018 at 10:47 PM, Sean Paul  wrote:
> On Mon, Jun 18, 2018 at 05:39:42PM +0200, Arnd Bergmann wrote:
>> The timespec structure and associated interfaces are deprecated and will
>> be removed in the future because of the y2038 overflow.
>>
>> The use of ktime_to_timespec() in timeout_to_jiffies() does not
>> suffer from that overflow, but is easy to avoid by just converting
>> the ktime_t into jiffies directly.
>>
>> Signed-off-by: Arnd Bergmann 
>> ---
>>  drivers/gpu/drm/msm/msm_drv.h | 3 +--
>>  1 file changed, 1 insertion(+), 2 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h
>> index b2da1fbf81e0..cc8977476a41 100644
>> --- a/drivers/gpu/drm/msm/msm_drv.h
>> +++ b/drivers/gpu/drm/msm/msm_drv.h
>> @@ -353,8 +353,7 @@ static inline unsigned long timeout_to_jiffies(const 
>> ktime_t *timeout)
>>   remaining_jiffies = 0;
>>   } else {
>>   ktime_t rem = ktime_sub(*timeout, now);
>> - struct timespec ts = ktime_to_timespec(rem);
>> - remaining_jiffies = timespec_to_jiffies();
>> + remaining_jiffies = ktime_divns(rem, NSEC_PER_SEC / HZ);
>
> Do you need to wrap rem in ktime_to_ns() just to be safe?

The ktime_t interfaces are still defined to use an opaque type,
as previously it was a union that could be a seconds/nanoseconds
pair depending on the architecture. These days, ktime_t is just
a 64-bit integer, so div_u64() would work just as well as ktime_divns(),
but this is the documented way to do it.

  Arnd
___
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno


Re: [Freedreno] [PATCH] drm/msm/adreno: Remove VLA usage

2018-06-29 Thread Arnd Bergmann
On Fri, Jun 29, 2018 at 8:48 PM, Kees Cook  wrote:
> In the quest to remove all stack VLA usage from the kernel[1], this
> switches to using a kasprintf()ed buffer. Return paths are updated
> to free the allocation.
>
> [1] 
> https://lkml.kernel.org/r/CA+55aFzCG-zNmZwX4A2FQpadafLfEzK6CC=qpxydaacu1rq...@mail.gmail.com
>
> Signed-off-by: Kees Cook 
> ---
>  drivers/gpu/drm/msm/adreno/a5xx_gpu.c   |  7 +--
>  drivers/gpu/drm/msm/adreno/adreno_gpu.c | 28 +
>  2 files changed, 24 insertions(+), 11 deletions(-)

This seems fine, though using a fixed-length string is probably just
as well here,
given that the 'fwname' variable is always set to the constant string
"a530_zap.mdt"
at the moment, which is not very long.

Reviewed-by: Arnd Bergmann 

   Arnd
___
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno


[Freedreno] [PATCH] drm/msm: avoid using 'timespec'

2018-06-18 Thread Arnd Bergmann
The timespec structure and associated interfaces are deprecated and will
be removed in the future because of the y2038 overflow.

The use of ktime_to_timespec() in timeout_to_jiffies() does not
suffer from that overflow, but is easy to avoid by just converting
the ktime_t into jiffies directly.

Signed-off-by: Arnd Bergmann 
---
 drivers/gpu/drm/msm/msm_drv.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h
index b2da1fbf81e0..cc8977476a41 100644
--- a/drivers/gpu/drm/msm/msm_drv.h
+++ b/drivers/gpu/drm/msm/msm_drv.h
@@ -353,8 +353,7 @@ static inline unsigned long timeout_to_jiffies(const 
ktime_t *timeout)
remaining_jiffies = 0;
} else {
ktime_t rem = ktime_sub(*timeout, now);
-   struct timespec ts = ktime_to_timespec(rem);
-   remaining_jiffies = timespec_to_jiffies();
+   remaining_jiffies = ktime_divns(rem, NSEC_PER_SEC / HZ);
}
 
return remaining_jiffies;
-- 
2.9.0

___
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno


[Freedreno] [PATCH] drm/msm: fix building without debugfs

2018-02-26 Thread Arnd Bergmann
The adreno driver stopped building when CONFIG_DEBUGFS is disabled:

drivers/gpu/drm/msm/adreno/adreno_device.c: In function 'adreno_load_gpu':
drivers/gpu/drm/msm/adreno/adreno_device.c:153:16: error: 'const struct 
msm_gpu_funcs' has no member named 'debugfs_init'
  if (gpu->funcs->debugfs_init) {
^~
drivers/gpu/drm/msm/adreno/adreno_device.c:154:13: error: 'const struct 
msm_gpu_funcs' has no member named 'debugfs_init'
   gpu->funcs->debugfs_init(gpu, dev->primary);
 ^~

This adds an #ifdef around the code that references the hidden
pointer.

Fixes: 331dc0bc195b ("drm/msm: add a5xx specific debugfs")
Signed-off-by: Arnd Bergmann <a...@arndb.de>
---
 drivers/gpu/drm/msm/adreno/adreno_device.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/msm/adreno/adreno_device.c 
b/drivers/gpu/drm/msm/adreno/adreno_device.c
index f07d3ec7d77b..8e0cb161754b 100644
--- a/drivers/gpu/drm/msm/adreno/adreno_device.c
+++ b/drivers/gpu/drm/msm/adreno/adreno_device.c
@@ -164,11 +164,13 @@ struct msm_gpu *adreno_load_gpu(struct drm_device *dev)
return NULL;
}
 
+#ifdef CONFIG_DEBUG_FS
if (gpu->funcs->debugfs_init) {
gpu->funcs->debugfs_init(gpu, dev->primary);
gpu->funcs->debugfs_init(gpu, dev->render);
gpu->funcs->debugfs_init(gpu, dev->control);
}
+#endif
 
return gpu;
 }
-- 
2.9.0

___
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno


[Freedreno] [PATCH 2/2] drm/msm/adreno: fix nvmem related link error

2018-01-15 Thread Arnd Bergmann
When NVMEM is configured as a loadable module, and adreno
is built-in, we get a link failure:

drivers/gpu/drm/msm/adreno/a5xx_gpu.o: In function `a5xx_gpu_init':
a5xx_gpu.c:(.text+0x15cc): undefined reference to `nvmem_cell_get'
a5xx_gpu.c:(.text+0x15da): undefined reference to `nvmem_cell_read'
a5xx_gpu.c:(.text+0x15e4): undefined reference to `nvmem_cell_put'

This adds a Kconfig dependency to enforce valid configurations,
when NVMEM is a loadable module, adreno now has to also be one.
The code seems to deal fine with nvmem being completely disabled,
it will just not set the right speed bin then, so we don't need
a hard dependency.

Fixes: f56d9df656c4 ("drm/msm/adreno: Read the speed bins for a5xx targets")
Signed-off-by: Arnd Bergmann <a...@arndb.de>
---
 drivers/gpu/drm/msm/Kconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/msm/Kconfig b/drivers/gpu/drm/msm/Kconfig
index 99d39b2aefa6..74fb1c816da9 100644
--- a/drivers/gpu/drm/msm/Kconfig
+++ b/drivers/gpu/drm/msm/Kconfig
@@ -4,6 +4,7 @@ config DRM_MSM
depends on DRM
depends on ARCH_QCOM || (ARM && COMPILE_TEST)
depends on OF && COMMON_CLK
+   depends on NVMEM || !NVMEM
depends on MMU
select QCOM_MDT_LOADER if ARCH_QCOM
select REGULATOR
-- 
2.9.0

___
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno


Re: [Freedreno] [PATCH] drm: msm: avoid false-positive -Wmaybe-uninitialized warning

2017-12-04 Thread Arnd Bergmann
On Mon, Dec 4, 2017 at 5:36 PM, Laurent Pinchart
<laurent.pinch...@ideasonboard.com> wrote:
> Hi Arnd,
>
> Thank you for the patch.
>
> On Monday, 4 December 2017 16:44:23 EET Arnd Bergmann wrote:
>> gcc-8 -fsanitize-coverage=trace-pc produces a false-positive warning:
>>
>> drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c: In function
>> 'mdp5_plane_mode_set.isra.8':
>> drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c:1053:3: error: 'crtc_x_r' may be
>> used uninitialized in this function [-Werror=maybe-uninitialized]
>>
>> It's relatively clear from reading the source that this cannot happen,
>> and older compilers get it right. This rearranges the code remove
>> the two affected variables, which reliably avoids the problem.
>>
>> Signed-off-by: Arnd Bergmann <a...@arndb.de>
>
> The patch looks good to me, so
>
> Acked-by: Laurent Pinchart <laurent.pinch...@ideasonboard.com>
>
> However I think it would also be useful to file a bug report for gcc,
> especially if older versions got this right.

I was rather close to it, and even spent time on a reduced test case
with "creduce", which came down to

int drm_rect_width_r_0, calc_phase_step_src, calc_scalex_steps_ret,
calc_scalex_steps_dest, calc_scaley_steps_ret, calc_scaley_steps_dest,
mdp5_plane_mode_set___trans_tmp_2;
struct mdp5_hw_pipe {
  int caps;
} * mdp5_plane_mode_set_right_hwpipe;
int fn1(int p1) {
  if (calc_phase_step_src || p1 == 0)
return 2;
  if (calc_phase_step_src > p1)
return 5;
  return 0;
}
int fn2() {
  struct mdp5_hw_pipe hwpipe = hwpipe;
  int src_x_r;
  if (mdp5_plane_mode_set_right_hwpipe)
src_x_r = drm_rect_width_r_0;
  calc_scalex_steps_ret = fn1(calc_scalex_steps_dest);
  if (calc_scalex_steps_ret)
return calc_scalex_steps_ret;
  calc_scaley_steps_ret = fn1(calc_scaley_steps_dest);
  if (calc_scaley_steps_ret)
return calc_scaley_steps_ret;
  if (hwpipe.caps)
if (mdp5_plane_mode_set_right_hwpipe)
  mdp5_plane_mode_set___trans_tmp_2 = src_x_r;
  return calc_scaley_steps_ret;
}

This is still not something that is "obviously" wrong, it seems rather
that gcc can't keep track of enough state at the same time, which
is a fundamental problem but also a bit unpredictable.

I've seen many false-positive (and also false-negative) -Wmaybe-uninitialized
warnings that are likely easier to fix than this particular one, so I
ended up not reporting it.

Arnd
___
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno


[Freedreno] [PATCH] drm: msm: avoid false-positive -Wmaybe-uninitialized warning

2017-12-04 Thread Arnd Bergmann
gcc-8 -fsanitize-coverage=trace-pc produces a false-positive warning:

drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c: In function 
'mdp5_plane_mode_set.isra.8':
drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c:1053:3: error: 'crtc_x_r' may be used 
uninitialized in this function [-Werror=maybe-uninitialized]

It's relatively clear from reading the source that this cannot happen,
and older compilers get it right. This rearranges the code remove
the two affected variables, which reliably avoids the problem.

Signed-off-by: Arnd Bergmann <a...@arndb.de>
---
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c | 9 ++---
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c 
b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c
index be50445f9901..c50449882037 100644
--- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c
+++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_plane.c
@@ -964,8 +964,6 @@ static int mdp5_plane_mode_set(struct drm_plane *plane,
uint32_t src_x, src_y;
uint32_t src_w, src_h;
uint32_t src_img_w, src_img_h;
-   uint32_t src_x_r;
-   int crtc_x_r;
int ret;
 
nplanes = fb->format->num_planes;
@@ -1010,9 +1008,6 @@ static int mdp5_plane_mode_set(struct drm_plane *plane,
crtc_w /= 2;
src_w /= 2;
src_img_w /= 2;
-
-   crtc_x_r = crtc_x + crtc_w;
-   src_x_r = src_x + src_w;
}
 
ret = calc_scalex_steps(plane, pix_format, src_w, crtc_w, step.x);
@@ -1052,9 +1047,9 @@ static int mdp5_plane_mode_set(struct drm_plane *plane,
if (right_hwpipe)
mdp5_hwpipe_mode_set(mdp5_kms, right_hwpipe, fb, , ,
 config, hdecm, vdecm, hflip, vflip,
-crtc_x_r, crtc_y, crtc_w, crtc_h,
+crtc_x + crtc_w, crtc_y, crtc_w, crtc_h,
 src_img_w, src_img_h,
-src_x_r, src_y, src_w, src_h);
+src_x + src_w, src_y, src_w, src_h);
 
plane->fb = fb;
 
-- 
2.9.0

___
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno


[Freedreno] [PATCH] drm/msm/rd: fix msm_rd_dump_submit() prototype

2017-11-27 Thread Arnd Bergmann
A build regression has appeared in linux-4.15-rc from an API change,
in configurations without CONFIG_DEBUG_FS:

In file included from drivers/gpu/drm/msm/msm_gpu.h:24:0,
 from drivers/gpu/drm/msm/msm_gpu.c:18:
drivers/gpu/drm/msm/msm_drv.h:306:20: note: expected 'struct msm_gem_submit *' 
but argument is of type 'struct msm_rd_state *'
 static inline void msm_rd_dump_submit(struct msm_gem_submit *submit) {}
^~
drivers/gpu/drm/msm/msm_gpu.c:295:4: error: too many arguments to function 
'msm_rd_dump_submit'

This changes the prototype of the stub function the same way as the
regualar prototype.

Fixes: 998b9a588314 ("drm/msm/rd: allow adding addition msg to top of dump")
Signed-off-by: Arnd Bergmann <a...@arndb.de>
---
 drivers/gpu/drm/msm/msm_drv.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h
index c646843d8822..9696f796b3c3 100644
--- a/drivers/gpu/drm/msm/msm_drv.h
+++ b/drivers/gpu/drm/msm/msm_drv.h
@@ -303,7 +303,8 @@ int msm_perf_debugfs_init(struct drm_minor *minor);
 void msm_perf_debugfs_cleanup(struct msm_drm_private *priv);
 #else
 static inline int msm_debugfs_late_init(struct drm_device *dev) { return 0; }
-static inline void msm_rd_dump_submit(struct msm_gem_submit *submit) {}
+static inline void msm_rd_dump_submit(struct msm_rd_state *rd,
+   struct msm_gem_submit *submit, const char *fmt, ...) {}
 static inline void msm_rd_debugfs_cleanup(struct msm_drm_private *priv) {}
 static inline void msm_perf_debugfs_cleanup(struct msm_drm_private *priv) {}
 #endif
-- 
2.9.0

___
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno


[Freedreno] [PATCH] drm/msm: fix msm_rd_dump_submit prototype

2017-11-02 Thread Arnd Bergmann
The prototype of msm_rd_dump_submit() has recently changed. However,
we have two declarations of this functions, and the other one
remains the old version, leading to this:

drivers/gpu/drm/msm/msm_gpu.c: In function 'recover_worker':
drivers/gpu/drm/msm/msm_gpu.c:295:23: error: passing argument 1 of 
'msm_rd_dump_submit' from incompatible pointer type 
[-Werror=incompatible-pointer-types]

This changes the second one to match the first again.

Fixes: 2165e2b9cba2 ("drm/msm: split rd debugfs file")
Signed-off-by: Arnd Bergmann <a...@arndb.de>
---
 drivers/gpu/drm/msm/msm_drv.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h
index c646843d8822..0a653dd2e618 100644
--- a/drivers/gpu/drm/msm/msm_drv.h
+++ b/drivers/gpu/drm/msm/msm_drv.h
@@ -303,7 +303,8 @@ int msm_perf_debugfs_init(struct drm_minor *minor);
 void msm_perf_debugfs_cleanup(struct msm_drm_private *priv);
 #else
 static inline int msm_debugfs_late_init(struct drm_device *dev) { return 0; }
-static inline void msm_rd_dump_submit(struct msm_gem_submit *submit) {}
+static inline void msm_rd_dump_submit(struct msm_rd_state *rd, struct 
msm_gem_submit *submit,
+   const char *fmt, ...) {}
 static inline void msm_rd_debugfs_cleanup(struct msm_drm_private *priv) {}
 static inline void msm_perf_debugfs_cleanup(struct msm_drm_private *priv) {}
 #endif
-- 
2.9.0

___
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno


[Freedreno] [PATCH 2/3] drm/msm/mdp5: mark runtime_pm functions as __maybe_unused

2017-08-03 Thread Arnd Bergmann
When CONFIG_PM is disabled, we get harmless warnings about unused
functions:

drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c:1025:12: error: 'mdp5_runtime_resume' 
defined but not used [-Werror=unused-function]
 static int mdp5_runtime_resume(struct device *dev)
^~~
drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c:1015:12: error: 'mdp5_runtime_suspend' 
defined but not used [-Werror=unused-function]
 static int mdp5_runtime_suspend(struct device *dev)
^~~~

This marks both functions as __maybe_unused so the compiler
can drop them silently.

Fixes: d68fe15b1878 ("drm/msm/mdp5: Use runtime PM get/put API instead of 
toggling clocks")
Signed-off-by: Arnd Bergmann <a...@arndb.de>
---
 drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c 
b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c
index 9f9d95f7c80f..f7c0698fec40 100644
--- a/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c
+++ b/drivers/gpu/drm/msm/mdp/mdp5/mdp5_kms.c
@@ -1012,7 +1012,7 @@ static int mdp5_dev_remove(struct platform_device *pdev)
return 0;
 }
 
-static int mdp5_runtime_suspend(struct device *dev)
+static __maybe_unused int mdp5_runtime_suspend(struct device *dev)
 {
struct platform_device *pdev = to_platform_device(dev);
struct mdp5_kms *mdp5_kms = platform_get_drvdata(pdev);
@@ -1022,7 +1022,7 @@ static int mdp5_runtime_suspend(struct device *dev)
return mdp5_disable(mdp5_kms);
 }
 
-static int mdp5_runtime_resume(struct device *dev)
+static __maybe_unused int mdp5_runtime_resume(struct device *dev)
 {
struct platform_device *pdev = to_platform_device(dev);
struct mdp5_kms *mdp5_kms = platform_get_drvdata(pdev);
-- 
2.9.0

___
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno


[Freedreno] [PATCH 3/3] drm/msm: use %z format modifier for printing size_t

2017-08-03 Thread Arnd Bergmann
The return type of ARRAY_SIZE() is size_t, so we have to use
%zu instead of %lu to avoid this warning:

drivers/gpu/drm/msm/msm_gpu.c: In function 'msm_gpu_init':
drivers/gpu/drm/msm/msm_gpu.c:742:31: error: format '%lu' expects argument of 
type 'long unsigned int', but argument 7 has type 'unsigned int' 
[-Werror=format=]

The warning it otherwise harmless as size_t is always the
same size as unsigned long in all supported architectures,
but gcc doesn't know that.

Fixes: c2fceabca6d5 ("drm/msm: Support multiple ringbuffers")
Signed-off-by: Arnd Bergmann <a...@arndb.de>
---
 drivers/gpu/drm/msm/msm_gpu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/msm/msm_gpu.c b/drivers/gpu/drm/msm/msm_gpu.c
index 1e44f8893490..66af5ac334ba 100644
--- a/drivers/gpu/drm/msm/msm_gpu.c
+++ b/drivers/gpu/drm/msm/msm_gpu.c
@@ -739,7 +739,7 @@ int msm_gpu_init(struct drm_device *drm, struct 
platform_device *pdev,
}
 
if (nr_rings > ARRAY_SIZE(gpu->rb)) {
-   DRM_DEV_INFO_ONCE(drm->dev, "Only creating %lu ringbuffers\n",
+   DRM_DEV_INFO_ONCE(drm->dev, "Only creating %zu ringbuffers\n",
ARRAY_SIZE(gpu->rb));
nr_rings = ARRAY_SIZE(gpu->rb);
}
-- 
2.9.0

___
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno


Re: [Freedreno] [PATCH 2/2] drm/msm: gpu: don't abuse dma_alloc for non-DMA allocations

2017-07-26 Thread Arnd Bergmann
 On Jul 26, 2017 6:35 PM, "Jordan Crouse"  wrote:

> >   if (!IS_ENABLED(CONFIG_ARCH_QCOM))
> >   return -EINVAL;
> >
> > + np = of_get_child_by_name(dev->of_node, "zap-shader");
> > + if (!np)
> > + return -ENODEV;
> > +
> > + np = of_parse_phandle(dev->of_node, "memory-region", 0);
>
> I think this should be np = of_parse_phandle(np, "memory-region", 0);
>

Ok, fixed.

> > @@ -373,44 +393,6 @@ static int a5xx_zap_shader_resume(struct msm_gpu *gpu)
> >  }
> >
> >  /* Set up a child device to "own" the zap shader */
>
> This now incorrect comment can be zapped (pun intended).

Done.

> > -static int a5xx_zap_shader_dev_init(struct device *parent, struct device 
> > *dev)
> > -{
> > - struct device_node *node;
> > - int ret;
> > -
> > - if (dev->parent)
> > - return 0;
> > -
>
> With above changes,
> Acked-and-Tested-By: Jordan Crouse 

Thanks for testing!

I've re-sent this patch as v3 now (this one was actually v2, depending on
how you count). I decided not to resend patch 1/2 of the series. We still
need that too, but they are independent. Hope that's ok.
___
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno


[Freedreno] [PATCH v3] drm/msm: gpu: don't abuse dma_alloc for non-DMA allocations

2017-07-26 Thread Arnd Bergmann
In zap_shader_load_mdt(), we pass a pointer to a phys_addr_t
into dmam_alloc_coherent, which the compiler warns about:

drivers/gpu/drm/msm/adreno/a5xx_gpu.c: In function 'zap_shader_load_mdt':
drivers/gpu/drm/msm/adreno/a5xx_gpu.c:54:50: error: passing argument 3 of 
'dmam_alloc_coherent' from incompatible pointer type 
[-Werror=incompatible-pointer-types]

The returned DMA address is later passed on to a function that
takes a phys_addr_t, so it's clearly wrong to use the DMA
mapping interface here: the memory may be uncached, or the
address may be completely wrong if there is an IOMMU connected
to the device. What the code actually wants to do is to get
the physical address from the reserved-mem node. It goes through
the dma-mapping interfaces for obscure reasons, and this
apparently only works by chance, relying on specific bugs
in the error handling of the arm64 dma-mapping implementation.

The same problem existed in the "venus" media driver, which was
now fixed by Stanimir Varbanov after long discussions.

In order to make some progress here, I have now ported his
approach over to the adreno driver. The patch is currently
untested, and should get a good review, but it is now much
simpler than the original, and it should be obvious what
goes wrong if I made a mistake in the port.

See also: a6e2d36bf6b7 ("media: venus: don't abuse dma_alloc for non-DMA 
allocations")
Cc: Stanimir Varbanov <stanimir.varba...@linaro.org>
Fixes: 7c65817e6d38 ("drm/msm: gpu: Enable zap shader for A5XX")
Acked-and-Tested-by: Jordan Crouse <jcro...@codeaurora.org>
Signed-off-by: Arnd Bergmann <a...@arndb.de>
---
I think we want this to be applied for 4.13, as the upstream
code that was added in the merge window is seriously broken
without it. Resending this separately now, please apply this
and "[PATCH 1/2] drm/msm: gpu: call qcom_mdt interfaces only for
ARCH_QCOM".

v3: fix typo and wrong comment found by Jordan
v2: rewrite based on Stanimir's venus patch
---
 drivers/gpu/drm/msm/adreno/a5xx_gpu.c | 72 +++
 drivers/gpu/drm/msm/adreno/a5xx_gpu.h |  2 -
 2 files changed, 23 insertions(+), 51 deletions(-)

diff --git a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c 
b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
index 1d54c76a7778..e1138f6c823b 100644
--- a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
+++ b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
@@ -15,7 +15,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include "msm_gem.h"
 #include "msm_mmu.h"
@@ -29,6 +29,8 @@ static void a5xx_dump(struct msm_gpu *gpu);
 static int zap_shader_load_mdt(struct device *dev, const char *fwname)
 {
const struct firmware *fw;
+   struct device_node *np;
+   struct resource r;
phys_addr_t mem_phys;
ssize_t mem_size;
void *mem_region = NULL;
@@ -37,6 +39,21 @@ static int zap_shader_load_mdt(struct device *dev, const 
char *fwname)
if (!IS_ENABLED(CONFIG_ARCH_QCOM))
return -EINVAL;
 
+   np = of_get_child_by_name(dev->of_node, "zap-shader");
+   if (!np)
+   return -ENODEV;
+
+   np = of_parse_phandle(np, "memory-region", 0);
+   if (!np)
+   return -EINVAL;
+
+   ret = of_address_to_resource(np, 0, );
+   if (ret)
+   return ret;
+
+   mem_phys = r.start;
+   mem_size = resource_size();
+
/* Request the MDT file for the firmware */
ret = request_firmware(, fwname, dev);
if (ret) {
@@ -52,7 +69,7 @@ static int zap_shader_load_mdt(struct device *dev, const char 
*fwname)
}
 
/* Allocate memory for the firmware image */
-   mem_region = dmam_alloc_coherent(dev, mem_size, _phys, GFP_KERNEL);
+   mem_region = memremap(mem_phys, mem_size,  MEMREMAP_WC);
if (!mem_region) {
ret = -ENOMEM;
goto out;
@@ -70,6 +87,9 @@ static int zap_shader_load_mdt(struct device *dev, const char 
*fwname)
DRM_DEV_ERROR(dev, "Unable to authorize the image\n");
 
 out:
+   if (mem_region)
+   memunmap(mem_region);
+
release_firmware(fw);
 
return ret;
@@ -372,45 +392,6 @@ static int a5xx_zap_shader_resume(struct msm_gpu *gpu)
return ret;
 }
 
-/* Set up a child device to "own" the zap shader */
-static int a5xx_zap_shader_dev_init(struct device *parent, struct device *dev)
-{
-   struct device_node *node;
-   int ret;
-
-   if (dev->parent)
-   return 0;
-
-   /* Find the sub-node for the zap shader */
-   node = of_get_child_by_name(parent->of_node, "zap-shader");
-   if (!node) {
-   DRM_DEV_ERROR(parent, "zap-shader not found in device tree\n");
-   return -ENODEV;
-   }
-
-   dev->parent = parent;
-   dev->of_node = node;
-   dev_set_nam

[Freedreno] [PATCH 2/2] drm/msm: gpu: don't abuse dma_alloc for non-DMA allocations

2017-07-26 Thread Arnd Bergmann
In zap_shader_load_mdt(), we pass a pointer to a phys_addr_t
into dmam_alloc_coherent, which the compiler warns about:

drivers/gpu/drm/msm/adreno/a5xx_gpu.c: In function 'zap_shader_load_mdt':
drivers/gpu/drm/msm/adreno/a5xx_gpu.c:54:50: error: passing argument 3 of 
'dmam_alloc_coherent' from incompatible pointer type 
[-Werror=incompatible-pointer-types]

The returned DMA address is later passed on to a function that
takes a phys_addr_t, so it's clearly wrong to use the DMA
mapping interface here: the memory may be uncached, or the
address may be completely wrong if there is an IOMMU connected
to the device. What the code actually wants to do is to get
the physical address from the reserved-mem node. It goes through
the dma-mapping interfaces for obscure reasons, and this
apparently only works by chance, relying on specific bugs
in the error handling of the arm64 dma-mapping implementation.

The same problem existed in the "venus" media driver, which was
now fixed by Stanimir Varbanov after long discussions.

In order to make some progress here, I have now ported his
approach over to the adreno driver. The patch is currently
untested, and should get a good review, but it is now much
simpler than the original, and it should be obvious what
goes wrong if I made a mistake in the port.

See also: a6e2d36bf6b7 ("media: venus: don't abuse dma_alloc for non-DMA 
allocations")
Cc: Stanimir Varbanov <stanimir.varba...@linaro.org>
Fixes: 7c65817e6d38 ("drm/msm: gpu: Enable zap shader for A5XX")
Signed-off-by: Arnd Bergmann <a...@arndb.de>
---
I think we want this to be applied for 4.13, as the upstream
code that was added in the merge window is seriously broken without it
---
 drivers/gpu/drm/msm/adreno/a5xx_gpu.c | 71 ---
 drivers/gpu/drm/msm/adreno/a5xx_gpu.h |  2 -
 2 files changed, 23 insertions(+), 50 deletions(-)

diff --git a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c 
b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
index 1d54c76a7778..ce545b3a9d17 100644
--- a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
+++ b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
@@ -15,7 +15,7 @@
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include "msm_gem.h"
 #include "msm_mmu.h"
@@ -29,6 +29,8 @@ static void a5xx_dump(struct msm_gpu *gpu);
 static int zap_shader_load_mdt(struct device *dev, const char *fwname)
 {
const struct firmware *fw;
+   struct device_node *np;
+   struct resource r;
phys_addr_t mem_phys;
ssize_t mem_size;
void *mem_region = NULL;
@@ -37,6 +39,21 @@ static int zap_shader_load_mdt(struct device *dev, const 
char *fwname)
if (!IS_ENABLED(CONFIG_ARCH_QCOM))
return -EINVAL;
 
+   np = of_get_child_by_name(dev->of_node, "zap-shader");
+   if (!np)
+   return -ENODEV;
+
+   np = of_parse_phandle(dev->of_node, "memory-region", 0);
+   if (!np)
+   return -EINVAL;
+
+   ret = of_address_to_resource(np, 0, );
+   if (ret)
+   return ret;
+
+   mem_phys = r.start;
+   mem_size = resource_size();
+
/* Request the MDT file for the firmware */
ret = request_firmware(, fwname, dev);
if (ret) {
@@ -52,7 +69,7 @@ static int zap_shader_load_mdt(struct device *dev, const char 
*fwname)
}
 
/* Allocate memory for the firmware image */
-   mem_region = dmam_alloc_coherent(dev, mem_size, _phys, GFP_KERNEL);
+   mem_region = memremap(mem_phys, mem_size,  MEMREMAP_WC);
if (!mem_region) {
ret = -ENOMEM;
goto out;
@@ -70,6 +87,9 @@ static int zap_shader_load_mdt(struct device *dev, const char 
*fwname)
DRM_DEV_ERROR(dev, "Unable to authorize the image\n");
 
 out:
+   if (mem_region)
+   memunmap(mem_region);
+
release_firmware(fw);
 
return ret;
@@ -373,44 +393,6 @@ static int a5xx_zap_shader_resume(struct msm_gpu *gpu)
 }
 
 /* Set up a child device to "own" the zap shader */
-static int a5xx_zap_shader_dev_init(struct device *parent, struct device *dev)
-{
-   struct device_node *node;
-   int ret;
-
-   if (dev->parent)
-   return 0;
-
-   /* Find the sub-node for the zap shader */
-   node = of_get_child_by_name(parent->of_node, "zap-shader");
-   if (!node) {
-   DRM_DEV_ERROR(parent, "zap-shader not found in device tree\n");
-   return -ENODEV;
-   }
-
-   dev->parent = parent;
-   dev->of_node = node;
-   dev_set_name(dev, "adreno_zap_shader");
-
-   ret = device_register(dev);
-   if (ret) {
-   DRM_DEV_ERROR(parent, "Couldn't register zap shader device\n");
-   goto out;
-   }
-
-   ret = of_reserved_mem_device_init(dev);
-   if (ret) {
-  

[Freedreno] [PATCH 2/2] drm/msm: gpu: call qcom_mdt interfaces only for ARCH_QCOM

2017-06-20 Thread Arnd Bergmann
When compile-testing for something other than ARCH_QCOM,
we run into a link error:

drivers/gpu/drm/msm/adreno/a5xx_gpu.o: In function `a5xx_hw_init':
a5xx_gpu.c:(.text.a5xx_hw_init+0x600): undefined reference to 
`qcom_mdt_get_size'
a5xx_gpu.c:(.text.a5xx_hw_init+0x93c): undefined reference to `qcom_mdt_load'

There is already an #ifdef that tries to check for CONFIG_QCOM_MDT_LOADER,
but that symbol is only meaningful when building for ARCH_QCOM.

This adds a compile-time check for ARCH_QCOM, and clarifies the
Kconfig select statement so we don't even try it for other targets.

The check for CONFIG_QCOM_MDT_LOADER can then go away, which also
improves compile-time coverage and makes the code a little nicer
to read.

Fixes: 7c65817e6d38 ("drm/msm: gpu: Enable zap shader for A5XX")
Signed-off-by: Arnd Bergmann <a...@arndb.de>
---
 drivers/gpu/drm/msm/Kconfig   |  2 +-
 drivers/gpu/drm/msm/adreno/a5xx_gpu.c | 11 +++
 2 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/drivers/gpu/drm/msm/Kconfig b/drivers/gpu/drm/msm/Kconfig
index b638d192ce5e..99d39b2aefa6 100644
--- a/drivers/gpu/drm/msm/Kconfig
+++ b/drivers/gpu/drm/msm/Kconfig
@@ -5,7 +5,7 @@ config DRM_MSM
depends on ARCH_QCOM || (ARM && COMPILE_TEST)
depends on OF && COMMON_CLK
depends on MMU
-   select QCOM_MDT_LOADER
+   select QCOM_MDT_LOADER if ARCH_QCOM
select REGULATOR
select DRM_KMS_HELPER
select DRM_PANEL
diff --git a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c 
b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
index eee9ac81aaa1..b719a5b5b88a 100644
--- a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
+++ b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
@@ -26,8 +26,6 @@ static void a5xx_dump(struct msm_gpu *gpu);
 
 #define GPU_PAS_ID 13
 
-#if IS_ENABLED(CONFIG_QCOM_MDT_LOADER)
-
 static int zap_shader_load_mdt(struct device *dev, const char *fwname)
 {
const struct firmware *fw;
@@ -36,6 +34,9 @@ static int zap_shader_load_mdt(struct device *dev, const char 
*fwname)
void *mem_region = NULL;
int ret;
 
+   if (!IS_ENABLED(CONFIG_ARCH_QCOM))
+   return -EINVAL;
+
/* Request the MDT file for the firmware */
ret = request_firmware(, fwname, dev);
if (ret) {
@@ -75,12 +76,6 @@ static int zap_shader_load_mdt(struct device *dev, const 
char *fwname)
 
return ret;
 }
-#else
-static int zap_shader_load_mdt(struct device *dev, const char *fwname)
-{
-   return -ENODEV;
-}
-#endif
 
 static void a5xx_submit(struct msm_gpu *gpu, struct msm_gem_submit *submit,
struct msm_file_private *ctx)
-- 
2.9.0

___
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno


[Freedreno] [PATCH 1/2] drm/msm: gpu: don't abuse dma_alloc for non-DMA allocations

2017-06-20 Thread Arnd Bergmann
In zap_shader_load_mdt(), we pass a pointer to a phys_addr_t
into dmam_alloc_coherent, which the compiler warns about:

drivers/gpu/drm/msm/adreno/a5xx_gpu.c: In function 'zap_shader_load_mdt':
drivers/gpu/drm/msm/adreno/a5xx_gpu.c:54:50: error: passing argument 3 of 
'dmam_alloc_coherent' from incompatible pointer type 
[-Werror=incompatible-pointer-types]

The returned DMA address is later passed on to a function that
takes a phys_addr_t, so it's clearly wrong to use the DMA
mapping interface here: the memory may be uncached, or the
address may be completely wrong if there is an IOMMU connected
to the device.

My interpretation is that using dmam_alloc_coherent() had two
purposes:

 a) get a chunk of consecutive memory that may be larger than
the limit for kmalloc()

 b) use the devres infrastructure to simplify the unwinding
in the error case.

I think ideally we'd use a devres-based version of
alloc_pages_exact() here, but since that doesn't exist,
let's use devm_get_free_pages() instead. This wastes a little
memory as the size gets rounded up to a power of two, but
is otherwise harmless. If we want to save memory here, calling
devm_free_pages() to release the memory once it is no longer
needed is probably better anyway.

Fixes: 7c65817e6d38 ("drm/msm: gpu: Enable zap shader for A5XX")
Signed-off-by: Arnd Bergmann <a...@arndb.de>
---
 drivers/gpu/drm/msm/adreno/a5xx_gpu.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c 
b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
index b4b54f1c24bc..eee9ac81aaa1 100644
--- a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
+++ b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
@@ -51,11 +51,13 @@ static int zap_shader_load_mdt(struct device *dev, const 
char *fwname)
}
 
/* Allocate memory for the firmware image */
-   mem_region = dmam_alloc_coherent(dev, mem_size, _phys, GFP_KERNEL);
+   mem_region = (void *)devm_get_free_pages(dev, GFP_KERNEL,
+   get_order(mem_size));
if (!mem_region) {
ret = -ENOMEM;
goto out;
}
+   mem_phys = virt_to_phys(mem_region);
 
/* Load the rest of the MDT */
ret = qcom_mdt_load(dev, fw, fwname, GPU_PAS_ID, mem_region, mem_phys,
-- 
2.9.0

___
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno


[Freedreno] [PATCH] drm/msm: add stubs for msm_{perf, rd}_debugfs_cleanup

2017-03-20 Thread Arnd Bergmann
We now call those two functions even when they are not defined
or declared anywhere because DEBUG_FS is disabled:

drivers/gpu/drm/msm/msm_drv.c: In function 'msm_drm_uninit':
drivers/gpu/drm/msm/msm_drv.c:244:2: error: implicit declaration of function 
'msm_perf_debugfs_cleanup';did you mean 'msm_framebuffer_cleanup'? 
[-Werror=implicit-function-declaration]
drivers/gpu/drm/msm/msm_drv.c:245:2: error: implicit declaration of function 
'msm_rd_debugfs_cleanup';did you mean 'msm_framebuffer_cleanup'? 
[-Werror=implicit-function-declaration]

This adds empty stub implementations for that case.

Fixes: 85eac4700ede ("drm/msm: Remove msm_debugfs_cleanup()")
Signed-off-by: Arnd Bergmann <a...@arndb.de>
---
 drivers/gpu/drm/msm/msm_drv.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h
index b51fb0d70f43..b885c3d5ae4d 100644
--- a/drivers/gpu/drm/msm/msm_drv.h
+++ b/drivers/gpu/drm/msm/msm_drv.h
@@ -311,6 +311,8 @@ void msm_perf_debugfs_cleanup(struct msm_drm_private *priv);
 #else
 static inline int msm_debugfs_late_init(struct drm_device *dev) { return 0; }
 static inline void msm_rd_dump_submit(struct msm_gem_submit *submit) {}
+static inline void msm_rd_debugfs_cleanup(struct msm_drm_private *priv) {}
+static inline void msm_perf_debugfs_cleanup(struct msm_drm_private *priv) {}
 #endif
 
 struct clk *msm_clk_get(struct platform_device *pdev, const char *name);
-- 
2.9.0

___
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno


[Freedreno] [PATCH 2/2] drm: add more MMU dependencies

2017-01-11 Thread Arnd Bergmann
Many DRM drivers only work with an MMU, and after the patch to enable
core DRM support without MMU, we already had one fixup for many of them.
The etnaviv, armada and msm drivers were missed and have the same problem:

warning: (DRM_ETNAVIV) selects IOMMU_SUPPORT which has unmet direct 
dependencies (MMU)
warning: (DRM_I915 && DRM_MSM && DRM_ETNAVIV) selects SHMEM which has unmet 
direct dependencies (MMU)
drivers/gpu/drm/armada/armada_gem.o: In function `armada_gem_vm_fault':
armada_gem.c:(.text.armada_gem_vm_fault+0x14): undefined reference to 
`vm_insert_pfn'
arch/arm/mm/dma-mapping.c: In function '__iommu_alloc_remap':
arch/arm/mm/dma-mapping.c:1390:4: error: 'VM_ARM_DMA_CONSISTENT' undeclared 
(first use in this function)
arch/arm/mm/dma-mapping.c:1456:31: error: 'atomic_pool' undeclared (first use 
in this function); did you mean 'atomic_xor'?

Fixes: 011cda589938 ("drm: fix compilations issues introduced by "drm: allow to 
use mmuless SoC"")
Fixes: 62a0d98a188c ("drm: allow to use mmuless SoC")
Signed-off-by: Arnd Bergmann <a...@arndb.de>
---
 drivers/gpu/drm/armada/Kconfig  | 2 +-
 drivers/gpu/drm/etnaviv/Kconfig | 1 +
 drivers/gpu/drm/msm/Kconfig | 1 +
 3 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/armada/Kconfig b/drivers/gpu/drm/armada/Kconfig
index 15f3ecfb16f1..eafaeeb7b5b1 100644
--- a/drivers/gpu/drm/armada/Kconfig
+++ b/drivers/gpu/drm/armada/Kconfig
@@ -1,6 +1,6 @@
 config DRM_ARMADA
tristate "DRM support for Marvell Armada SoCs"
-   depends on DRM && HAVE_CLK && ARM
+   depends on DRM && HAVE_CLK && ARM && MMU
select DRM_KMS_HELPER
help
  Support the "LCD" controllers found on the Marvell Armada 510
diff --git a/drivers/gpu/drm/etnaviv/Kconfig b/drivers/gpu/drm/etnaviv/Kconfig
index 2cde7a5442fb..656c061b439d 100644
--- a/drivers/gpu/drm/etnaviv/Kconfig
+++ b/drivers/gpu/drm/etnaviv/Kconfig
@@ -3,6 +3,7 @@ config DRM_ETNAVIV
tristate "ETNAVIV (DRM support for Vivante GPU IP cores)"
depends on DRM
depends on ARCH_MXC || ARCH_DOVE
+   depends on MMU
select SHMEM
select TMPFS
select IOMMU_API
diff --git a/drivers/gpu/drm/msm/Kconfig b/drivers/gpu/drm/msm/Kconfig
index d96b2b6898a3..7f78da695dff 100644
--- a/drivers/gpu/drm/msm/Kconfig
+++ b/drivers/gpu/drm/msm/Kconfig
@@ -4,6 +4,7 @@ config DRM_MSM
depends on DRM
depends on ARCH_QCOM || (ARM && COMPILE_TEST)
depends on OF && COMMON_CLK
+   depends on MMU
select REGULATOR
select DRM_KMS_HELPER
select DRM_PANEL
-- 
2.9.0

___
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno


[Freedreno] [PATCH] drm/msm: adreno: fix build error without debugfs

2016-11-30 Thread Arnd Bergmann
The newly added a5xx support fails to build when debugfs is diabled:

drivers/gpu/drm/msm/adreno/a5xx_gpu.c:849:4: error: 'struct msm_gpu_funcs' has 
no member named 'show'
drivers/gpu/drm/msm/adreno/a5xx_gpu.c:849:11: error: 'a5xx_show' undeclared 
here (not in a function); did you mean 'a5xx_irq'?

This adds a missing #ifdef.

Fixes: b5f103ab98c7 ("drm/msm: gpu: Add A5XX target support")
Signed-off-by: Arnd Bergmann <a...@arndb.de>
---
 drivers/gpu/drm/msm/adreno/a5xx_gpu.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c 
b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
index b8647198c11c..657874077400 100644
--- a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
+++ b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
@@ -846,7 +846,9 @@ static const struct adreno_gpu_funcs funcs = {
.idle = a5xx_idle,
.irq = a5xx_irq,
.destroy = a5xx_destroy,
+#ifdef CONFIG_DEBUG_FS
.show = a5xx_show,
+#endif
},
.get_timestamp = a5xx_get_timestamp,
 };
-- 
2.9.0

___
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno


Re: [Freedreno] [PATCH 1/2] drm/msm: add missing header dependencies

2016-10-24 Thread Arnd Bergmann
On Saturday, October 22, 2016 5:17:45 PM CEST Baoyou Xie wrote:
> We get 2 warnings when building kernel with W=1:
> drivers/gpu/drm/msm/msm_debugfs.c:141:5: warning: no previous prototype for 
> 'msm_debugfs_init' [-Wmissing-prototypes]
> drivers/gpu/drm/msm/msm_debugfs.c:158:6: warning: no previous prototype for 
> 'msm_debugfs_cleanup' [-Wmissing-prototypes]
> 
> In fact, these functions are declared in
> drivers/gpu/drm/msm/msm_debugfs.h.
> So this patch adds missing header dependencies.
> 
> Signed-off-by: Baoyou Xie <baoyou@linaro.org>
> 

Both patches

Reviewed-by: Arnd Bergmann <a...@arndb.de>

Strangely, something caused the second mail to show up as a reply to the
first. No idea how that happened, but you may want to check the procedure
you used for sending the mails.

Arnd
___
Freedreno mailing list
Freedreno@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/freedreno