Re: [PATCH 6/6] drm/msm/gpu: add ocmem init/cleanup functions

From: Bjorn Andersson
Date: Sun Jun 16 2019 - 23:47:54 EST


On Sun 16 Jun 17:18 PDT 2019, Brian Masney wrote:

> Hi Bjorn,
>
> On Sun, Jun 16, 2019 at 11:06:33AM -0700, Bjorn Andersson wrote:
> > > diff --git a/drivers/gpu/drm/msm/adreno/adreno_gpu.c b/drivers/gpu/drm/msm/adreno/adreno_gpu.c
> > > index 6f7f4114afcf..e0a9409c8a32 100644
> > > --- a/drivers/gpu/drm/msm/adreno/adreno_gpu.c
> > > +++ b/drivers/gpu/drm/msm/adreno/adreno_gpu.c
> > > @@ -29,6 +29,10 @@
> > > #include "msm_gem.h"
> > > #include "msm_mmu.h"
> > >
> > > +#ifdef CONFIG_QCOM_OCMEM
> > > +# include <soc/qcom/ocmem.h>
> > > +#endif
> >
> > This file exists (after the previous patch), so no need to make its
> > inclusion conditional.
> >
> > > +
> > > static bool zap_available = true;
> > >
> > > static int zap_shader_load_mdt(struct msm_gpu *gpu, const char *fwname,
> > > @@ -897,6 +901,43 @@ static int adreno_get_pwrlevels(struct device *dev,
> > > return 0;
> > > }
> > >
> > > +int adreno_gpu_ocmem_init(struct device *dev, struct adreno_gpu *adreno_gpu,
> > > + struct adreno_ocmem *adreno_ocmem)
> > > +{
> > > +#ifdef CONFIG_QCOM_OCMEM
> >
> > No need to make this conditional.
>
> I have these #ifdefs for the a5xx and a6xx GPUs that don't have ocmem
> in the SoC. Without the #ifdefs, those systems would need to have the
> ocmem driver in their kernel.
>

In order to provide the means for compiling a kernel for a[56]xx without
having to compile ocmem you should move these #ifdef to the ocmem
header file and provide static inline dummies for the case when it's
not.

(and use #if IS_ENABLED(CONFIG_FOO))

Don't forget to add
depends on QCOM_OCMEM || QCOM_OCMEM=n

to the DRM_MSM config option, to allow the driver pair to be selected in
all possible ways.

> Thanks for the quick review on the patch set!
>

Regards,
Bjorn