Re: [Intel-gfx] [PATCH v2 2/2] drm/i915: enable W=1 warnings by default

2023-10-11 Thread Masahiro Yamada
On Wed, Oct 11, 2023 at 4:29 PM Jani Nikula  wrote:
>
> We enable a bunch more compiler warnings than the kernel
> defaults. However, they've drifted to become a unique set of warnings,
> and have increasingly fallen behind from the W=1 set.
>
> Align with the W=1 warnings from scripts/Makefile.extrawarn for clarity,
> by copy-pasting them with s/KBUILD_CFLAGS/subdir-ccflags-y/ to make it
> easier to compare in the future.
>
> Some of the -Wextra warnings do need to be disabled, just like in
> Makefile.extrawarn, but take care to not disable them for W=2 or W=3
> builds, depending on the warning.
>
> v2: Add back some -Wextra warning disables (Nathan)
>
> Cc: Arnd Bergmann 
> Cc: Nick Desaulniers 
> Cc: Nathan Chancellor 
> Cc: Masahiro Yamada 
> Reviewed-by: Nathan Chancellor 
> Signed-off-by: Jani Nikula 

Reviewed-by: Masahiro Yamada 


-- 
Best Regards
Masahiro Yamada


Re: [Intel-gfx] [PATCH v2 1/2] drm/i915: drop -Wall and related disables from cflags as redundant

2023-10-11 Thread Masahiro Yamada
On Wed, Oct 11, 2023 at 4:29 PM Jani Nikula  wrote:
>
> The kernel top level Makefile, and recently scripts/Makefile.extrawarn,
> have included -Wall, and the disables -Wno-format-security and
> $(call cc-disable-warning,frame-address,) for a very long time. They're
> redundant in our local subdir-ccflags-y and can be dropped.
>
> Cc: Arnd Bergmann 
> Cc: Nick Desaulniers 
> Cc: Nathan Chancellor 
> Cc: Masahiro Yamada 
> Reviewed-by: Nathan Chancellor 
> Acked-by: Nick Desaulniers 
> Signed-off-by: Jani Nikula 
> ---

Reviewed-by: Masahiro Yamada 



-- 
Best Regards
Masahiro Yamada


Re: [Intel-gfx] [PATCH 1/2] drm/i915: drop -Wall and related disables from cflags as redundant

2023-10-07 Thread Masahiro Yamada
On Fri, Oct 6, 2023 at 9:35 PM Jani Nikula  wrote:
>
> The kernel top level Makefile, and recently scripts/Makefile.extrawarn,
> have included -Wall, and the disables -Wno-format-security and
> $(call cc-disable-warning,frame-address,) for a very long time. They're
> redundant in our local subdir-ccflags-y and can be dropped.
>
> Cc: Arnd Bergmann 
> Cc: Nick Desaulniers 
> Cc: Nathan Chancellor 
> Cc: Masahiro Yamada 
> Signed-off-by: Jani Nikula 


I made a similar suggestion in the past
https://lore.kernel.org/dri-devel/20190515043753.9853-1-yamada.masah...@socionext.com/

So, I am glad that Intel has decided to de-duplicate the flags.



I think you can drop more flags.

For example,

 subdir-ccflags-y += -Wno-sign-compare


It is set by scripts/Makefile.extrawarn
unless W=3 is passed.


If W=3 is set by a user, -Wsign-compare should be warned
as it is the user's request.


drivers/gpu/drm/i915/Makefile negates W=3.
There is no good reason to do so.


Same applied to


subdir-ccflags-y += -Wno-shift-negative-value






> ---
>  drivers/gpu/drm/i915/Makefile | 8 +++-
>  1 file changed, 3 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile
> index dec78efa452a..623f81217442 100644
> --- a/drivers/gpu/drm/i915/Makefile
> +++ b/drivers/gpu/drm/i915/Makefile
> @@ -5,22 +5,20 @@
>
>  # Add a set of useful warning flags and enable -Werror for CI to prevent
>  # trivial mistakes from creeping in. We have to do this piecemeal as we 
> reject
> -# any patch that isn't warning clean, so turning on -Wall -Wextra (or W=1) we
> +# any patch that isn't warning clean, so turning on -Wextra (or W=1) we
>  # need to filter out dubious warnings.  Still it is our interest
>  # to keep running locally with W=1 C=1 until we are completely clean.
>  #
> -# Note the danger in using -Wall -Wextra is that when CI updates gcc we
> +# Note the danger in using -Wextra is that when CI updates gcc we
>  # will most likely get a sudden build breakage... Hopefully we will fix
>  # new warnings before CI updates!
> -subdir-ccflags-y := -Wall -Wextra
> -subdir-ccflags-y += -Wno-format-security
> +subdir-ccflags-y := -Wextra
>  subdir-ccflags-y += -Wno-unused-parameter
>  subdir-ccflags-y += -Wno-type-limits
>  subdir-ccflags-y += -Wno-missing-field-initializers
>  subdir-ccflags-y += -Wno-sign-compare
>  subdir-ccflags-y += -Wno-shift-negative-value
>  subdir-ccflags-y += $(call cc-option, -Wunused-but-set-variable)
> -subdir-ccflags-y += $(call cc-disable-warning, frame-address)
>  subdir-ccflags-$(CONFIG_DRM_I915_WERROR) += -Werror
>
>  # Fine grained warnings disable
> --
> 2.39.2
>


--
Best Regards
Masahiro Yamada


Re: [Intel-gfx] [PATCH] drm/i915: enable kernel-doc warnings for CONFIG_DRM_I915_WERROR=y

2023-04-03 Thread Masahiro Yamada
On Fri, Mar 31, 2023 at 7:15 PM Jani Nikula  wrote:
>
> Increase awareness of kernel-doc issues by enabling doc check locally
> when W= is *not* specified on the make command-line, but
> CONFIG_DRM_I915_WERROR=y is enabled.
>
> Once the warnings have been fixed, we can pass -Werror to kernel-doc
> locally, and fail the build when there are kernel-doc warnings in i915.
>
> Cc: Masahiro Yamada 
> Signed-off-by: Jani Nikula 
>
> ---
>
> Masahiro, is this an awful hack to do in our local Makefile?
>
> Note that we do try to avoid anyone outside of i915 developers enabling
> CONFIG_DRM_I915_WERROR=y.
>
> Any other and cleaner ways of achieving this, without using W= on the
> entire kernel?
>
> On that note, it would be nice to be able to enable W= on a subdir
> alone.
> ---
>  drivers/gpu/drm/i915/Makefile | 8 
>  1 file changed, 8 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile
> index 057ef22fa9c6..13d7040801bf 100644
> --- a/drivers/gpu/drm/i915/Makefile
> +++ b/drivers/gpu/drm/i915/Makefile
> @@ -369,6 +369,14 @@ include $(src)/gvt/Makefile
>  obj-$(CONFIG_DRM_I915) += i915.o
>  obj-$(CONFIG_DRM_I915_GVT_KVMGT) += kvmgt.o
>
> +# kernel-doc test
> +#
> +# Enable locally for CONFIG_DRM_I915_WERROR=y if not already enabled.
> +# See scripts/Makefile.build
> +ifeq ($(KBUILD_EXTRA_WARN)$(CONFIG_DRM_I915_WERROR),y)
> +cmd_checkdoc = $(srctree)/scripts/kernel-doc -none $<
> +endif
>


I do not mind this, but I do not think you need to
check $(KBUILD_EXTRA_WARN).



ifdef CONFIG_DRM_I915_WERROR
cmd_checkdoc = $(srctree)/scripts/kernel-doc -none $<
endif




-- 
Best Regards
Masahiro Yamada


Re: [Intel-gfx] [PATCH] [v2] Kbuild: move to -std=gnu11

2022-03-01 Thread Masahiro Yamada
On Mon, Feb 28, 2022 at 7:32 PM Arnd Bergmann  wrote:
>
> From: Arnd Bergmann 
>
> During a patch discussion, Linus brought up the option of changing
> the C standard version from gnu89 to gnu99, which allows using variable
> declaration inside of a for() loop. While the C99, C11 and later standards
> introduce many other features, most of these are already available in
> gnu89 as GNU extensions as well.
>
> An earlier attempt to do this when gcc-5 started defaulting to
> -std=gnu11 failed because at the time that caused warnings about
> designated initializers with older compilers. Now that gcc-5.1 is the
> minimum compiler version used for building kernels, that is no longer a
> concern. Similarly, the behavior of 'inline' functions changes between
> gnu89 and gnu11, but this was taken care of by defining 'inline' to
> include __attribute__((gnu_inline)) in order to allow building with
> clang a while ago.
>
> One minor issue that remains is an added gcc warning for shifts of
> negative integers when building with -Werror, which happens with the

Is this a typo?

   building with -Werror, ...
->
   building with -Wextra, ...




> 'make W=1' option, as well as for three drivers in the kernel that always
> enable -Werror, but it was only observed with the i915 driver so far.

Same here.

   enable -Werror, but ...
->
  enable -Wextra, but ...




Otherwise,

Acked-by: Masahiro Yamada 


Please let me know if you want me to pick up this.









--
Best Regards

Masahiro Yamada


Re: [Intel-gfx] [PATCH] [v2] Kbuild: move to -std=gnu11

2022-03-01 Thread Masahiro Yamada
On Mon, Feb 28, 2022 at 8:25 PM Mark Rutland  wrote:
>
> Hi Arnd,
>
> This is great!
>
> On Mon, Feb 28, 2022 at 11:27:43AM +0100, Arnd Bergmann wrote:
> > From: Arnd Bergmann 
> >
> > During a patch discussion, Linus brought up the option of changing
> > the C standard version from gnu89 to gnu99, which allows using variable
> > declaration inside of a for() loop. While the C99, C11 and later standards
> > introduce many other features, most of these are already available in
> > gnu89 as GNU extensions as well.
> >
> > An earlier attempt to do this when gcc-5 started defaulting to
> > -std=gnu11 failed because at the time that caused warnings about
> > designated initializers with older compilers. Now that gcc-5.1 is the
> > minimum compiler version used for building kernels, that is no longer a
> > concern. Similarly, the behavior of 'inline' functions changes between
> > gnu89 and gnu11, but this was taken care of by defining 'inline' to
> > include __attribute__((gnu_inline)) in order to allow building with
> > clang a while ago.
> >
> > One minor issue that remains is an added gcc warning for shifts of
> > negative integers when building with -Werror, which happens with the
> > 'make W=1' option, as well as for three drivers in the kernel that always
> > enable -Werror, but it was only observed with the i915 driver so far.
> > To be on the safe side, add -Wno-shift-negative-value to any -Wextra
> > in a Makefile.
> >
> > Nathan Chancellor reported an additional -Wdeclaration-after-statement
> > warning that appears in a system header on arm, this still needs a
> > workaround.
>
> FWIW, I had a go at moving to c99 a few weeks ago (to be able to use
> for-loop-declarations in some concurrency primitives), and when I tried, I 
> also
> saw declaration-after-statement warnings when building modpost.c, which is 
> easy
> enough to fix:
>
>   
> https://git.kernel.org/pub/scm/linux/kernel/git/mark/linux.git/commit/?h=treewide/gnu99=505775bd6fd0bc1883f3271f826963066bbdc194
>


I do not understand this statement:

"Usually such warnings are implciitly enabled as part of `-std=gnu89`,
 and in preparation for changing the standard used, this patch explciitly
enales the warnings with `-Wdeclaration-after-statement`, which takes
effect regardless of which version of the C standard is in use."



modpost is already built with -std=gnu89.

If  Wdeclaration-after-statement is implied by gnu89,
why did nobody notice this before?


-- 
Best Regards
Masahiro Yamada


Re: [Intel-gfx] [PATCH v3] drm/i915: remove IS_ACTIVE

2021-10-07 Thread Masahiro Yamada
On Wed, Oct 6, 2021 at 2:21 AM Lucas De Marchi  wrote:
>
> When trying to bring IS_ACTIVE to linux/kconfig.h I thought it wouldn't
> provide much value just encapsulating it in a boolean context. So I also
> added the support for handling undefined macros as the IS_ENABLED()
> counterpart. However the feedback received from Masahiro Yamada was that
> it is too ugly, not providing much value. And just wrapping in a boolean
> context is too dumb - we could simply open code it.
>
> As detailed in commit babaab2f4738 ("drm/i915: Encapsulate kconfig
> constant values inside boolean predicates"), the IS_ACTIVE macro was
> added to workaround a compilation warning. However after checking again
> our current uses of IS_ACTIVE it turned out there is only
> 1 case in which it triggers a warning in clang (due
> -Wconstant-logical-operand) and 2 in smatch. All the others
> can simply use the shorter version, without wrapping it in any macro.
>
> So here I'm dialing all the way back to simply removing the macro. That
> single case hit by clang can be changed to make the constant come first,
> so it doesn't think it's mask:
>
> -   if (context && CONFIG_DRM_I915_FENCE_TIMEOUT)
> +   if (CONFIG_DRM_I915_FENCE_TIMEOUT && context)
>
> As talked with Dan Carpenter, that logic will be added in smatch as
> well, so it will also stop warning about it.
>
> Signed-off-by: Lucas De Marchi 
> Acked-by: Jani Nikula 

Reviewed-by: Masahiro Yamada 





-- 
Best Regards
Masahiro Yamada


Re: [Intel-gfx] [PATCH v2 3/3] Move IS_CONFIG_NONZERO() to kconfig.h

2021-10-01 Thread Masahiro Yamada
On Fri, Oct 1, 2021 at 12:55 AM Lucas De Marchi
 wrote:
>
> On Thu, Sep 30, 2021 at 11:01:36PM +0900, Masahiro Yamada wrote:
> >On Thu, Sep 30, 2021 at 3:34 AM Lucas De Marchi
> > wrote:
> >>
> >> The check for config value doesn't really belong to i915_utils.h - we
> >> are trying to eliminate that utils helper and share them when possible
> >> with other drivers and subsystems.
> >>
> >> Rationale for having such macro is in commit
> >> babaab2f4738 ("drm/i915: Encapsulate kconfig constant values inside 
> >> boolean predicates")
> >> whereas later it is improved to not break the build if used with
> >> undefined configs. The caveat is detailed in the documentation: unlike
> >> IS_ENABLED(): it's not preprocessor-only logic so can't be used for
> >> things like `#if IS_CONFIG_NONZERO(...)`
> >>
> >> Signed-off-by: Lucas De Marchi 
> >
> >
> >Hypothetical "it would be nice to have ..." is really unneeded.
> >
> >   if (context && CONFIG_DRM_I915_FENCE_TIMEOUT > 0)
> > return
> >msecs_to_jiffies_timeout(CONFIG_DRM_I915_FENCE_TIMEOUT);
> >
> >
> >is enough, and much cleaner.
> >
> >
> >
> >This warning is shown only when a constant is used
> >together with '&&'.
> >
> >Most of IS_ACTIVE can go away.
> >
> >Given that, there are not many places where the IS_ACTIVE macro
> >is useful, even in the i915 driver.
> >
> >For a few sources of the warnings,
> >replacing it with  != 0 or > 0 is just fine.
>
> humn... maybe. Let me do a conversion in that direction and see what is
> the outcome.
>
> My original intention was to make IS_ENABLED() even uglier to cover the
> int case, but after some tries it seems impossible to do on preprocessor
> context, so I thought maybe it would be ok as a separate one.
>
> >
> >Of course, such an ugly macro is not worth being moved to 
>
> if we don't handle the undefined case and only worry about encapsulating
> it inside a boolean predicate, the macro would be very simple. Would
> that be worth having in kconfig.h maybe?


I do not think so.

#define IS_CONFIG_NONZERO(config) ((config) != 0)

seems like a stupid macro.


What is bad about writing the direct code?

 if (x && CONFIG_FOO > 0)
   





>
>
> thanks
> Lucas De Marchi



-- 
Best Regards
Masahiro Yamada


Re: [Intel-gfx] [PATCH v2 3/3] Move IS_CONFIG_NONZERO() to kconfig.h

2021-09-30 Thread Masahiro Yamada
On Thu, Sep 30, 2021 at 3:34 AM Lucas De Marchi
 wrote:
>
> The check for config value doesn't really belong to i915_utils.h - we
> are trying to eliminate that utils helper and share them when possible
> with other drivers and subsystems.
>
> Rationale for having such macro is in commit
> babaab2f4738 ("drm/i915: Encapsulate kconfig constant values inside boolean 
> predicates")
> whereas later it is improved to not break the build if used with
> undefined configs. The caveat is detailed in the documentation: unlike
> IS_ENABLED(): it's not preprocessor-only logic so can't be used for
> things like `#if IS_CONFIG_NONZERO(...)`
>
> Signed-off-by: Lucas De Marchi 


Hypothetical "it would be nice to have ..." is really unneeded.

   if (context && CONFIG_DRM_I915_FENCE_TIMEOUT > 0)
 return
msecs_to_jiffies_timeout(CONFIG_DRM_I915_FENCE_TIMEOUT);


is enough, and much cleaner.



This warning is shown only when a constant is used
together with '&&'.

Most of IS_ACTIVE can go away.

Given that, there are not many places where the IS_ACTIVE macro
is useful, even in the i915 driver.

For a few sources of the warnings,
replacing it with  != 0 or > 0 is just fine.

Of course, such an ugly macro is not worth being moved to 




-- 
Best Regards
Masahiro Yamada


Re: [Intel-gfx] linux-next: build failure after merge of the drm tree

2021-09-08 Thread Masahiro Yamada
On Mon, Sep 6, 2021 at 4:34 PM Daniel Vetter  wrote:
>
> On Mon, Sep 6, 2021 at 12:49 AM Stephen Rothwell  
> wrote:
> > Hi all,
> >
> > On Thu, 2 Sep 2021 07:50:38 +1000 Stephen Rothwell  
> > wrote:
> > >
> > > On Fri, 20 Aug 2021 15:23:34 +0900 Masahiro Yamada  
> > > wrote:
> > > >
> > > > On Fri, Aug 20, 2021 at 11:33 AM Stephen Rothwell 
> > > >  wrote:
> > > > >
> >  > > After merging the drm tree, today's linux-next build (x86_64 
> > allmodconfig)
> > > > > failed like this:
> > > > >
> > > > > In file included from drivers/gpu/drm/i915/i915_debugfs.c:39:
> > > > > drivers/gpu/drm/i915/gt/intel_gt_requests.h:9:10: fatal error: 
> > > > > stddef.h: No such file or directory
> > > > > 9 | #include 
> > > > >   |  ^~
> > > > >
> > > > > Caused by commit
> > > > >
> > > > >   564f963eabd1 ("isystem: delete global -isystem compile option")
> > > > >
> > > > > from the kbuild tree interacting with commit
> > > > >
> > > > >   b97060a99b01 ("drm/i915/guc: Update intel_gt_wait_for_idle to work 
> > > > > with GuC")
> > > > >
> > > > > I have applied the following patch for today.
> > > >
> > > >
> > > > Thanks.
> > > >
> > > > This fix-up does not depend on my kbuild tree in any way.
> > > >
> > > > So, the drm maintainer can apply it to his tree.
> > > >
> > > > Perhaps with
> > > >
> > > > Fixes: b97060a99b01 ("drm/i915/guc: Update intel_gt_wait_for_idle to
> > > > work with GuC")
> > >
> > > OK, so that didn't happen so I will now apply the merge fix up to the
> > > merge of the kbuild tree.
> > >
> > > > > From: Stephen Rothwell 
> > > > > Date: Fri, 20 Aug 2021 12:24:19 +1000
> > > > > Subject: [PATCH] drm/i915: use linux/stddef.h due to "isystem: 
> > > > > trim/fixup stdarg.h and other headers"
> > > > >
> > > > > Signed-off-by: Stephen Rothwell 
> > > > > ---
> > > > >  drivers/gpu/drm/i915/gt/intel_gt_requests.h | 2 +-
> > > > >  1 file changed, 1 insertion(+), 1 deletion(-)
> > > > >
> > > > > diff --git a/drivers/gpu/drm/i915/gt/intel_gt_requests.h 
> > > > > b/drivers/gpu/drm/i915/gt/intel_gt_requests.h
> > > > > index 51dbe0e3294e..d2969f68dd64 100644
> > > > > --- a/drivers/gpu/drm/i915/gt/intel_gt_requests.h
> > > > > +++ b/drivers/gpu/drm/i915/gt/intel_gt_requests.h
> > > > > @@ -6,7 +6,7 @@
> > > > >  #ifndef INTEL_GT_REQUESTS_H
> > > > >  #define INTEL_GT_REQUESTS_H
> > > > >
> > > > > -#include 
> > > > > +#include 
> > > > >
> > > > >  struct intel_engine_cs;
> > > > >  struct intel_gt;
> > > > > --
> > > > > 2.32.0
> >
> > Ping?  I am still applying this ...
>
> Apologies, this fell through a lot of cracks. I applied this to drm-next now.



Rather, I was planning to apply this fix to my kbuild tree.

Since you guys did not fix the issue in time,
I ended up with dropping [1] from my pull request.

I want to get [1] merged in this MW.

If I postponed it, somebody would add new
 or  inclusion in the next development
cycle, I will never make it in the mainline.

[1] https://lore.kernel.org/linux-kernel/YQhY40teUJcTc5H4@localhost.localdomain/





> Matt/John, as author/committer it's your job to make sure issues and
> fixes for the stuff you're pushing don't get lost. I'd have expected
> John to apply this to at least drm-intel-gt-next (it's not even
> there).
>
> Joonas, I think this is the 2nd or 3rd or so issue this release cycle
> where some compile fix got stuck a bit because drm-intel-gt-next isn't
> in linux-next. Can we please fix that? It probably needs some changes
> to the dim script.
>
> Cheers, Daniel
> --
> Daniel Vetter
> Software Engineer, Intel Corporation
> http://blog.ffwll.ch



-- 
Best Regards
Masahiro Yamada


Re: [Intel-gfx] [PATCH] kbuild: use always-y instead of extra-y

2021-01-27 Thread Masahiro Yamada
On Thu, Jan 21, 2021 at 6:39 AM Rob Herring  wrote:
>
> On Wed, Jan 20, 2021 at 03:23:51PM +0900, Masahiro Yamada wrote:
> > As commit d0e628cd817f ("kbuild: doc: clarify the difference between
> > extra-y and always-y") explained, extra-y should be used for listing
> > the prerequsites of vmlinux. always-y is a better fix here.
>
> prerequisites

Thanks.

I fixed it up, and applied to linux-kbuild.



> Glad to see this clarified. I think just tried both and picked one.
>
> Reviewed-by: Rob Herring 
> >
> > Signed-off-by: Masahiro Yamada 
> > ---
> >
> >  Documentation/devicetree/bindings/Makefile |  8 
> >  drivers/gpu/drm/i915/Makefile  |  2 +-
> >  scripts/Makefile.lib   | 10 +-
> >  scripts/gdb/linux/Makefile |  2 +-
> >  4 files changed, 11 insertions(+), 11 deletions(-)



-- 
Best Regards
Masahiro Yamada
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH] kbuild: use always-y instead of extra-y

2021-01-20 Thread Masahiro Yamada
As commit d0e628cd817f ("kbuild: doc: clarify the difference between
extra-y and always-y") explained, extra-y should be used for listing
the prerequsites of vmlinux. always-y is a better fix here.

Signed-off-by: Masahiro Yamada 
---

 Documentation/devicetree/bindings/Makefile |  8 
 drivers/gpu/drm/i915/Makefile  |  2 +-
 scripts/Makefile.lib   | 10 +-
 scripts/gdb/linux/Makefile |  2 +-
 4 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/Documentation/devicetree/bindings/Makefile 
b/Documentation/devicetree/bindings/Makefile
index 8f2b054bec5a..90fcad98984d 100644
--- a/Documentation/devicetree/bindings/Makefile
+++ b/Documentation/devicetree/bindings/Makefile
@@ -78,10 +78,10 @@ $(obj)/processed-schema.json: $(DT_SCHEMA_FILES) 
check_dtschema_version FORCE
 
 endif
 
-extra-$(CHECK_DT_BINDING) += processed-schema-examples.json
-extra-$(CHECK_DTBS) += processed-schema.json
-extra-$(CHECK_DT_BINDING) += $(patsubst $(src)/%.yaml,%.example.dts, 
$(DT_SCHEMA_FILES))
-extra-$(CHECK_DT_BINDING) += $(patsubst $(src)/%.yaml,%.example.dt.yaml, 
$(DT_SCHEMA_FILES))
+always-$(CHECK_DT_BINDING) += processed-schema-examples.json
+always-$(CHECK_DTBS)   += processed-schema.json
+always-$(CHECK_DT_BINDING) += $(patsubst $(src)/%.yaml,%.example.dts, 
$(DT_SCHEMA_FILES))
+always-$(CHECK_DT_BINDING) += $(patsubst $(src)/%.yaml,%.example.dt.yaml, 
$(DT_SCHEMA_FILES))
 
 # Hack: avoid 'Argument list too long' error for 'make clean'. Remove most of
 # build artifacts here before they are processed by scripts/Makefile.clean
diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile
index 6d9e81ea67f4..938221894d0c 100644
--- a/drivers/gpu/drm/i915/Makefile
+++ b/drivers/gpu/drm/i915/Makefile
@@ -294,7 +294,7 @@ no-header-test := \
gvt/mpt.h \
gvt/scheduler.h
 
-extra-$(CONFIG_DRM_I915_WERROR) += \
+always-$(CONFIG_DRM_I915_WERROR) += \
$(patsubst %.h,%.hdrtest, $(filter-out $(no-header-test), \
$(shell cd $(srctree)/$(src) && find * -name '*.h')))
 
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 4612a887f28e..b8e587a17dcc 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -64,12 +64,12 @@ always-y += $(userprogs-always-y) $(userprogs-always-m)
 
 # DTB
 # If CONFIG_OF_ALL_DTBS is enabled, all DT blobs are built
-extra-y+= $(dtb-y)
-extra-$(CONFIG_OF_ALL_DTBS)+= $(dtb-)
+always-y   += $(dtb-y)
+always-$(CONFIG_OF_ALL_DTBS)   += $(dtb-)
 
 ifneq ($(CHECK_DTBS),)
-extra-y += $(patsubst %.dtb,%.dt.yaml, $(dtb-y))
-extra-$(CONFIG_OF_ALL_DTBS) += $(patsubst %.dtb,%.dt.yaml, $(dtb-))
+always-y += $(patsubst %.dtb,%.dt.yaml, $(dtb-y))
+always-$(CONFIG_OF_ALL_DTBS) += $(patsubst %.dtb,%.dt.yaml, $(dtb-))
 endif
 
 # Add subdir path
@@ -230,7 +230,7 @@ $(obj)/%: $(src)/%_shipped
 #  target: source(s) FORCE
 #  $(if_changed,ld/objcopy/gzip)
 #
-#  and add target to extra-y so that we know we have to
+#  and add target to 'targets' so that we know we have to
 #  read in the saved command line
 
 # Linking
diff --git a/scripts/gdb/linux/Makefile b/scripts/gdb/linux/Makefile
index 124755087510..13903073cbff 100644
--- a/scripts/gdb/linux/Makefile
+++ b/scripts/gdb/linux/Makefile
@@ -18,7 +18,7 @@ quiet_cmd_gen_constants_py = GEN $@
$(CPP) -E -x c -P $(c_flags) $< > $@ ;\
sed -i '1,//d;' $@
 
-extra-y += constants.py
+always-y += constants.py
 $(obj)/constants.py: $(src)/constants.py.in FORCE
$(call if_changed_dep,gen_constants_py)
 
-- 
2.27.0

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH 2/2] drm/i915: remove gvt/Makefile

2020-04-09 Thread Masahiro Yamada
Including subdirectory Makefile from the driver main Makefile does not
buy us much because this is not real isolation.

Having a single Makefile at the top of the module is clearer, and
it is what this driver almost does.

Move all gvt objects to the i915 main Makefile.

Signed-off-by: Masahiro Yamada 
---

 drivers/gpu/drm/i915/Makefile | 28 
 drivers/gpu/drm/i915/gvt/Makefile |  8 
 2 files changed, 24 insertions(+), 12 deletions(-)
 delete mode 100644 drivers/gpu/drm/i915/gvt/Makefile

diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile
index 6cd1f6253814..74e965882a98 100644
--- a/drivers/gpu/drm/i915/Makefile
+++ b/drivers/gpu/drm/i915/Makefile
@@ -275,10 +275,30 @@ i915-$(CONFIG_DRM_I915_SELFTEST) += \
 # virtual gpu code
 i915-y += i915_vgpu.o
 
-ifeq ($(CONFIG_DRM_I915_GVT),y)
-i915-y += intel_gvt.o
-include $(src)/gvt/Makefile
-endif
+i915-$(CONFIG_DRM_I915_GVT) += \
+   intel_gvt.o \
+   gvt/gvt.o \
+   gvt/aperture_gm.o \
+   gvt/handlers.o \
+   gvt/vgpu.o \
+   gvt/trace_points.o \
+   gvt/firmware.o \
+   gvt/interrupt.o \
+   gvt/gtt.o \
+   gvt/cfg_space.o \
+   gvt/opregion.o \
+   gvt/mmio.o \
+   gvt/display.o \
+   gvt/edid.o \
+   gvt/execlist.o \
+   gvt/scheduler.o \
+   gvt/sched_policy.o \
+   gvt/mmio_context.o \
+   gvt/cmd_parser.o \
+   gvt/debugfs.o \
+   gvt/fb_decoder.o \
+   gvt/dmabuf.o \
+   gvt/page_track.o
 
 obj-$(CONFIG_DRM_I915) += i915.o
 obj-$(CONFIG_DRM_I915_GVT_KVMGT) += gvt/kvmgt.o
diff --git a/drivers/gpu/drm/i915/gvt/Makefile 
b/drivers/gpu/drm/i915/gvt/Makefile
deleted file mode 100644
index 4d70f4689479..
--- a/drivers/gpu/drm/i915/gvt/Makefile
+++ /dev/null
@@ -1,8 +0,0 @@
-# SPDX-License-Identifier: GPL-2.0
-GVT_DIR := gvt
-GVT_SOURCE := gvt.o aperture_gm.o handlers.o vgpu.o trace_points.o firmware.o \
-   interrupt.o gtt.o cfg_space.o opregion.o mmio.o display.o edid.o \
-   execlist.o scheduler.o sched_policy.o mmio_context.o cmd_parser.o 
debugfs.o \
-   fb_decoder.o dmabuf.o page_track.o
-
-i915-y += $(addprefix $(GVT_DIR)/, 
$(GVT_SOURCE))
-- 
2.17.1

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH 1/2] drm/i915: remove unneeded ccflags-y from gvt/Makefile

2020-04-09 Thread Masahiro Yamada
When CONFIG_DRM_I915_GVT=y, the same include path is added twice.

drivers/gpu/drm/i915/Makefile specifies:

  subdir-ccflags-y += -I$(srctree)/$(src)

drivers/gpu/drm/i915/gvt/Makefile adds the second '-I $(srctree)/$(src)',
which is redundant.

The include path '-I $(srctree)/$(src)/$(GVT_DIR)/' is added to allow
include/trace/define_trace.h to find the gvt/trace.h

By setting the correct relative path to TRACE_INCLUDE_PATH, this -I
is also unneeded.

Signed-off-by: Masahiro Yamada 
---

 drivers/gpu/drm/i915/gvt/Makefile | 1 -
 drivers/gpu/drm/i915/gvt/trace.h  | 2 +-
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/gvt/Makefile 
b/drivers/gpu/drm/i915/gvt/Makefile
index ea8324abc784..4d70f4689479 100644
--- a/drivers/gpu/drm/i915/gvt/Makefile
+++ b/drivers/gpu/drm/i915/gvt/Makefile
@@ -5,5 +5,4 @@ GVT_SOURCE := gvt.o aperture_gm.o handlers.o vgpu.o 
trace_points.o firmware.o \
execlist.o scheduler.o sched_policy.o mmio_context.o cmd_parser.o 
debugfs.o \
fb_decoder.o dmabuf.o page_track.o
 
-ccflags-y  += -I $(srctree)/$(src) -I 
$(srctree)/$(src)/$(GVT_DIR)/
 i915-y += $(addprefix $(GVT_DIR)/, 
$(GVT_SOURCE))
diff --git a/drivers/gpu/drm/i915/gvt/trace.h b/drivers/gpu/drm/i915/gvt/trace.h
index 6d787750d279..d63b7eef6179 100644
--- a/drivers/gpu/drm/i915/gvt/trace.h
+++ b/drivers/gpu/drm/i915/gvt/trace.h
@@ -377,7 +377,7 @@ TRACE_EVENT(render_mmio,
 
 /* This part must be out of protection */
 #undef TRACE_INCLUDE_PATH
-#define TRACE_INCLUDE_PATH .
+#define TRACE_INCLUDE_PATH ../../drivers/gpu/drm/i915/gvt
 #undef TRACE_INCLUDE_FILE
 #define TRACE_INCLUDE_FILE trace
 #include 
-- 
2.17.1

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH v2 00/16] x86, crypto: remove always-defined CONFIG_AS_* and cosolidate Kconfig/Makefiles

2020-03-27 Thread Masahiro Yamada
On Fri, Mar 27, 2020 at 5:46 AM Jason A. Donenfeld  wrote:
>
> On Thu, Mar 26, 2020 at 2:44 PM Masahiro Yamada  wrote:
> > I collected more Reviewed-by and Acked-by,
> > then pushed this series to
> >
> > git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild.git
> > kbuild-asinstr
>
> But not the version of the penultimate patch that Nick ack'd

Dropped Nick's Reviewed-by.


-- 
Best Regards
Masahiro Yamada
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH v2 00/16] x86, crypto: remove always-defined CONFIG_AS_* and cosolidate Kconfig/Makefiles

2020-03-27 Thread Masahiro Yamada
Hi all,

On Thu, Mar 26, 2020 at 6:22 PM Ingo Molnar  wrote:
>
>
> * Jason A. Donenfeld  wrote:
>
> > Very little has changed from last time, and this whole series still
> > looks good to me. I think I already ack'd most packages, but in case
> > it helps:
> >
> > Reviewed-by: Jason A. Donenfeld 
>
> Acked-by: Ingo Molnar 
>
> > Since this touches a lot of stuff, it might be best to get it in as
> > early as possible during the merge window, as I imagine new code being
> > added is going to want to be touching those makefiles too.
>
> I'd argue the opposite: please merge this later in the merge window, to
> not disrupt the vast body of other stuff that has already been lined up
> and has been tested, and to give time for these new bits to get tested
> some more.

I agree.


> Also, please get it into -next ASAP, today would be ideal for test
> coverage ...

I collected more Reviewed-by and Acked-by,
then pushed this series to

git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild.git
kbuild-asinstr

It will show up in -next soon.


-- 
Best Regards
Masahiro Yamada
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH v2 00/16] x86, crypto: remove always-defined CONFIG_AS_* and cosolidate Kconfig/Makefiles

2020-03-26 Thread Masahiro Yamada
This series of cleanups was prompted by Linus:
https://lkml.org/lkml/2020/3/12/726

First, this series drop always-on CONFIG_AS_* options.
Some of those options were introduced in old days.
For example, the check for CONFIG_AS_CFI dates back to 2006.

We raise the minimal tool versions from time to time.
Currently, we require binutils 2.21
(and we even plan to bump it to 2.23).

After cleaning away the old checks,
as-instr calls are moved to Kconfig from Makefiles,
then more Kconfig / Makefile code is cleaned up.

I folded all relevanet patches into this series,
as suggested by Jason A. Donenfeld.

The update for v2 is quite small.
I just swapped the patch order of patch 8 and 11
instead of moving comments around files,
which was addressed by Nick Desaulniers.


Borislav Petkov (1):
  Documentation/changes: Raise minimum supported binutils version to
2.23

Jason A. Donenfeld (4):
  x86: probe assembler capabilities via kconfig instead of makefile
  crypto: x86 - rework configuration based on Kconfig
  crypto: curve25519 - do not pollute dispatcher based on assembler
  x86: update AS_* macros to binutils >=2.23, supporting ADX and AVX2

Masahiro Yamada (11):
  lib/raid6/test: fix build on distros whose /bin/sh is not bash
  x86: remove unneeded defined(__ASSEMBLY__) check from asm/dwarf2.h
  x86: remove always-defined CONFIG_AS_CFI
  x86: remove unneeded (CONFIG_AS_)CFI_SIGNAL_FRAME
  x86: remove always-defined CONFIG_AS_CFI_SECTIONS
  x86: remove always-defined CONFIG_AS_SSSE3
  x86: remove always-defined CONFIG_AS_AVX
  x86: replace arch macros from compiler with CONFIG_X86_{32,64}
  drm/i915: remove always-defined CONFIG_AS_MOVNTDQA
  x86: add comments about the binutils version to support code in
as-instr
  crypto: x86 - clean up poly1305-x86_64-cryptogams.S by 'make clean'

 Documentation/process/changes.rst |   4 +-
 arch/x86/Kconfig  |   2 +
 arch/x86/Kconfig.assembler|  17 ++
 arch/x86/Makefile |  22 ---
 arch/x86/crypto/Makefile  | 162 +++---
 arch/x86/crypto/aesni-intel_avx-x86_64.S  |   6 -
 arch/x86/crypto/aesni-intel_glue.c|  21 +--
 arch/x86/crypto/blake2s-core.S|   2 -
 arch/x86/crypto/chacha_glue.c |   6 +-
 arch/x86/crypto/poly1305-x86_64-cryptogams.pl |  16 --
 arch/x86/crypto/poly1305_glue.c   |  11 +-
 arch/x86/crypto/sha1_ssse3_asm.S  |   4 -
 arch/x86/crypto/sha1_ssse3_glue.c |  13 --
 arch/x86/crypto/sha256-avx-asm.S  |   3 -
 arch/x86/crypto/sha256-avx2-asm.S |   3 -
 arch/x86/crypto/sha256_ssse3_glue.c   |  12 --
 arch/x86/crypto/sha512-avx-asm.S  |   2 -
 arch/x86/crypto/sha512-avx2-asm.S |   3 -
 arch/x86/crypto/sha512_ssse3_glue.c   |  10 --
 arch/x86/include/asm/dwarf2.h |  44 -
 arch/x86/include/asm/xor_avx.h|   9 -
 drivers/gpu/drm/i915/Makefile |   3 -
 drivers/gpu/drm/i915/i915_memcpy.c|   5 -
 include/crypto/curve25519.h   |   6 +-
 kernel/signal.c   |   2 +-
 lib/raid6/algos.c |  12 +-
 lib/raid6/avx2.c  |   4 -
 lib/raid6/recov_avx2.c|   6 -
 lib/raid6/recov_ssse3.c   |   6 -
 lib/raid6/test/Makefile   |   9 +-
 30 files changed, 101 insertions(+), 324 deletions(-)
 create mode 100644 arch/x86/Kconfig.assembler

-- 
2.17.1

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH v2 09/16] drm/i915: remove always-defined CONFIG_AS_MOVNTDQA

2020-03-26 Thread Masahiro Yamada
CONFIG_AS_MOVNTDQA was introduced by commit 0b1de5d58e19 ("drm/i915:
Use SSE4.1 movntdqa to accelerate reads from WC memory").

We raise the minimal supported binutils version from time to time.
The last bump was commit 1fb12b35e5ff ("kbuild: Raise the minimum
required binutils version to 2.21").

I confirmed the code in $(call as-instr,...) can be assembled by the
binutils 2.21 assembler and also by LLVM integrated assembler.

Remove CONFIG_AS_MOVNTDQA, which is always defined.

Signed-off-by: Masahiro Yamada 
Reviewed-by: Nick Desaulniers 
---

Changes in v2: None

 drivers/gpu/drm/i915/Makefile  | 3 ---
 drivers/gpu/drm/i915/i915_memcpy.c | 5 -
 2 files changed, 8 deletions(-)

diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile
index a1f2411aa21b..e559e53fc634 100644
--- a/drivers/gpu/drm/i915/Makefile
+++ b/drivers/gpu/drm/i915/Makefile
@@ -28,9 +28,6 @@ subdir-ccflags-$(CONFIG_DRM_I915_WERROR) += -Werror
 CFLAGS_i915_pci.o = $(call cc-disable-warning, override-init)
 CFLAGS_display/intel_fbdev.o = $(call cc-disable-warning, override-init)
 
-subdir-ccflags-y += \
-   $(call as-instr,movntdqa (%eax)$(comma)%xmm0,-DCONFIG_AS_MOVNTDQA)
-
 subdir-ccflags-y += -I$(srctree)/$(src)
 
 # Please keep these build lists sorted!
diff --git a/drivers/gpu/drm/i915/i915_memcpy.c 
b/drivers/gpu/drm/i915/i915_memcpy.c
index fdd550405fd3..7b3b83bd5ab8 100644
--- a/drivers/gpu/drm/i915/i915_memcpy.c
+++ b/drivers/gpu/drm/i915/i915_memcpy.c
@@ -35,7 +35,6 @@
 
 static DEFINE_STATIC_KEY_FALSE(has_movntdqa);
 
-#ifdef CONFIG_AS_MOVNTDQA
 static void __memcpy_ntdqa(void *dst, const void *src, unsigned long len)
 {
kernel_fpu_begin();
@@ -93,10 +92,6 @@ static void __memcpy_ntdqu(void *dst, const void *src, 
unsigned long len)
 
kernel_fpu_end();
 }
-#else
-static void __memcpy_ntdqa(void *dst, const void *src, unsigned long len) {}
-static void __memcpy_ntdqu(void *dst, const void *src, unsigned long len) {}
-#endif
 
 /**
  * i915_memcpy_from_wc: perform an accelerated *aligned* read from WC
-- 
2.17.1

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH 00/16] x86, crypto: remove always-defined CONFIG_AS_* and cosolidate Kconfig/Makefiles

2020-03-25 Thread Masahiro Yamada
Hi Ingo,

On Wed, Mar 25, 2020 at 1:59 PM Ingo Molnar  wrote:
>
>
> * Masahiro Yamada  wrote:
>
> > This series of cleanups was prompted by Linus:
> > https://lkml.org/lkml/2020/3/12/726
> >
> > First, this series drop always-on CONFIG_AS_* options.
> > Some of those options were introduced in old days.
> > For example, the check for CONFIG_AS_CFI dates back to 2006.
> >
> > We raise the minimal tool versions from time to time.
> > Currently, we require binutils 2.21
> > (and we plan to bump it to 2.23 for v5.7-rc1).
> >
> > After cleaning away the old checks,
> > as-instr calls are moved to Kconfig from Makefiles.
> > (patch 11)
> >
> > This allows more Kconfig / Makefile cleanups.
> > Patch 12 is complex, but I double-checked it does the equivalent.
> >
> > Patch 14 bumps the binutils version to 2.23,
> > and patch 15 removes more CONFIG_AS_* options.
> >
> > I folded all relevanet patches into this series,
> > as suggested by Jason A. Donenfeld.
> >
> > If x86 maintainers take care of this series, that's good.
> >
> > If it is OK to queue this up to Kbuild tree,
> > I will send a pull request to Linus.
> >
> > Thank you.
>
> LGTM. I've got these four from Jason A. Donenfeld queued up in
> tip:WIP.x86/asm:
>
>  bd5b1283e41c: ("crypto: Curve25519 - do not pollute dispatcher based on 
> assembler")
>  829f32d78588: ("crypto: X86 - rework configuration, based on Kconfig")
>  95ef9f80ed63: ("x86/build: Probe assembler from Kconfig instead of Kbuild")
>  1651e700664b: ("x86: Fix bitops.h warning with a moved cast")
>
> I suppose these might interact (maybe even conflict), and are topically
> related.
>
> Would you like to pull these into the kbuild tree? You can find them in:
>
>git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git WIP.x86/asm
>
> Thanks,
>
> Ingo


I did not know that these had already landed in tip tree.

They are immature version.
(In fact CONFIG_AS_CFI and AS_ADX are false-negative
if GCC that defaults to 32-bit is used.)

Can you simply discard the WIP.x86/asm branch,
and only reapply
1651e700664b: ("x86: Fix bitops.h warning with a moved cast")

?


-- 
Best Regards
Masahiro Yamada
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH 10/16] drm/i915: remove always-defined CONFIG_AS_MOVNTDQA

2020-03-25 Thread Masahiro Yamada
CONFIG_AS_MOVNTDQA was introduced by commit 0b1de5d58e19 ("drm/i915:
Use SSE4.1 movntdqa to accelerate reads from WC memory").

We raise the minimal supported binutils version from time to time.
The last bump was commit 1fb12b35e5ff ("kbuild: Raise the minimum
required binutils version to 2.21").

I confirmed the code in $(call as-instr,...) can be assembled by the
binutils 2.21 assembler and also by LLVM integrated assembler.

Remove CONFIG_AS_MOVNTDQA, which is always defined.

Signed-off-by: Masahiro Yamada 
Reviewed-by: Nick Desaulniers 
---

 drivers/gpu/drm/i915/Makefile  | 3 ---
 drivers/gpu/drm/i915/i915_memcpy.c | 5 -
 2 files changed, 8 deletions(-)

diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile
index a1f2411aa21b..e559e53fc634 100644
--- a/drivers/gpu/drm/i915/Makefile
+++ b/drivers/gpu/drm/i915/Makefile
@@ -28,9 +28,6 @@ subdir-ccflags-$(CONFIG_DRM_I915_WERROR) += -Werror
 CFLAGS_i915_pci.o = $(call cc-disable-warning, override-init)
 CFLAGS_display/intel_fbdev.o = $(call cc-disable-warning, override-init)
 
-subdir-ccflags-y += \
-   $(call as-instr,movntdqa (%eax)$(comma)%xmm0,-DCONFIG_AS_MOVNTDQA)
-
 subdir-ccflags-y += -I$(srctree)/$(src)
 
 # Please keep these build lists sorted!
diff --git a/drivers/gpu/drm/i915/i915_memcpy.c 
b/drivers/gpu/drm/i915/i915_memcpy.c
index fdd550405fd3..7b3b83bd5ab8 100644
--- a/drivers/gpu/drm/i915/i915_memcpy.c
+++ b/drivers/gpu/drm/i915/i915_memcpy.c
@@ -35,7 +35,6 @@
 
 static DEFINE_STATIC_KEY_FALSE(has_movntdqa);
 
-#ifdef CONFIG_AS_MOVNTDQA
 static void __memcpy_ntdqa(void *dst, const void *src, unsigned long len)
 {
kernel_fpu_begin();
@@ -93,10 +92,6 @@ static void __memcpy_ntdqu(void *dst, const void *src, 
unsigned long len)
 
kernel_fpu_end();
 }
-#else
-static void __memcpy_ntdqa(void *dst, const void *src, unsigned long len) {}
-static void __memcpy_ntdqu(void *dst, const void *src, unsigned long len) {}
-#endif
 
 /**
  * i915_memcpy_from_wc: perform an accelerated *aligned* read from WC
-- 
2.17.1

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH] drm/i915: remove always-defined CONFIG_AS_MOVNTDQA

2020-03-25 Thread Masahiro Yamada
Hi i915 maintainers,


On Mon, Mar 23, 2020 at 11:12 AM Masahiro Yamada  wrote:
>
> CONFIG_AS_MOVNTDQA was introduced by commit 0b1de5d58e19 ("drm/i915:
> Use SSE4.1 movntdqa to accelerate reads from WC memory").
>
> We raise the minimal supported binutils version from time to time.
> The last bump was commit 1fb12b35e5ff ("kbuild: Raise the minimum
> required binutils version to 2.21").
>
> I confirmed the code in $(call as-instr,...) can be assembled by the
> binutils 2.21 assembler and also by Clang's integrated assembler.
>
> Remove CONFIG_AS_MOVNTDQA, which is always defined.
>
> Signed-off-by: Masahiro Yamada 
> ---


Please discard this.

I decided to fold this (10/16) into the following big series
because I was suggested to do so.

https://lore.kernel.org/patchwork/project/lkml/list/?series=435391





-- 
Best Regards
Masahiro Yamada
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH 00/16] x86, crypto: remove always-defined CONFIG_AS_* and cosolidate Kconfig/Makefiles

2020-03-25 Thread Masahiro Yamada
This series of cleanups was prompted by Linus:
https://lkml.org/lkml/2020/3/12/726

First, this series drop always-on CONFIG_AS_* options.
Some of those options were introduced in old days.
For example, the check for CONFIG_AS_CFI dates back to 2006.

We raise the minimal tool versions from time to time.
Currently, we require binutils 2.21
(and we plan to bump it to 2.23 for v5.7-rc1).

After cleaning away the old checks,
as-instr calls are moved to Kconfig from Makefiles.
(patch 11)

This allows more Kconfig / Makefile cleanups.
Patch 12 is complex, but I double-checked it does the equivalent.

Patch 14 bumps the binutils version to 2.23,
and patch 15 removes more CONFIG_AS_* options.

I folded all relevanet patches into this series,
as suggested by Jason A. Donenfeld.

If x86 maintainers take care of this series, that's good.

If it is OK to queue this up to Kbuild tree,
I will send a pull request to Linus.

Thank you.



Borislav Petkov (1):
  Documentation/changes: Raise minimum supported binutils version to
2.23

Jason A. Donenfeld (4):
  x86: probe assembler capabilities via kconfig instead of makefile
  crypto: x86 - rework configuration based on Kconfig
  crypto: curve25519 - do not pollute dispatcher based on assembler
  x86: update AS_* macros to binutils >=2.23, supporting ADX and AVX2

Masahiro Yamada (11):
  lib/raid6/test: fix build on distros whose /bin/sh is not bash
  x86: remove unneeded defined(__ASSEMBLY__) check from asm/dwarf2.h
  x86: remove always-defined CONFIG_AS_CFI
  x86: remove unneeded (CONFIG_AS_)CFI_SIGNAL_FRAME
  x86: remove always-defined CONFIG_AS_CFI_SECTIONS
  x86: remove always-defined CONFIG_AS_SSSE3
  x86: remove always-defined CONFIG_AS_AVX
  x86: add comments about the binutils version to support code in
as-instr
  x86: replace arch macros from compiler with CONFIG_X86_{32,64}
  drm/i915: remove always-defined CONFIG_AS_MOVNTDQA
  crypto: x86 - clean up poly1305-x86_64-cryptogams.S by 'make clean'

 Documentation/process/changes.rst |   4 +-
 arch/x86/Kconfig  |   2 +
 arch/x86/Kconfig.assembler|  14 ++
 arch/x86/Makefile |  22 ---
 arch/x86/crypto/Makefile  | 162 +++---
 arch/x86/crypto/aesni-intel_avx-x86_64.S  |   6 -
 arch/x86/crypto/aesni-intel_glue.c|  21 +--
 arch/x86/crypto/blake2s-core.S|   2 -
 arch/x86/crypto/chacha_glue.c |   6 +-
 arch/x86/crypto/poly1305-x86_64-cryptogams.pl |  16 --
 arch/x86/crypto/poly1305_glue.c   |  11 +-
 arch/x86/crypto/sha1_ssse3_asm.S  |   4 -
 arch/x86/crypto/sha1_ssse3_glue.c |  13 --
 arch/x86/crypto/sha256-avx-asm.S  |   3 -
 arch/x86/crypto/sha256-avx2-asm.S |   3 -
 arch/x86/crypto/sha256_ssse3_glue.c   |  12 --
 arch/x86/crypto/sha512-avx-asm.S  |   2 -
 arch/x86/crypto/sha512-avx2-asm.S |   3 -
 arch/x86/crypto/sha512_ssse3_glue.c   |  10 --
 arch/x86/include/asm/dwarf2.h |  44 -
 arch/x86/include/asm/xor_avx.h|   9 -
 drivers/gpu/drm/i915/Makefile |   3 -
 drivers/gpu/drm/i915/i915_memcpy.c|   5 -
 include/crypto/curve25519.h   |   6 +-
 kernel/signal.c   |   2 +-
 lib/raid6/algos.c |  12 +-
 lib/raid6/avx2.c  |   4 -
 lib/raid6/recov_avx2.c|   6 -
 lib/raid6/recov_ssse3.c   |   6 -
 lib/raid6/test/Makefile   |   9 +-
 30 files changed, 98 insertions(+), 324 deletions(-)
 create mode 100644 arch/x86/Kconfig.assembler

-- 
2.17.1

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH] drm/i915: remove always-defined CONFIG_AS_MOVNTDQA

2020-03-24 Thread Masahiro Yamada
CONFIG_AS_MOVNTDQA was introduced by commit 0b1de5d58e19 ("drm/i915:
Use SSE4.1 movntdqa to accelerate reads from WC memory").

We raise the minimal supported binutils version from time to time.
The last bump was commit 1fb12b35e5ff ("kbuild: Raise the minimum
required binutils version to 2.21").

I confirmed the code in $(call as-instr,...) can be assembled by the
binutils 2.21 assembler and also by Clang's integrated assembler.

Remove CONFIG_AS_MOVNTDQA, which is always defined.

Signed-off-by: Masahiro Yamada 
---

 drivers/gpu/drm/i915/Makefile  | 3 ---
 drivers/gpu/drm/i915/i915_memcpy.c | 5 -
 2 files changed, 8 deletions(-)

diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile
index a1f2411aa21b..e559e53fc634 100644
--- a/drivers/gpu/drm/i915/Makefile
+++ b/drivers/gpu/drm/i915/Makefile
@@ -28,9 +28,6 @@ subdir-ccflags-$(CONFIG_DRM_I915_WERROR) += -Werror
 CFLAGS_i915_pci.o = $(call cc-disable-warning, override-init)
 CFLAGS_display/intel_fbdev.o = $(call cc-disable-warning, override-init)
 
-subdir-ccflags-y += \
-   $(call as-instr,movntdqa (%eax)$(comma)%xmm0,-DCONFIG_AS_MOVNTDQA)
-
 subdir-ccflags-y += -I$(srctree)/$(src)
 
 # Please keep these build lists sorted!
diff --git a/drivers/gpu/drm/i915/i915_memcpy.c 
b/drivers/gpu/drm/i915/i915_memcpy.c
index fdd550405fd3..7b3b83bd5ab8 100644
--- a/drivers/gpu/drm/i915/i915_memcpy.c
+++ b/drivers/gpu/drm/i915/i915_memcpy.c
@@ -35,7 +35,6 @@
 
 static DEFINE_STATIC_KEY_FALSE(has_movntdqa);
 
-#ifdef CONFIG_AS_MOVNTDQA
 static void __memcpy_ntdqa(void *dst, const void *src, unsigned long len)
 {
kernel_fpu_begin();
@@ -93,10 +92,6 @@ static void __memcpy_ntdqu(void *dst, const void *src, 
unsigned long len)
 
kernel_fpu_end();
 }
-#else
-static void __memcpy_ntdqa(void *dst, const void *src, unsigned long len) {}
-static void __memcpy_ntdqu(void *dst, const void *src, unsigned long len) {}
-#endif
 
 /**
  * i915_memcpy_from_wc: perform an accelerated *aligned* read from WC
-- 
2.17.1

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH] drm/i915: fix header test with GCOV

2020-02-24 Thread Masahiro Yamada
Hi Jani,

On Fri, Feb 21, 2020 at 7:54 PM Jani Nikula  wrote:
>
> $(CC) with $(CFLAGS_GCOV) assumes the output filename with .gcno suffix
> appended is writable. This is not the case when the output filename is
> /dev/null:
>
>   HDRTEST drivers/gpu/drm/i915/display/intel_frontbuffer.h
> /dev/null:1:0: error: cannot open /dev/null.gcno
>   HDRTEST drivers/gpu/drm/i915/display/intel_ddi.h
> /dev/null:1:0: error: cannot open /dev/null.gcno
> make[5]: *** [../drivers/gpu/drm/i915/Makefile:307:
> drivers/gpu/drm/i915/display/intel_ddi.hdrtest] Error 1
> make[5]: *** Waiting for unfinished jobs
> make[5]: *** [../drivers/gpu/drm/i915/Makefile:307:
> drivers/gpu/drm/i915/display/intel_frontbuffer.hdrtest] Error 1
>
> Filter out $(CFLAGS_GVOC) from the header test $(c_flags) as they don't
> make sense here anyway.



Is GCOV the only case that produces a separate file?

Could you also test CONFIG_DEBUG_INFO_SPLIT, please ?


The GCC manual says this:

-gsplit-dwarf

   Separate as much DWARF debugging information as possible into a
separate output
   file with the extension .dwo. This option allows the build system
to avoid linking
   files with debug information. To be useful, this option requires a debugger
   capable of reading .dwo files.




If this does not work, filtering flags
does not seem to be a maintainable way.




>
> References: 
> http://lore.kernel.org/r/d8112767-4089-4c58-d7d3-2ce031398...@infradead.org
> Reported-by: Randy Dunlap 
> Fixes: c6d4a099a240 ("drm/i915: reimplement header test feature")
> Cc: Masahiro Yamada 
> Signed-off-by: Jani Nikula 
> ---
>  drivers/gpu/drm/i915/Makefile | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile
> index b314d44ded5e..bc28c31c4f78 100644
> --- a/drivers/gpu/drm/i915/Makefile
> +++ b/drivers/gpu/drm/i915/Makefile
> @@ -301,7 +301,7 @@ extra-$(CONFIG_DRM_I915_WERROR) += \
> $(shell cd $(srctree)/$(src) && find * -name '*.h')))
>
>  quiet_cmd_hdrtest = HDRTEST $(patsubst %.hdrtest,%.h,$@)
> -  cmd_hdrtest = $(CC) $(c_flags) -S -o /dev/null -x c /dev/null -include 
> $<; touch $@
> +  cmd_hdrtest = $(CC) $(filter-out $(CFLAGS_GCOV), $(c_flags)) -S -o 
> /dev/null -x c /dev/null -include $<; touch $@
>
>  $(obj)/%.hdrtest: $(src)/%.h FORCE
> $(call if_changed_dep,hdrtest)
> --
> 2.20.1
>


-- 
Best Regards
Masahiro Yamada
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH] drm/i915: fix header test with GCOV

2020-02-24 Thread Masahiro Yamada
On Sat, Feb 22, 2020 at 2:25 PM Randy Dunlap  wrote:
>
> On 2/21/20 8:53 PM, Masahiro Yamada wrote:
> > On Sat, Feb 22, 2020 at 1:43 PM Masahiro Yamada  
> > wrote:
> >>
> >> Hi Jani,
> >>
> >> On Fri, Feb 21, 2020 at 7:54 PM Jani Nikula  wrote:
> >>>
> >>> $(CC) with $(CFLAGS_GCOV) assumes the output filename with .gcno suffix
> >>> appended is writable. This is not the case when the output filename is
> >>> /dev/null:
> >>>
> >>>   HDRTEST drivers/gpu/drm/i915/display/intel_frontbuffer.h
> >>> /dev/null:1:0: error: cannot open /dev/null.gcno
> >>>   HDRTEST drivers/gpu/drm/i915/display/intel_ddi.h
> >>> /dev/null:1:0: error: cannot open /dev/null.gcno
> >>> make[5]: *** [../drivers/gpu/drm/i915/Makefile:307:
> >>> drivers/gpu/drm/i915/display/intel_ddi.hdrtest] Error 1
> >>> make[5]: *** Waiting for unfinished jobs
> >>> make[5]: *** [../drivers/gpu/drm/i915/Makefile:307:
> >>> drivers/gpu/drm/i915/display/intel_frontbuffer.hdrtest] Error 1
> >>>
> >>> Filter out $(CFLAGS_GVOC) from the header test $(c_flags) as they don't
> >>> make sense here anyway.
> >>
> >>
> >>
> >> Is GCOV the only case that produces a separate file?
> >>
> >> Could you also test CONFIG_DEBUG_INFO_SPLIT, please ?
> >>
> >>
> >> The GCC manual says this:
> >>
> >> -gsplit-dwarf
> >>
> >>Separate as much DWARF debugging information as possible into a
> >> separate output
> >>file with the extension .dwo. This option allows the build system
> >> to avoid linking
> >>files with debug information. To be useful, this option requires a 
> >> debugger
> >>capable of reading .dwo files.
> >>
> >
> >
> > I just tested it.
> >
> > This is not a problem for header test
> > because cmd_hdrtest uses '-S' instead of '-c'.
> >
> > If '-c' were used, we would see a similar error.
> >
> >
> > So, gsplit-dwarf is OK.
>
> Yes, works for me also.
>
> (I think you have a faster build machine that I do. I began the build
> almost immediately after reading your email. :)


I use a reasonable PC for my development.
(core-i9 with 4 physical cores)


I just compiled under i915/ with this command:

make drivers/gpu/drm/i915/




-- 
Best Regards
Masahiro Yamada
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH] drm/i915: fix header test with GCOV

2020-02-24 Thread Masahiro Yamada
On Sat, Feb 22, 2020 at 1:43 PM Masahiro Yamada  wrote:
>
> Hi Jani,
>
> On Fri, Feb 21, 2020 at 7:54 PM Jani Nikula  wrote:
> >
> > $(CC) with $(CFLAGS_GCOV) assumes the output filename with .gcno suffix
> > appended is writable. This is not the case when the output filename is
> > /dev/null:
> >
> >   HDRTEST drivers/gpu/drm/i915/display/intel_frontbuffer.h
> > /dev/null:1:0: error: cannot open /dev/null.gcno
> >   HDRTEST drivers/gpu/drm/i915/display/intel_ddi.h
> > /dev/null:1:0: error: cannot open /dev/null.gcno
> > make[5]: *** [../drivers/gpu/drm/i915/Makefile:307:
> > drivers/gpu/drm/i915/display/intel_ddi.hdrtest] Error 1
> > make[5]: *** Waiting for unfinished jobs
> > make[5]: *** [../drivers/gpu/drm/i915/Makefile:307:
> > drivers/gpu/drm/i915/display/intel_frontbuffer.hdrtest] Error 1
> >
> > Filter out $(CFLAGS_GVOC) from the header test $(c_flags) as they don't
> > make sense here anyway.
>
>
>
> Is GCOV the only case that produces a separate file?
>
> Could you also test CONFIG_DEBUG_INFO_SPLIT, please ?
>
>
> The GCC manual says this:
>
> -gsplit-dwarf
>
>Separate as much DWARF debugging information as possible into a
> separate output
>file with the extension .dwo. This option allows the build system
> to avoid linking
>files with debug information. To be useful, this option requires a debugger
>capable of reading .dwo files.
>


I just tested it.

This is not a problem for header test
because cmd_hdrtest uses '-S' instead of '-c'.

If '-c' were used, we would see a similar error.


So, gsplit-dwarf is OK.




>
>
> If this does not work, filtering flags
> does not seem to be a maintainable way.
>
>
>
>
> >
> > References: 
> > http://lore.kernel.org/r/d8112767-4089-4c58-d7d3-2ce031398...@infradead.org
> > Reported-by: Randy Dunlap 
> > Fixes: c6d4a099a240 ("drm/i915: reimplement header test feature")
> > Cc: Masahiro Yamada 
> > Signed-off-by: Jani Nikula 
> > ---
> >  drivers/gpu/drm/i915/Makefile | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile
> > index b314d44ded5e..bc28c31c4f78 100644
> > --- a/drivers/gpu/drm/i915/Makefile
> > +++ b/drivers/gpu/drm/i915/Makefile
> > @@ -301,7 +301,7 @@ extra-$(CONFIG_DRM_I915_WERROR) += \
> > $(shell cd $(srctree)/$(src) && find * -name '*.h')))
> >
> >  quiet_cmd_hdrtest = HDRTEST $(patsubst %.hdrtest,%.h,$@)
> > -  cmd_hdrtest = $(CC) $(c_flags) -S -o /dev/null -x c /dev/null 
> > -include $<; touch $@
> > +  cmd_hdrtest = $(CC) $(filter-out $(CFLAGS_GCOV), $(c_flags)) -S -o 
> > /dev/null -x c /dev/null -include $<; touch $@
> >
> >  $(obj)/%.hdrtest: $(src)/%.h FORCE
> > $(call if_changed_dep,hdrtest)
> > --
> > 2.20.1
> >
>
>
> --
> Best Regards
> Masahiro Yamada



-- 
Best Regards
Masahiro Yamada
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH v2] drm/i915: make more headers self-contained

2019-11-08 Thread Masahiro Yamada
The headers in the gem/selftests/, gt/selftests, gvt/, selftests/
directories have never been compile-tested, but it would be possible
to make them self-contained.

This commit only addresses missing  and forward
struct declarations.

Signed-off-by: Masahiro Yamada 
---

Rebase on git://anongit.freedesktop.org/drm-tip


 drivers/gpu/drm/i915/gem/selftests/mock_context.h | 3 +++
 drivers/gpu/drm/i915/gt/selftests/mock_timeline.h | 2 ++
 drivers/gpu/drm/i915/gvt/cmd_parser.h | 4 
 drivers/gpu/drm/i915/gvt/display.h| 5 +
 drivers/gpu/drm/i915/gvt/edid.h   | 4 
 drivers/gpu/drm/i915/gvt/execlist.h   | 2 ++
 drivers/gpu/drm/i915/gvt/fb_decoder.h | 2 ++
 drivers/gpu/drm/i915/gvt/hypercall.h  | 4 
 drivers/gpu/drm/i915/gvt/interrupt.h  | 3 +++
 drivers/gpu/drm/i915/gvt/mmio.h   | 2 ++
 drivers/gpu/drm/i915/gvt/page_track.h | 3 +++
 drivers/gpu/drm/i915/gvt/sched_policy.h   | 3 +++
 drivers/gpu/drm/i915/selftests/mock_gtt.h | 3 +++
 drivers/gpu/drm/i915/selftests/mock_region.h  | 5 +
 drivers/gpu/drm/i915/selftests/mock_uncore.h  | 3 +++
 15 files changed, 48 insertions(+)

diff --git a/drivers/gpu/drm/i915/gem/selftests/mock_context.h 
b/drivers/gpu/drm/i915/gem/selftests/mock_context.h
index 0b926653914f..45de09ec28d1 100644
--- a/drivers/gpu/drm/i915/gem/selftests/mock_context.h
+++ b/drivers/gpu/drm/i915/gem/selftests/mock_context.h
@@ -7,6 +7,9 @@
 #ifndef __MOCK_CONTEXT_H
 #define __MOCK_CONTEXT_H
 
+struct drm_file;
+struct drm_i915_private;
+
 void mock_init_contexts(struct drm_i915_private *i915);
 
 struct i915_gem_context *
diff --git a/drivers/gpu/drm/i915/gt/selftests/mock_timeline.h 
b/drivers/gpu/drm/i915/gt/selftests/mock_timeline.h
index 689efc66c908..d2bcc3df6183 100644
--- a/drivers/gpu/drm/i915/gt/selftests/mock_timeline.h
+++ b/drivers/gpu/drm/i915/gt/selftests/mock_timeline.h
@@ -7,6 +7,8 @@
 #ifndef __MOCK_TIMELINE__
 #define __MOCK_TIMELINE__
 
+#include 
+
 struct intel_timeline;
 
 void mock_timeline_init(struct intel_timeline *timeline, u64 context);
diff --git a/drivers/gpu/drm/i915/gvt/cmd_parser.h 
b/drivers/gpu/drm/i915/gvt/cmd_parser.h
index 286703643002..ab25d151932a 100644
--- a/drivers/gpu/drm/i915/gvt/cmd_parser.h
+++ b/drivers/gpu/drm/i915/gvt/cmd_parser.h
@@ -38,6 +38,10 @@
 
 #define GVT_CMD_HASH_BITS 7
 
+struct intel_gvt;
+struct intel_shadow_wa_ctx;
+struct intel_vgpu_workload;
+
 void intel_gvt_clean_cmd_parser(struct intel_gvt *gvt);
 
 int intel_gvt_init_cmd_parser(struct intel_gvt *gvt);
diff --git a/drivers/gpu/drm/i915/gvt/display.h 
b/drivers/gpu/drm/i915/gvt/display.h
index a87f33e6a23c..b59b34046e1e 100644
--- a/drivers/gpu/drm/i915/gvt/display.h
+++ b/drivers/gpu/drm/i915/gvt/display.h
@@ -35,6 +35,11 @@
 #ifndef _GVT_DISPLAY_H_
 #define _GVT_DISPLAY_H_
 
+#include 
+
+struct intel_gvt;
+struct intel_vgpu;
+
 #define SBI_REG_MAX20
 #define DPCD_SIZE  0x700
 
diff --git a/drivers/gpu/drm/i915/gvt/edid.h b/drivers/gpu/drm/i915/gvt/edid.h
index f6dfc8b795ec..dfe0cbc6aad8 100644
--- a/drivers/gpu/drm/i915/gvt/edid.h
+++ b/drivers/gpu/drm/i915/gvt/edid.h
@@ -35,6 +35,10 @@
 #ifndef _GVT_EDID_H_
 #define _GVT_EDID_H_
 
+#include 
+
+struct intel_vgpu;
+
 #define EDID_SIZE  128
 #define EDID_ADDR  0x50 /* Linux hvm EDID addr */
 
diff --git a/drivers/gpu/drm/i915/gvt/execlist.h 
b/drivers/gpu/drm/i915/gvt/execlist.h
index 5ccc2c695848..5c0c1fd30c83 100644
--- a/drivers/gpu/drm/i915/gvt/execlist.h
+++ b/drivers/gpu/drm/i915/gvt/execlist.h
@@ -35,6 +35,8 @@
 #ifndef _GVT_EXECLIST_H_
 #define _GVT_EXECLIST_H_
 
+#include 
+
 struct execlist_ctx_descriptor_format {
union {
u32 ldw;
diff --git a/drivers/gpu/drm/i915/gvt/fb_decoder.h 
b/drivers/gpu/drm/i915/gvt/fb_decoder.h
index 60c155085029..67b6ede9e707 100644
--- a/drivers/gpu/drm/i915/gvt/fb_decoder.h
+++ b/drivers/gpu/drm/i915/gvt/fb_decoder.h
@@ -36,6 +36,8 @@
 #ifndef _GVT_FB_DECODER_H_
 #define _GVT_FB_DECODER_H_
 
+#include 
+
 #define _PLANE_CTL_FORMAT_SHIFT24
 #define _PLANE_CTL_TILED_SHIFT 10
 #define _PIPE_V_SRCSZ_SHIFT0
diff --git a/drivers/gpu/drm/i915/gvt/hypercall.h 
b/drivers/gpu/drm/i915/gvt/hypercall.h
index 4862fb12778e..9599c0a762b2 100644
--- a/drivers/gpu/drm/i915/gvt/hypercall.h
+++ b/drivers/gpu/drm/i915/gvt/hypercall.h
@@ -33,6 +33,10 @@
 #ifndef _GVT_HYPERCALL_H_
 #define _GVT_HYPERCALL_H_
 
+#include 
+
+struct device;
+
 enum hypervisor_type {
INTEL_GVT_HYPERVISOR_XEN = 0,
INTEL_GVT_HYPERVISOR_KVM,
diff --git a/drivers/gpu/drm/i915/gvt/interrupt.h 
b/drivers/gpu/drm/i915/gvt/interrupt.h
index 5313fb1b33e1..fcd663811d37 100644
--- a/drivers/gpu/drm/i915/gvt/interrupt.h
+++ b/drivers/gpu/drm/i915/gvt/interrupt.h
@@ -32,6 +32,8 @@
 #ifndef _GVT_INTERRUPT_H_
 #define _GVT_INTERRUPT_H_
 
+#include 
+
 enum intel_gvt_event_type

Re: [Intel-gfx] [PATCH 2/2] drm/i915: make more headers self-contained

2019-11-07 Thread Masahiro Yamada
On Fri, Nov 8, 2019 at 2:15 PM Masahiro Yamada
 wrote:
>
> The headers in the gem/selftests/, gt/selftests, gvt/, selftests/
> directories have never been compile-tested, but it would be possible
> to make them self-contained.
>
> This commit only addresses missing  and forward
> struct declarations.
>
> Signed-off-by: Masahiro Yamada 
> ---

I confirmed this patch is applicable to next-20191107
but CI fails to apply it.

Which branch should I base my patch on?


>
>  drivers/gpu/drm/i915/gem/selftests/mock_context.h | 3 +++
>  drivers/gpu/drm/i915/gt/selftests/mock_timeline.h | 2 ++
>  drivers/gpu/drm/i915/gvt/cmd_parser.h | 4 
>  drivers/gpu/drm/i915/gvt/display.h| 5 +
>  drivers/gpu/drm/i915/gvt/edid.h   | 4 
>  drivers/gpu/drm/i915/gvt/execlist.h   | 2 ++
>  drivers/gpu/drm/i915/gvt/fb_decoder.h | 2 ++
>  drivers/gpu/drm/i915/gvt/hypercall.h  | 4 
>  drivers/gpu/drm/i915/gvt/interrupt.h  | 3 +++
>  drivers/gpu/drm/i915/gvt/mmio.h   | 2 ++
>  drivers/gpu/drm/i915/gvt/page_track.h | 3 +++
>  drivers/gpu/drm/i915/gvt/sched_policy.h   | 3 +++
>  drivers/gpu/drm/i915/selftests/mock_drm.h | 2 ++
>  drivers/gpu/drm/i915/selftests/mock_gtt.h | 3 +++
>  drivers/gpu/drm/i915/selftests/mock_region.h  | 5 +
>  drivers/gpu/drm/i915/selftests/mock_uncore.h  | 3 +++
>  16 files changed, 50 insertions(+)
>
> diff --git a/drivers/gpu/drm/i915/gem/selftests/mock_context.h 
> b/drivers/gpu/drm/i915/gem/selftests/mock_context.h
> index 0b926653914f..45de09ec28d1 100644
> --- a/drivers/gpu/drm/i915/gem/selftests/mock_context.h
> +++ b/drivers/gpu/drm/i915/gem/selftests/mock_context.h
> @@ -7,6 +7,9 @@
>  #ifndef __MOCK_CONTEXT_H
>  #define __MOCK_CONTEXT_H
>
> +struct drm_file;
> +struct drm_i915_private;
> +
>  void mock_init_contexts(struct drm_i915_private *i915);
>
>  struct i915_gem_context *
> diff --git a/drivers/gpu/drm/i915/gt/selftests/mock_timeline.h 
> b/drivers/gpu/drm/i915/gt/selftests/mock_timeline.h
> index 689efc66c908..d2bcc3df6183 100644
> --- a/drivers/gpu/drm/i915/gt/selftests/mock_timeline.h
> +++ b/drivers/gpu/drm/i915/gt/selftests/mock_timeline.h
> @@ -7,6 +7,8 @@
>  #ifndef __MOCK_TIMELINE__
>  #define __MOCK_TIMELINE__
>
> +#include 
> +
>  struct intel_timeline;
>
>  void mock_timeline_init(struct intel_timeline *timeline, u64 context);
> diff --git a/drivers/gpu/drm/i915/gvt/cmd_parser.h 
> b/drivers/gpu/drm/i915/gvt/cmd_parser.h
> index 286703643002..ab25d151932a 100644
> --- a/drivers/gpu/drm/i915/gvt/cmd_parser.h
> +++ b/drivers/gpu/drm/i915/gvt/cmd_parser.h
> @@ -38,6 +38,10 @@
>
>  #define GVT_CMD_HASH_BITS 7
>
> +struct intel_gvt;
> +struct intel_shadow_wa_ctx;
> +struct intel_vgpu_workload;
> +
>  void intel_gvt_clean_cmd_parser(struct intel_gvt *gvt);
>
>  int intel_gvt_init_cmd_parser(struct intel_gvt *gvt);
> diff --git a/drivers/gpu/drm/i915/gvt/display.h 
> b/drivers/gpu/drm/i915/gvt/display.h
> index a87f33e6a23c..b59b34046e1e 100644
> --- a/drivers/gpu/drm/i915/gvt/display.h
> +++ b/drivers/gpu/drm/i915/gvt/display.h
> @@ -35,6 +35,11 @@
>  #ifndef _GVT_DISPLAY_H_
>  #define _GVT_DISPLAY_H_
>
> +#include 
> +
> +struct intel_gvt;
> +struct intel_vgpu;
> +
>  #define SBI_REG_MAX20
>  #define DPCD_SIZE  0x700
>
> diff --git a/drivers/gpu/drm/i915/gvt/edid.h b/drivers/gpu/drm/i915/gvt/edid.h
> index f6dfc8b795ec..dfe0cbc6aad8 100644
> --- a/drivers/gpu/drm/i915/gvt/edid.h
> +++ b/drivers/gpu/drm/i915/gvt/edid.h
> @@ -35,6 +35,10 @@
>  #ifndef _GVT_EDID_H_
>  #define _GVT_EDID_H_
>
> +#include 
> +
> +struct intel_vgpu;
> +
>  #define EDID_SIZE  128
>  #define EDID_ADDR  0x50 /* Linux hvm EDID addr */
>
> diff --git a/drivers/gpu/drm/i915/gvt/execlist.h 
> b/drivers/gpu/drm/i915/gvt/execlist.h
> index 5ccc2c695848..5c0c1fd30c83 100644
> --- a/drivers/gpu/drm/i915/gvt/execlist.h
> +++ b/drivers/gpu/drm/i915/gvt/execlist.h
> @@ -35,6 +35,8 @@
>  #ifndef _GVT_EXECLIST_H_
>  #define _GVT_EXECLIST_H_
>
> +#include 
> +
>  struct execlist_ctx_descriptor_format {
> union {
> u32 ldw;
> diff --git a/drivers/gpu/drm/i915/gvt/fb_decoder.h 
> b/drivers/gpu/drm/i915/gvt/fb_decoder.h
> index 60c155085029..67b6ede9e707 100644
> --- a/drivers/gpu/drm/i915/gvt/fb_decoder.h
> +++ b/drivers/gpu/drm/i915/gvt/fb_decoder.h
> @@ -36,6 +36,8 @@
>  #ifndef _GVT_FB_DECODER_H_
>  #define _GVT_FB_DECODER_H_
>
> +#include 
> +
>  #define _PLANE_CTL_FORMAT_SHIFT24
>  #defi

[Intel-gfx] [PATCH 1/2] drm/i915: change to_mock() to an inline function

2019-11-07 Thread Masahiro Yamada
Since this function is defined in a header file, it should be
'static inline' instead of 'static'.

Signed-off-by: Masahiro Yamada 
---

 drivers/gpu/drm/i915/gem/selftests/mock_dmabuf.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/gem/selftests/mock_dmabuf.h 
b/drivers/gpu/drm/i915/gem/selftests/mock_dmabuf.h
index f0f8bbd82dfc..22818bbb139d 100644
--- a/drivers/gpu/drm/i915/gem/selftests/mock_dmabuf.h
+++ b/drivers/gpu/drm/i915/gem/selftests/mock_dmabuf.h
@@ -14,7 +14,7 @@ struct mock_dmabuf {
struct page *pages[];
 };
 
-static struct mock_dmabuf *to_mock(struct dma_buf *buf)
+static inline struct mock_dmabuf *to_mock(struct dma_buf *buf)
 {
return buf->priv;
 }
-- 
2.17.1

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

[Intel-gfx] [PATCH 2/2] drm/i915: make more headers self-contained

2019-11-07 Thread Masahiro Yamada
The headers in the gem/selftests/, gt/selftests, gvt/, selftests/
directories have never been compile-tested, but it would be possible
to make them self-contained.

This commit only addresses missing  and forward
struct declarations.

Signed-off-by: Masahiro Yamada 
---

 drivers/gpu/drm/i915/gem/selftests/mock_context.h | 3 +++
 drivers/gpu/drm/i915/gt/selftests/mock_timeline.h | 2 ++
 drivers/gpu/drm/i915/gvt/cmd_parser.h | 4 
 drivers/gpu/drm/i915/gvt/display.h| 5 +
 drivers/gpu/drm/i915/gvt/edid.h   | 4 
 drivers/gpu/drm/i915/gvt/execlist.h   | 2 ++
 drivers/gpu/drm/i915/gvt/fb_decoder.h | 2 ++
 drivers/gpu/drm/i915/gvt/hypercall.h  | 4 
 drivers/gpu/drm/i915/gvt/interrupt.h  | 3 +++
 drivers/gpu/drm/i915/gvt/mmio.h   | 2 ++
 drivers/gpu/drm/i915/gvt/page_track.h | 3 +++
 drivers/gpu/drm/i915/gvt/sched_policy.h   | 3 +++
 drivers/gpu/drm/i915/selftests/mock_drm.h | 2 ++
 drivers/gpu/drm/i915/selftests/mock_gtt.h | 3 +++
 drivers/gpu/drm/i915/selftests/mock_region.h  | 5 +
 drivers/gpu/drm/i915/selftests/mock_uncore.h  | 3 +++
 16 files changed, 50 insertions(+)

diff --git a/drivers/gpu/drm/i915/gem/selftests/mock_context.h 
b/drivers/gpu/drm/i915/gem/selftests/mock_context.h
index 0b926653914f..45de09ec28d1 100644
--- a/drivers/gpu/drm/i915/gem/selftests/mock_context.h
+++ b/drivers/gpu/drm/i915/gem/selftests/mock_context.h
@@ -7,6 +7,9 @@
 #ifndef __MOCK_CONTEXT_H
 #define __MOCK_CONTEXT_H
 
+struct drm_file;
+struct drm_i915_private;
+
 void mock_init_contexts(struct drm_i915_private *i915);
 
 struct i915_gem_context *
diff --git a/drivers/gpu/drm/i915/gt/selftests/mock_timeline.h 
b/drivers/gpu/drm/i915/gt/selftests/mock_timeline.h
index 689efc66c908..d2bcc3df6183 100644
--- a/drivers/gpu/drm/i915/gt/selftests/mock_timeline.h
+++ b/drivers/gpu/drm/i915/gt/selftests/mock_timeline.h
@@ -7,6 +7,8 @@
 #ifndef __MOCK_TIMELINE__
 #define __MOCK_TIMELINE__
 
+#include 
+
 struct intel_timeline;
 
 void mock_timeline_init(struct intel_timeline *timeline, u64 context);
diff --git a/drivers/gpu/drm/i915/gvt/cmd_parser.h 
b/drivers/gpu/drm/i915/gvt/cmd_parser.h
index 286703643002..ab25d151932a 100644
--- a/drivers/gpu/drm/i915/gvt/cmd_parser.h
+++ b/drivers/gpu/drm/i915/gvt/cmd_parser.h
@@ -38,6 +38,10 @@
 
 #define GVT_CMD_HASH_BITS 7
 
+struct intel_gvt;
+struct intel_shadow_wa_ctx;
+struct intel_vgpu_workload;
+
 void intel_gvt_clean_cmd_parser(struct intel_gvt *gvt);
 
 int intel_gvt_init_cmd_parser(struct intel_gvt *gvt);
diff --git a/drivers/gpu/drm/i915/gvt/display.h 
b/drivers/gpu/drm/i915/gvt/display.h
index a87f33e6a23c..b59b34046e1e 100644
--- a/drivers/gpu/drm/i915/gvt/display.h
+++ b/drivers/gpu/drm/i915/gvt/display.h
@@ -35,6 +35,11 @@
 #ifndef _GVT_DISPLAY_H_
 #define _GVT_DISPLAY_H_
 
+#include 
+
+struct intel_gvt;
+struct intel_vgpu;
+
 #define SBI_REG_MAX20
 #define DPCD_SIZE  0x700
 
diff --git a/drivers/gpu/drm/i915/gvt/edid.h b/drivers/gpu/drm/i915/gvt/edid.h
index f6dfc8b795ec..dfe0cbc6aad8 100644
--- a/drivers/gpu/drm/i915/gvt/edid.h
+++ b/drivers/gpu/drm/i915/gvt/edid.h
@@ -35,6 +35,10 @@
 #ifndef _GVT_EDID_H_
 #define _GVT_EDID_H_
 
+#include 
+
+struct intel_vgpu;
+
 #define EDID_SIZE  128
 #define EDID_ADDR  0x50 /* Linux hvm EDID addr */
 
diff --git a/drivers/gpu/drm/i915/gvt/execlist.h 
b/drivers/gpu/drm/i915/gvt/execlist.h
index 5ccc2c695848..5c0c1fd30c83 100644
--- a/drivers/gpu/drm/i915/gvt/execlist.h
+++ b/drivers/gpu/drm/i915/gvt/execlist.h
@@ -35,6 +35,8 @@
 #ifndef _GVT_EXECLIST_H_
 #define _GVT_EXECLIST_H_
 
+#include 
+
 struct execlist_ctx_descriptor_format {
union {
u32 ldw;
diff --git a/drivers/gpu/drm/i915/gvt/fb_decoder.h 
b/drivers/gpu/drm/i915/gvt/fb_decoder.h
index 60c155085029..67b6ede9e707 100644
--- a/drivers/gpu/drm/i915/gvt/fb_decoder.h
+++ b/drivers/gpu/drm/i915/gvt/fb_decoder.h
@@ -36,6 +36,8 @@
 #ifndef _GVT_FB_DECODER_H_
 #define _GVT_FB_DECODER_H_
 
+#include 
+
 #define _PLANE_CTL_FORMAT_SHIFT24
 #define _PLANE_CTL_TILED_SHIFT 10
 #define _PIPE_V_SRCSZ_SHIFT0
diff --git a/drivers/gpu/drm/i915/gvt/hypercall.h 
b/drivers/gpu/drm/i915/gvt/hypercall.h
index 4862fb12778e..9599c0a762b2 100644
--- a/drivers/gpu/drm/i915/gvt/hypercall.h
+++ b/drivers/gpu/drm/i915/gvt/hypercall.h
@@ -33,6 +33,10 @@
 #ifndef _GVT_HYPERCALL_H_
 #define _GVT_HYPERCALL_H_
 
+#include 
+
+struct device;
+
 enum hypervisor_type {
INTEL_GVT_HYPERVISOR_XEN = 0,
INTEL_GVT_HYPERVISOR_KVM,
diff --git a/drivers/gpu/drm/i915/gvt/interrupt.h 
b/drivers/gpu/drm/i915/gvt/interrupt.h
index 5313fb1b33e1..fcd663811d37 100644
--- a/drivers/gpu/drm/i915/gvt/interrupt.h
+++ b/drivers/gpu/drm/i915/gvt/interrupt.h
@@ -32,6 +32,8 @@
 #ifndef _GVT_INTERRUPT_H_
 #define _GVT_INTERRUPT_H_
 
+#include 
+
 enum

Re: [PATCH 1/5] kbuild: treat an object as multi-used when $(foo-) is set

2019-08-19 Thread Masahiro Yamada
On Tue, Aug 6, 2019 at 3:40 PM Masahiro Yamada
 wrote:
>
> Currently, Kbuild treats an object as multi-used when any of
> $(foo-objs), $(foo-y), $(foo-m) is set. It makes more sense to
> check $(foo-) as well.
>
> In the context of foo-$(CONFIG_FOO_FEATURE1), CONFIG_FOO_FEATURE1
> could be unset.
>
> Signed-off-by: Masahiro Yamada 

Only this patch applied for now.


> ---
>
>  scripts/Makefile.lib | 10 +-
>  1 file changed, 5 insertions(+), 5 deletions(-)
>
> diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
> index 41c50f9461e5..0a540599823e 100644
> --- a/scripts/Makefile.lib
> +++ b/scripts/Makefile.lib
> @@ -41,9 +41,9 @@ obj-m := $(filter-out %/, $(obj-m))
>  # Subdirectories we need to descend into
>  subdir-ym  := $(sort $(subdir-y) $(subdir-m))
>
> -# if $(foo-objs), $(foo-y), or $(foo-m) exists, foo.o is a composite object
> -multi-used-y := $(sort $(foreach m,$(obj-y), $(if $(strip $($(m:.o=-objs)) 
> $($(m:.o=-y))), $(m
> -multi-used-m := $(sort $(foreach m,$(obj-m), $(if $(strip $($(m:.o=-objs)) 
> $($(m:.o=-y)) $($(m:.o=-m))), $(m
> +# If $(foo-objs), $(foo-y), $(foo-m), or $(foo-) exists, foo.o is a 
> composite object
> +multi-used-y := $(sort $(foreach m,$(obj-y), $(if $(strip $($(m:.o=-objs)) 
> $($(m:.o=-y)) $($(m:.o=-))), $(m
> +multi-used-m := $(sort $(foreach m,$(obj-m), $(if $(strip $($(m:.o=-objs)) 
> $($(m:.o=-y)) $($(m:.o=-m)) $($(m:.o=-))), $(m
>  multi-used   := $(multi-used-y) $(multi-used-m)
>
>  # $(subdir-obj-y) is the list of objects in $(obj-y) which uses dir/ to
> @@ -52,8 +52,8 @@ subdir-obj-y := $(filter %/built-in.a, $(obj-y))
>
>  # Replace multi-part objects by their individual parts,
>  # including built-in.a from subdirectories
> -real-obj-y := $(foreach m, $(obj-y), $(if $(strip $($(m:.o=-objs)) 
> $($(m:.o=-y))),$($(m:.o=-objs)) $($(m:.o=-y)),$(m)))
> -real-obj-m := $(foreach m, $(obj-m), $(if $(strip $($(m:.o=-objs)) 
> $($(m:.o=-y)) $($(m:.o=-m))),$($(m:.o=-objs)) $($(m:.o=-y)) 
> $($(m:.o=-m)),$(m)))
> +real-obj-y := $(foreach m, $(obj-y), $(if $(strip $($(m:.o=-objs)) 
> $($(m:.o=-y)) $($(m:.o=-))),$($(m:.o=-objs)) $($(m:.o=-y)),$(m)))
> +real-obj-m := $(foreach m, $(obj-m), $(if $(strip $($(m:.o=-objs)) 
> $($(m:.o=-y)) $($(m:.o=-m)) $($(m:.o=-))),$($(m:.o=-objs)) $($(m:.o=-y)) 
> $($(m:.o=-m)),$(m)))
>
>  # DTB
>  # If CONFIG_OF_ALL_DTBS is enabled, all DT blobs are built
> --
> 2.17.1
>


-- 
Best Regards
Masahiro Yamada


[Intel-gfx] [PATCH 5/5] drm: i915: hierachize Makefiles

2019-08-06 Thread Masahiro Yamada
You can use the -y syntax in sub-directory Makefiles
of modules.

Demonstrate how it works.

PLEASE DO NOT APPLY FOR NOW: this is only for comments.

Signed-off-by: Masahiro Yamada 
---

 drivers/gpu/drm/i915/Makefile   | 126 ++--
 drivers/gpu/drm/i915/display/Makefile   |  64 ++
 drivers/gpu/drm/i915/gem/Makefile   |  27 +
 drivers/gpu/drm/i915/gem/selftests/Makefile |   3 +
 drivers/gpu/drm/i915/gt/Makefile|  16 +++
 drivers/gpu/drm/i915/gvt/Makefile   |  32 -
 drivers/gpu/drm/i915/selftests/Makefile |   9 ++
 7 files changed, 153 insertions(+), 124 deletions(-)
 create mode 100644 drivers/gpu/drm/i915/gem/selftests/Makefile
 create mode 100644 drivers/gpu/drm/i915/selftests/Makefile

diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile
index 8cace65f50ce..6319c670bfb8 100644
--- a/drivers/gpu/drm/i915/Makefile
+++ b/drivers/gpu/drm/i915/Makefile
@@ -63,56 +63,16 @@ i915-y += \
i915_user_extensions.o
 
 i915-$(CONFIG_COMPAT)   += i915_ioc32.o
-i915-$(CONFIG_DEBUG_FS) += i915_debugfs.o display/intel_pipe_crc.o
+i915-$(CONFIG_DEBUG_FS) += i915_debugfs.o
 i915-$(CONFIG_PERF_EVENTS) += i915_pmu.o
 
 # "Graphics Technology" (aka we talk to the gpu)
-obj-y += gt/
-gt-y += \
-   gt/intel_breadcrumbs.o \
-   gt/intel_context.o \
-   gt/intel_engine_cs.o \
-   gt/intel_engine_pm.o \
-   gt/intel_gt_pm.o \
-   gt/intel_hangcheck.o \
-   gt/intel_lrc.o \
-   gt/intel_reset.o \
-   gt/intel_ringbuffer.o \
-   gt/intel_mocs.o \
-   gt/intel_sseu.o \
-   gt/intel_workarounds.o
-gt-$(CONFIG_DRM_I915_SELFTEST) += \
-   gt/mock_engine.o
-i915-y += $(gt-y)
+i915-y += gt/
 
 # GEM (Graphics Execution Management) code
-obj-y += gem/
-gem-y += \
-   gem/i915_gem_busy.o \
-   gem/i915_gem_clflush.o \
-   gem/i915_gem_client_blt.o \
-   gem/i915_gem_context.o \
-   gem/i915_gem_dmabuf.o \
-   gem/i915_gem_domain.o \
-   gem/i915_gem_execbuffer.o \
-   gem/i915_gem_fence.o \
-   gem/i915_gem_internal.o \
-   gem/i915_gem_object.o \
-   gem/i915_gem_object_blt.o \
-   gem/i915_gem_mman.o \
-   gem/i915_gem_pages.o \
-   gem/i915_gem_phys.o \
-   gem/i915_gem_pm.o \
-   gem/i915_gem_shmem.o \
-   gem/i915_gem_shrinker.o \
-   gem/i915_gem_stolen.o \
-   gem/i915_gem_throttle.o \
-   gem/i915_gem_tiling.o \
-   gem/i915_gem_userptr.o \
-   gem/i915_gem_wait.o \
-   gem/i915_gemfs.o
+i915-y += gem/
+
 i915-y += \
- $(gem-y) \
  i915_active.o \
  i915_cmd_parser.o \
  i915_gem_batch_pool.o \
@@ -148,78 +108,11 @@ i915-y += intel_renderstate_gen6.o \
  intel_renderstate_gen8.o \
  intel_renderstate_gen9.o
 
-# modesetting core code
-obj-y += display/
-i915-y += \
-   display/intel_atomic.o \
-   display/intel_atomic_plane.o \
-   display/intel_audio.o \
-   display/intel_bios.o \
-   display/intel_bw.o \
-   display/intel_cdclk.o \
-   display/intel_color.o \
-   display/intel_combo_phy.o \
-   display/intel_connector.o \
-   display/intel_display.o \
-   display/intel_display_power.o \
-   display/intel_dpio_phy.o \
-   display/intel_dpll_mgr.o \
-   display/intel_fbc.o \
-   display/intel_fifo_underrun.o \
-   display/intel_frontbuffer.o \
-   display/intel_hdcp.o \
-   display/intel_hotplug.o \
-   display/intel_lpe_audio.o \
-   display/intel_overlay.o \
-   display/intel_psr.o \
-   display/intel_quirks.o \
-   display/intel_sprite.o
-i915-$(CONFIG_ACPI) += \
-   display/intel_acpi.o \
-   display/intel_opregion.o
-i915-$(CONFIG_DRM_FBDEV_EMULATION) += \
-   display/intel_fbdev.o
-
-# modesetting output/encoder code
-i915-y += \
-   display/dvo_ch7017.o \
-   display/dvo_ch7xxx.o \
-   display/dvo_ivch.o \
-   display/dvo_ns2501.o \
-   display/dvo_sil164.o \
-   display/dvo_tfp410.o \
-   display/icl_dsi.o \
-   display/intel_crt.o \
-   display/intel_ddi.o \
-   display/intel_dp.o \
-   display/intel_dp_aux_backlight.o \
-   display/intel_dp_link_training.o \
-   display/intel_dp_mst.o \
-   display/intel_dsi.o \
-   display/intel_dsi_dcs_backlight.o \
-   display/intel_dsi_vbt.o \
-   display/intel_dvo.o \
-   display/intel_gmbus.o \
-   display/intel_hdmi.o \
-   display/intel_lspcon.o \
-   display/intel_lvds.o \
-   display/intel_panel.o \
-   display/intel_sdvo.o \
-   display/intel_tv.o \
-   display/intel_vdsc.o \
-   display/vlv_dsi.o \
-   display/vlv_dsi_pll.o
+i915-y += display/
 
 # Post-mortem debug and GPU hang state capture
 i915-$(CONFIG_DRM_I915_CAPTURE_ERROR) += i915_gpu_error.o
-i915-$(CONFIG_DRM_I915_SELFTEST) += \
-   gem/selftests/igt_gem_utils.o \
-   selftests/i91

[Intel-gfx] [PATCH 0/5] kbuild: allow big modules to sub-divide Makefiles

2019-08-06 Thread Masahiro Yamada

Recently, Jani Nikula requests a better build system support
for drivers spanning multiple directories.
(better kbuild support for drivers spanning multiple directories?)

I implemented it, so please take a look at it.

Note:
The single targets do not work correctly.

The single targets have never worked correctly:

[1] For instance, "make drivers/foo/bar/baz.o" will descend into
drivers/foo/bar/Makefile, which may not necessarily specify
the build rule of baz.o

It is possible for drivers/foo/Makefile having
obj-$(CONFIG_BAZ) += bar/baz.o

[2] subdir-ccflags-y does not work.

The single targets directly descend into the directory of
that file resides.

It missed subdir-ccflags-y if it is specifies in parent
Makefiles.

Perhaps, I will have to manage correct implementation of single targets.



Masahiro Yamada (5):
  kbuild: treat an object as multi-used when $(foo-) is set
  kbuild: clean up modname calculation
  kbuild: rename cmd_ar_builtin to cmd_ar_no_sym
  kbuild: support composite objects spanning across multiple Makefiles
  drm: i915: hierachize Makefiles

 drivers/gpu/drm/i915/Makefile   | 126 ++--
 drivers/gpu/drm/i915/display/Makefile   |  64 ++
 drivers/gpu/drm/i915/gem/Makefile   |  27 +
 drivers/gpu/drm/i915/gem/selftests/Makefile |   3 +
 drivers/gpu/drm/i915/gt/Makefile|  16 +++
 drivers/gpu/drm/i915/gvt/Makefile   |  32 -
 drivers/gpu/drm/i915/selftests/Makefile |   9 ++
 scripts/Makefile.build  |  39 +++---
 scripts/Makefile.lib|  66 ++
 9 files changed, 218 insertions(+), 164 deletions(-)
 create mode 100644 drivers/gpu/drm/i915/gem/selftests/Makefile
 create mode 100644 drivers/gpu/drm/i915/selftests/Makefile

-- 
2.17.1

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

[PATCH 2/5] kbuild: clean up modname calculation

2019-08-06 Thread Masahiro Yamada
'multi-used' is used for computing the modname. Improve the code
readability by removing the .o suffix before the foreach loop.

I renamed multi-used-m to modules-multi.

No functional change intended.

Signed-off-by: Masahiro Yamada 
---

 scripts/Makefile.build |  6 +++---
 scripts/Makefile.lib   | 15 +--
 2 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index 0d434d0afc0b..b0ff60ac0c42 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -460,11 +460,11 @@ endif
 quiet_cmd_link_multi-m = LD [M]  $@
   cmd_link_multi-m = $(LD) $(ld_flags) -r -o $@ $(filter %.o,$^)
 
-$(multi-used-m): FORCE
+$(modules-multi): FORCE
$(call if_changed,link_multi-m)
-$(call multi_depend, $(multi-used-m), .o, -objs -y -m)
+$(call multi_depend, $(modules-multi), .o, -objs -y -m)
 
-targets += $(multi-used-m)
+targets += $(modules-multi)
 targets := $(filter-out $(PHONY), $(targets))
 
 # Add intermediate targets:
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 0a540599823e..e503f12e8e9c 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -41,10 +41,13 @@ obj-m   := $(filter-out %/, $(obj-m))
 # Subdirectories we need to descend into
 subdir-ym  := $(sort $(subdir-y) $(subdir-m))
 
-# If $(foo-objs), $(foo-y), $(foo-m), or $(foo-) exists, foo.o is a composite 
object
-multi-used-y := $(sort $(foreach m,$(obj-y), $(if $(strip $($(m:.o=-objs)) 
$($(m:.o=-y)) $($(m:.o=-))), $(m
-multi-used-m := $(sort $(foreach m,$(obj-m), $(if $(strip $($(m:.o=-objs)) 
$($(m:.o=-y)) $($(m:.o=-m)) $($(m:.o=-))), $(m
-multi-used   := $(multi-used-y) $(multi-used-m)
+# If $(foo-objs), $(foo-y), $(foo-m), or $(foo-) exists, foo is multi-used
+multi-used-y := $(sort $(foreach m, $(patsubst %.o,%,$(obj-y)), $(if $(strip 
$($(m)-objs) $($(m)-y) $($(m)-)), $(m
+multi-used-m := $(sort $(foreach m, $(patsubst %.o,%,$(obj-m)), $(if $(strip 
$($(m)-objs) $($(m)-y) $($(m)-m) $($(m)-)), $(m
+
+modules-multi := $(addsuffix .o, $(multi-used-m))
+
+multi-used := $(multi-used-y) $(multi-used-m)
 
 # $(subdir-obj-y) is the list of objects in $(obj-y) which uses dir/ to
 # tell kbuild to descend
@@ -90,14 +93,14 @@ lib-y   := $(addprefix $(obj)/,$(lib-y))
 subdir-obj-y   := $(addprefix $(obj)/,$(subdir-obj-y))
 real-obj-y := $(addprefix $(obj)/,$(real-obj-y))
 real-obj-m := $(addprefix $(obj)/,$(real-obj-m))
-multi-used-m   := $(addprefix $(obj)/,$(multi-used-m))
+modules-multi  := $(addprefix $(obj)/,$(modules-multi))
 subdir-ym  := $(addprefix $(obj)/,$(subdir-ym))
 
 # Finds the multi-part object the current object will be linked into.
 # If the object belongs to two or more multi-part objects, all of them are
 # concatenated with a colon separator.
 modname-multi = $(subst $(space),:,$(sort $(foreach m,$(multi-used),\
-   $(if $(filter $*.o, $($(m:.o=-objs)) $($(m:.o=-y)) 
$($(m:.o=-m))),$(m:.o=)
+   $(if $(filter $*.o, $($(m)-objs) $($(m)-y) $($(m)-m)),$(m)
 
 modname = $(if $(modname-multi),$(modname-multi),$(basetarget))
 
-- 
2.17.1



[PATCH 1/5] kbuild: treat an object as multi-used when $(foo-) is set

2019-08-06 Thread Masahiro Yamada
Currently, Kbuild treats an object as multi-used when any of
$(foo-objs), $(foo-y), $(foo-m) is set. It makes more sense to
check $(foo-) as well.

In the context of foo-$(CONFIG_FOO_FEATURE1), CONFIG_FOO_FEATURE1
could be unset.

Signed-off-by: Masahiro Yamada 
---

 scripts/Makefile.lib | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index 41c50f9461e5..0a540599823e 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -41,9 +41,9 @@ obj-m := $(filter-out %/, $(obj-m))
 # Subdirectories we need to descend into
 subdir-ym  := $(sort $(subdir-y) $(subdir-m))
 
-# if $(foo-objs), $(foo-y), or $(foo-m) exists, foo.o is a composite object
-multi-used-y := $(sort $(foreach m,$(obj-y), $(if $(strip $($(m:.o=-objs)) 
$($(m:.o=-y))), $(m
-multi-used-m := $(sort $(foreach m,$(obj-m), $(if $(strip $($(m:.o=-objs)) 
$($(m:.o=-y)) $($(m:.o=-m))), $(m
+# If $(foo-objs), $(foo-y), $(foo-m), or $(foo-) exists, foo.o is a composite 
object
+multi-used-y := $(sort $(foreach m,$(obj-y), $(if $(strip $($(m:.o=-objs)) 
$($(m:.o=-y)) $($(m:.o=-))), $(m
+multi-used-m := $(sort $(foreach m,$(obj-m), $(if $(strip $($(m:.o=-objs)) 
$($(m:.o=-y)) $($(m:.o=-m)) $($(m:.o=-))), $(m
 multi-used   := $(multi-used-y) $(multi-used-m)
 
 # $(subdir-obj-y) is the list of objects in $(obj-y) which uses dir/ to
@@ -52,8 +52,8 @@ subdir-obj-y := $(filter %/built-in.a, $(obj-y))
 
 # Replace multi-part objects by their individual parts,
 # including built-in.a from subdirectories
-real-obj-y := $(foreach m, $(obj-y), $(if $(strip $($(m:.o=-objs)) 
$($(m:.o=-y))),$($(m:.o=-objs)) $($(m:.o=-y)),$(m)))
-real-obj-m := $(foreach m, $(obj-m), $(if $(strip $($(m:.o=-objs)) 
$($(m:.o=-y)) $($(m:.o=-m))),$($(m:.o=-objs)) $($(m:.o=-y)) $($(m:.o=-m)),$(m)))
+real-obj-y := $(foreach m, $(obj-y), $(if $(strip $($(m:.o=-objs)) 
$($(m:.o=-y)) $($(m:.o=-))),$($(m:.o=-objs)) $($(m:.o=-y)),$(m)))
+real-obj-m := $(foreach m, $(obj-m), $(if $(strip $($(m:.o=-objs)) 
$($(m:.o=-y)) $($(m:.o=-m)) $($(m:.o=-))),$($(m:.o=-objs)) $($(m:.o=-y)) 
$($(m:.o=-m)),$(m)))
 
 # DTB
 # If CONFIG_OF_ALL_DTBS is enabled, all DT blobs are built
-- 
2.17.1



[PATCH 4/5] kbuild: support composite objects spanning across multiple Makefiles

2019-08-06 Thread Masahiro Yamada
For a module that consists of multiple objects, the Makefile typically
looks like this:

 obj-$(CONFIG_FOO)  += foo.o
 foo-y  += foo-main.o
 foo-$(CONFIG_FOO_FEATURE1) += foo-feature1.o
 foo-$(CONFIG_FOO_FEATURE2) += foo-feature2.o

Since other Makefiles do not understand foo-y, all modules must have
a flat structure.

As Documentation/kbuild/modules.rst section 4.3 says, Kbuild can
handle files that are spread over several sub-directories, but the
top Makefile of a module must specify everything.

Some modules (drm, fs, etc.) have grown quite big, and the current
limitation is getting more and more painful.

This commit allows modules to recurse into sub-directories. The
child Makefiles inherit composite object names from the parent.

TODO:
Add documentation for this syntax.

Signed-off-by: Masahiro Yamada 
---

 scripts/Makefile.build | 27 --
 scripts/Makefile.lib   | 51 +-
 2 files changed, 51 insertions(+), 27 deletions(-)

diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index 68622cbdfda5..cea2bb25787a 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -70,7 +70,7 @@ endif
 mod-targets := $(patsubst %.o, %.mod, $(obj-m))
 
 __build: $(if $(KBUILD_BUILTIN),$(builtin-target) $(lib-target) $(extra-y)) \
-$(if $(KBUILD_MODULES),$(obj-m) $(mod-targets) $(modorder-target)) \
+$(if $(KBUILD_MODULES),$(obj-m) $(ar-m) $(mod-targets) 
$(modorder-target)) \
 $(subdir-ym) $(always)
@:
 
@@ -274,7 +274,10 @@ $(obj)/%.o: $(src)/%.c $(recordmcount_source) 
$(objtool_dep) FORCE
$(call if_changed_rule,cc_o_c)
 
 cmd_mod = { \
-   echo $(if $($*-objs)$($*-y)$($*-m), $(addprefix $(obj)/, $($*-objs) 
$($*-y) $($*-m)), $(@:.mod=.o)); \
+   echo $(if $($*-objs)$($*-y)$($*-m), \
+   $(foreach m, $(addprefix $(obj)/, $($*-objs) $($*-y) $($*-m)), \
+   $(if $(filter %.a, $(m)), $(shell $(AR) t $(m)), 
$(m))), \
+   $(@:.mod=.o)); \
$(cmd_undef_syms); \
} > $@
 
@@ -399,19 +402,24 @@ $(obj)/%.asn1.c $(obj)/%.asn1.h: $(src)/%.asn1 
$(objtree)/scripts/asn1_compiler
 # ---
 
 # To build objects in subdirs, we need to descend into the directories
-$(sort $(subdir-obj-y)): $(subdir-ym) ;
+$(sort $(subdir-obj-y) $(subdir-ar-m)): $(subdir-ym);
 
 #
 # Rule to compile a set of .o files into one .a file (without symbol table)
 #
 
-quiet_cmd_ar_no_sym = AR  $@
+quiet_cmd_ar_no_sym = AR $(quiet_modtag)  $@
   cmd_ar_no_sym = rm -f $@; $(AR) rcSTP$(KBUILD_ARFLAGS) $@ $(real-prereqs)
 
 $(builtin-target): $(real-obj-y) FORCE
$(call if_changed,ar_no_sym)
 
-targets += $(builtin-target)
+$(ar-m): part-of-module := y
+$(ar-m): FORCE
+   $(call if_changed,ar_no_sym)
+$(call multi_depend, $(ar-m), .a, -objs -y -m)
+
+targets += $(builtin-target) $(ar-m)
 
 #
 # Rule to create modules.order file
@@ -456,7 +464,7 @@ endif
 # module is turned into a multi object module, $^ will contain header file
 # dependencies recorded in the .*.cmd file.
 quiet_cmd_link_multi-m = LD [M]  $@
-  cmd_link_multi-m = $(LD) $(ld_flags) -r -o $@ $(filter %.o,$^)
+  cmd_link_multi-m = $(LD) $(ld_flags) -r -o $@ --whole-archive $(filter 
%.o %a,$^) --no-whole-archive
 
 $(modules-multi): FORCE
$(call if_changed,link_multi-m)
@@ -485,7 +493,12 @@ targets += $(call intermediate_targets, .asn1.o, .asn1.c 
.asn1.h) \
 
 PHONY += $(subdir-ym)
 $(subdir-ym):
-   $(Q)$(MAKE) $(build)=$@ need-builtin=$(if $(findstring 
$@,$(subdir-obj-y)),1)
+   $(MAKE) $(build)=$@ \
+   need-builtin=$(if $(filter $@/built-in.a,$(subdir-obj-y)),1) \
+   multi-used2-y="$(sort $(foreach m, $(subdir-multi-used-y), \
+   $(if $(filter $@/,$(dir $(m))), $(notdir $m" \
+   multi-used2-m="$(sort $(foreach m, $(subdir-multi-used-m), \
+   $(if $(filter $@/,$(dir $(m))), $(notdir $m"
 
 # Add FORCE to the prequisites of a target to force it to be always rebuilt.
 # ---
diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
index e503f12e8e9c..e4e4ed869cad 100644
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -25,38 +25,44 @@ lib-y := $(filter-out $(obj-y), $(sort $(lib-y) $(lib-m)))
 # and -m subdirs.  Just put -y's first.
 modorder   := $(patsubst %/,%/modules.order, $(filter %/, $(obj-y)) 
$(obj-m:.o=.ko))
 
-# Handle objects in subdirs
-# ---
-# o if we encounter foo/ in $(obj-y), replace it by foo/built-in.a
-#   and add the directory to the list of dirs to descend into: $(subdir-y)
-# o if we encounter foo/ in $(obj-m), remove it from $(obj-m)
-#   and add the directory to the list of dirs to descend into: 

[PATCH 3/5] kbuild: rename cmd_ar_builtin to cmd_ar_no_sym

2019-08-06 Thread Masahiro Yamada
In the next commit, I will re-use this for thin-archives of objects
liked into modules.

Rename cmd_ar_builtin to a more generic cmd_ar_no_sym.
(cmd_ar is already defined in scripts/Makefile.lib)

I removed unneeded ifdef builtin-target.

No functional change intended.

Signed-off-by: Masahiro Yamada 
---

 scripts/Makefile.build | 8 +++-
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index b0ff60ac0c42..68622cbdfda5 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -404,16 +404,14 @@ $(sort $(subdir-obj-y)): $(subdir-ym) ;
 #
 # Rule to compile a set of .o files into one .a file (without symbol table)
 #
-ifdef builtin-target
 
-quiet_cmd_ar_builtin = AR  $@
-  cmd_ar_builtin = rm -f $@; $(AR) rcSTP$(KBUILD_ARFLAGS) $@ 
$(real-prereqs)
+quiet_cmd_ar_no_sym = AR  $@
+  cmd_ar_no_sym = rm -f $@; $(AR) rcSTP$(KBUILD_ARFLAGS) $@ $(real-prereqs)
 
 $(builtin-target): $(real-obj-y) FORCE
-   $(call if_changed,ar_builtin)
+   $(call if_changed,ar_no_sym)
 
 targets += $(builtin-target)
-endif # builtin-target
 
 #
 # Rule to create modules.order file
-- 
2.17.1



Re: [Intel-gfx] [PATCH] drm/i915: rename header test build commands to avoid conflicts

2019-06-06 Thread Masahiro Yamada
On Thu, Jun 6, 2019 at 4:57 PM Jani Nikula  wrote:
>
> You're totally right, it needs to be fixed in your tree. For that, I
> think the best option is your fixup patch #2.


OK, I will squash patch #2.


-- 
Best Regards
Masahiro Yamada
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Re: [Intel-gfx] [RFC 1/3] kbuild: add support for ensuring headers are self-contained

2019-06-03 Thread Masahiro Yamada
Hi Sam, Jani,

On Tue, Jun 4, 2019 at 2:33 AM Sam Ravnborg  wrote:
>
> Hi Masahiro/Jani.
>
> >
> > Following the obj-y pattern,
> > I want to make header-test-y relative to $(obj).
>
> I also considered this and agree this is better.
>
> Otherwise we end up with a spaghetti of dependencies across the tree.
>
> What I made just fit the purpose I had that day,
> which is no excuse for bad design.
>
> > I prefer this:
> >
> > quiet_cmd_header_test = HDRTEST $@
> >   cmd_header_test = echo "\#include \"$*.h\"" > $@
> >
> > $(obj)/%.header_test.c:
> > $(call cmd,header_test)
>
> Even better - good.
>
> We call it HDRTEST - so why not just go for that name:
>
> hdrtest-y += headerfile.h
>
> ??
>
> The current proposal with "header-test-y" hurts the eye a little with
> two '-', and all other variables uses only one '-' as is today.
> (generic-y, obj-y etc).
>
> This is bikeshedding but is was itcing me a little.

I do not have a strong opinion.
I leave it to Jani. Either is fine with me.


There are variables that contain two '-'.
'no-clean-files', 'subdir-ccflags-y', etc.


--
Best Regards
Masahiro Yamada
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Re: [Intel-gfx] [RFC 1/3] kbuild: add support for ensuring headers are self-contained

2019-06-03 Thread Masahiro Yamada
Hi Jani,

On Mon, May 20, 2019 at 6:16 PM Jani Nikula  wrote:
>
> >
> > I will take a little time to considier
> > how far we can extend the idea about
> > "headers should be self-contained".
>
> Thanks! Please let me know if/when you need further action from me, I
> won't post new versions until then.


Could you send v2 with the following changes ?


[1] Could you rename *.header_test.c to *.hdrtest.c ?
(I just thought .header_test.c was a bit too long.)

[2] %.hdrtest.c should not depend on the header

This will avoid unnecessary regeneration of *.hdrtest.c

quiet_cmd_header_test = HDRTEST $@
  cmd_header_test = echo "\#include \"$*.h\"" > $@

$(obj)/%.hdrtest.c:
$(call cmd,header_test)

[3] Please add '*.hdrtest.c' to  .gitignore, Documentation/dontdiff

[4] Please add '*.hdrtest.c' to 'make clean' (around line 1640 of top Makefile)


-- 
Best Regards
Masahiro Yamada


Re: [Intel-gfx] [RFC 1/3] kbuild: add support for ensuring headers are self-contained

2019-06-03 Thread Masahiro Yamada
Hi Sam,


On Sat, May 25, 2019 at 2:40 AM Sam Ravnborg  wrote:
>
> Hi Jani
>
> > Sometimes it's useful to be able to explicitly ensure certain headers
> > remain self-contained, i.e. that they are compilable as standalone
> > units, by including and/or forward declaring everything they depend on.
> >
> > Add special target header-test-y where individual Makefiles can add
> > headers to be tested if CONFIG_HEADER_TEST is enabled. This will
> > generate a dummy C file per header that gets built as part of extra-y.
>
> Very useful, thanks.
> I have cooked up something ad-hoc a couple of times but having it as a
> standard feature in the build system is much better.
> The we can let some of our infrastructure pick up an issues
> automatically.
>
> >
> > Cc: Chris Wilson 
> > Cc: Masahiro Yamada 
> > Cc: Michal Marek 
> > Signed-off-by: Jani Nikula 
> > ---
> >  Documentation/kbuild/makefiles.txt |  7 +++
> >  init/Kconfig   |  9 +
> >  scripts/Makefile.build | 10 ++
> >  scripts/Makefile.lib   |  3 +++
> >  4 files changed, 29 insertions(+)
> >
> > diff --git a/Documentation/kbuild/makefiles.txt 
> > b/Documentation/kbuild/makefiles.txt
> > index 03c065855eaf..73df58e5ea0c 100644
> > --- a/Documentation/kbuild/makefiles.txt
> > +++ b/Documentation/kbuild/makefiles.txt
> > @@ -1036,6 +1036,13 @@ When kbuild executes, the following steps are 
> > followed (roughly):
> >   In this example, extra-y is used to list object files that
> >   shall be built, but shall not be linked as part of built-in.a.
> >
> > +header-test-y
> > +
> > + header-test-y specifies headers (*.h) in the current directory that
> > + should be compile tested to ensure they are self-contained,
> > + i.e. compilable as standalone units. If CONFIG_HEADER_TEST is enabled,
> > + this autogenerates dummy sources to include the headers, and builds 
> > them
> > + as part of extra-y.
> Do we want to restrict this to current directory only?
> Sometimes we could use this for headers in include/ but let it
> trigger for the relevant subsystem.
> So for example drivers/gpu/drm/Makefile will include the rules
> for all headers in include/drm/*
>
> The alternative would be Makefiles (of Kbuild files)
> scattered in the directories with headers and then some
> infrastructure to visit those.
>
> Follow patch extend the header-test feature to work with
> headers in include/

Following the obj-y pattern,
I want to make header-test-y relative to $(obj).



> Example:
> # Header files from this directory
> header-test-y += drm_crtc_helper_internal.h
> header-test-y += drm_crtc_internal.h

These are described in drivers/gpu/drm/Makefile.

> ..
> .
> # Header files from include/drm
> header-test-y += drm/amd_asic_type.h
> header-test-y += drm/ati_pcigart.h

These are described in $(srctree)/include/Makefile.


> ...
>
>
> In the patch $* is used to get the "stem" from the pattern.
> This is the filname of the header file without extension.
>
>
> Sam
>
>
> diff --git a/scripts/Makefile.build b/scripts/Makefile.build
> index 4d4bf698467a..ca132ab3a551 100644
> --- a/scripts/Makefile.build
> +++ b/scripts/Makefile.build
> @@ -295,11 +295,10 @@ $(obj)/%.lst: $(src)/%.c FORCE
>  # ---
>
>  quiet_cmd_header_test = HDRTEST $@
> -  cmd_header_test = echo "\#include \"$( $@
> +  cmd_header_test = echo "\#include <$(2).h>" > $@
>
> -# FIXME: would be nice to be able to limit this implicit rule to 
> header-test-y
> -$(obj)/%.header_test.c: $(src)/%.h FORCE
> -   $(call if_changed,header_test)
> +$(obj)/%.header_test.c:
> +   $(call cmd,header_test,$*)
>
>  # Compile assembler sources (.S)
>  # ---
>

Agree, this is much better,
and it is what scripts/Makefile.asm-generic does.

But, you do not need to pass '$*' via the argument.



I prefer this:

quiet_cmd_header_test = HDRTEST $@
  cmd_header_test = echo "\#include \"$*.h\"" > $@

$(obj)/%.header_test.c:
$(call cmd,header_test)


-- 
Best Regards
Masahiro Yamada
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Re: [Intel-gfx] [RFC 1/3] kbuild: add support for ensuring headers are self-contained

2019-05-17 Thread Masahiro Yamada
On Fri, May 17, 2019 at 5:35 PM Chris Wilson  wrote:
>
> Quoting Jani Nikula (2019-05-16 20:48:16)
> > diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
> > index 8a1f64f17740..c2839de06485 100644
> > --- a/scripts/Makefile.lib
> > +++ b/scripts/Makefile.lib
> > @@ -66,6 +66,9 @@ extra-y += $(patsubst %.dtb,%.dt.yaml, $(dtb-y))
> >  extra-$(CONFIG_OF_ALL_DTBS) += $(patsubst %.dtb,%.dt.yaml, $(dtb-))
> >  endif
> >
> > +# Test self-contained headers
> > +extra-$(CONFIG_HEADER_TEST) += $(patsubst 
> > %.h,%.header_test.o,$(header-test-y))
>
> This didn't get pulled into clean-files.
>
> clean-files-$(CONFIG_HEADER_TEST) += $(patsubst 
> %.h,%.header_test.c,$(header-test-y))
> ?
>
> Not enough. Nor is clean-files-y +=...


The correct syntax is 'clean-files +='
instead of 'clean-files-y +='


If Kbuild supports this in the core Makefiles,
we can add "-o -name '*.header_test.c'"
to the top Makefile.



> And it should also be put into the global gitignore I think.


Documentation/dontdiff too.



> -Chris



-- 
Best Regards
Masahiro Yamada
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Re: [Intel-gfx] [RFC 1/3] kbuild: add support for ensuring headers are self-contained

2019-05-17 Thread Masahiro Yamada
On Fri, May 17, 2019 at 4:48 AM Jani Nikula  wrote:
>
> Sometimes it's useful to be able to explicitly ensure certain headers
> remain self-contained, i.e. that they are compilable as standalone
> units, by including and/or forward declaring everything they depend on.
>
> Add special target header-test-y where individual Makefiles can add
> headers to be tested if CONFIG_HEADER_TEST is enabled. This will
> generate a dummy C file per header that gets built as part of extra-y.
>
> Cc: Chris Wilson 
> Cc: Masahiro Yamada 
> Cc: Michal Marek 
> Signed-off-by: Jani Nikula 
> ---
>  Documentation/kbuild/makefiles.txt |  7 +++
>  init/Kconfig   |  9 +
>  scripts/Makefile.build | 10 ++
>  scripts/Makefile.lib   |  3 +++
>  4 files changed, 29 insertions(+)
>
> diff --git a/Documentation/kbuild/makefiles.txt 
> b/Documentation/kbuild/makefiles.txt
> index 03c065855eaf..73df58e5ea0c 100644
> --- a/Documentation/kbuild/makefiles.txt
> +++ b/Documentation/kbuild/makefiles.txt
> @@ -1036,6 +1036,13 @@ When kbuild executes, the following steps are followed 
> (roughly):
> In this example, extra-y is used to list object files that
> shall be built, but shall not be linked as part of built-in.a.
>
> +header-test-y
> +
> +   header-test-y specifies headers (*.h) in the current directory that
> +   should be compile tested to ensure they are self-contained,
> +   i.e. compilable as standalone units. If CONFIG_HEADER_TEST is enabled,
> +   this autogenerates dummy sources to include the headers, and builds 
> them
> +   as part of extra-y.
>
>  --- 6.7 Commands useful for building a boot image
>
> diff --git a/init/Kconfig b/init/Kconfig
> index 4592bf7997c0..d91b157201b1 100644
> --- a/init/Kconfig
> +++ b/init/Kconfig
> @@ -95,6 +95,15 @@ config COMPILE_TEST
>   here. If you are a user/distributor, say N here to exclude useless
>   drivers to be distributed.
>
> +config HEADER_TEST
> +   bool "Compile test headers that should be standalone compilable"
> +   help
> + Compile test headers listed in header-test-y target to ensure they 
> are
> + self-contained, i.e. compilable as standalone units.
> +
> + If you are a developer or tester and want to ensure the requested
> + headers are self-contained, say Y here. Otherwise, choose N.
> +
>  config LOCALVERSION
> string "Local version - append to kernel release"
> help
> diff --git a/scripts/Makefile.build b/scripts/Makefile.build
> index 76ca30cc4791..4d4bf698467a 100644
> --- a/scripts/Makefile.build
> +++ b/scripts/Makefile.build
> @@ -291,6 +291,16 @@ quiet_cmd_cc_lst_c = MKLST   $@
>  $(obj)/%.lst: $(src)/%.c FORCE
> $(call if_changed_dep,cc_lst_c)
>
> +# Dummy C sources for header test (header-test-y target)
> +# ---
> +
> +quiet_cmd_header_test = HDRTEST $@
> +  cmd_header_test = echo "\#include \"$( $@
> +
> +# FIXME: would be nice to be able to limit this implicit rule to 
> header-test-y
> +$(obj)/%.header_test.c: $(src)/%.h FORCE
> +   $(call if_changed,header_test)
> +
>  # Compile assembler sources (.S)
>  # ---
>
> diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib
> index 8a1f64f17740..c2839de06485 100644
> --- a/scripts/Makefile.lib
> +++ b/scripts/Makefile.lib
> @@ -66,6 +66,9 @@ extra-y += $(patsubst %.dtb,%.dt.yaml, $(dtb-y))
>  extra-$(CONFIG_OF_ALL_DTBS) += $(patsubst %.dtb,%.dt.yaml, $(dtb-))
>  endif
>
> +# Test self-contained headers
> +extra-$(CONFIG_HEADER_TEST) += $(patsubst 
> %.h,%.header_test.o,$(header-test-y))
> +
>  # Add subdir path
>
>  extra-y:= $(addprefix $(obj)/,$(extra-y))
> --
> 2.20.1
>


Thanks, probably we should do this.

At least, this check will be useful
for uapi headers since the kernel does not
test the self-containedness of
exported headers, (then turned out be problematic
later in user-space).

I will take a little time to considier
how far we can extend the idea about
"headers should be self-contained".

Thank you.



-- 
Best Regards
Masahiro Yamada
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Re: [Intel-gfx] [PATCH] drm/i915: drop unneeded -Wall addition

2019-05-15 Thread Masahiro Yamada
On Wed, May 15, 2019 at 3:25 PM Chris Wilson  wrote:
>
> Quoting Masahiro Yamada (2019-05-15 05:37:53)
> > The top level Makefile adds -Wall globally:
> >
> >   KBUILD_CFLAGS   := -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs 
> > \
> >
> > I see two "-Wall" added for compiling under drivers/gpu/drm/i915/.
>
> Does it matter? Is the statement in i915/Makefile not more complete for
> saying "-Wall -Wextra -Werror"?


Not fatal, but better to fix.

Why not fix the comment if you mind
"-Wall" in the comment?

It will be easy to rephrase the comments
without explicitly mentioning -Wall or -Wextra.


I reworded it more concisely:

# We aggressively eliminate warnings,
# so here are more warning options than default.

That's it.


The CI is your local matter.
Distracting comments should not be added in the upstream code
in the first place.


> > Signed-off-by: Masahiro Yamada 
> > ---
> >
> > BTW, I have a question in the comment:
> >
> >  "Note the danger in using -Wall -Wextra is that when CI updates gcc we
> >   will most likely get a sudden build breakage... Hopefully we will fix
> >   new warnings before CI updates!"
> >
> > Enabling whatever warning options does not cause build breakage.
> > -Werror does.
> >
> > So, I think the correct statement is:
> >
> >  "Note the danger in using -Werror is that when CI updates gcc we ...
>
> No.


Heh, I thought the answer was Yes,
since I saw the following in this Makefile.

# Add a set of useful warning flags and enable -Werror for CI to prevent




> CI enforces -Werror and that is constant, so the uncontrolled
> variable, the danger, lies in using the unreliable heuristics gcc may
> arbitrary enable between versions. That the set of warnings causing an
> error may be different between CI and the developer.
> -Chris



-- 
Best Regards
Masahiro Yamada
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

[Intel-gfx] [PATCH] drm/i915: drop unneeded -Wall addition

2019-05-14 Thread Masahiro Yamada
The top level Makefile adds -Wall globally:

  KBUILD_CFLAGS   := -Wall -Wundef -Werror=strict-prototypes -Wno-trigraphs \

I see two "-Wall" added for compiling under drivers/gpu/drm/i915/.

Signed-off-by: Masahiro Yamada 
---

BTW, I have a question in the comment:

 "Note the danger in using -Wall -Wextra is that when CI updates gcc we
  will most likely get a sudden build breakage... Hopefully we will fix
  new warnings before CI updates!"

Enabling whatever warning options does not cause build breakage.
-Werror does.

So, I think the correct statement is:

 "Note the danger in using -Werror is that when CI updates gcc we ...
   ^^^


 drivers/gpu/drm/i915/Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/Makefile b/drivers/gpu/drm/i915/Makefile
index fbcb0904f4a8..4a4f60c7edfc 100644
--- a/drivers/gpu/drm/i915/Makefile
+++ b/drivers/gpu/drm/i915/Makefile
@@ -12,7 +12,7 @@
 # Note the danger in using -Wall -Wextra is that when CI updates gcc we
 # will most likely get a sudden build breakage... Hopefully we will fix
 # new warnings before CI updates!
-subdir-ccflags-y := -Wall -Wextra
+subdir-ccflags-y := -Wextra
 subdir-ccflags-y += $(call cc-disable-warning, unused-parameter)
 subdir-ccflags-y += $(call cc-disable-warning, type-limits)
 subdir-ccflags-y += $(call cc-disable-warning, missing-field-initializers)
-- 
2.17.1

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Re: [Intel-gfx] [PATCH v2] drm: prefix header search paths with $(srctree)/

2019-04-25 Thread Masahiro Yamada
Hi.


On Fri, Mar 29, 2019 at 8:37 PM Masahiro Yamada
 wrote:
>
> Currently, the Kbuild core manipulates header search paths in a crazy
> way [1].
>
> To fix this mess, I want all Makefiles to add explicit $(srctree)/ to
> the search paths in the srctree. Some Makefiles are already written in
> that way, but not all. The goal of this work is to make the notation
> consistent, and finally get rid of the gross hacks.
>
> Having whitespaces after -I does not matter since commit 48f6e3cf5bc6
> ("kbuild: do not drop -I without parameter").
>
> [1]: https://patchwork.kernel.org/patch/9632347/
>
> Signed-off-by: Masahiro Yamada 
> Reviewed-by: Sam Ravnborg 
> ---
>
> I put all gpu/drm changes into a single patch because
> they are trivial conversion.
>
> If you are interested in the big picture of this work,
> the full patch set is available at the following URL.
>
> git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild.git 
> build-test


Is somebody taking care of this?



>
> Changes in v2:
>   - fix up the new driver komeda
>   - Add Sam's Reviewed-by
>
>  drivers/gpu/drm/amd/amdgpu/Makefile | 2 +-
>  drivers/gpu/drm/amd/lib/Makefile| 2 +-
>  drivers/gpu/drm/arm/display/komeda/Makefile | 4 ++--
>  drivers/gpu/drm/i915/gvt/Makefile   | 2 +-
>  drivers/gpu/drm/msm/Makefile| 6 +++---
>  drivers/gpu/drm/nouveau/Kbuild  | 8 
>  6 files changed, 12 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/Makefile 
> b/drivers/gpu/drm/amd/amdgpu/Makefile
> index 466da59..62bf9da 100644
> --- a/drivers/gpu/drm/amd/amdgpu/Makefile
> +++ b/drivers/gpu/drm/amd/amdgpu/Makefile
> @@ -23,7 +23,7 @@
>  # Makefile for the drm device driver.  This driver provides support for the
>  # Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
>
> -FULL_AMD_PATH=$(src)/..
> +FULL_AMD_PATH=$(srctree)/$(src)/..
>  DISPLAY_FOLDER_NAME=display
>  FULL_AMD_DISPLAY_PATH = $(FULL_AMD_PATH)/$(DISPLAY_FOLDER_NAME)
>
> diff --git a/drivers/gpu/drm/amd/lib/Makefile 
> b/drivers/gpu/drm/amd/lib/Makefile
> index 6902430..d534992 100644
> --- a/drivers/gpu/drm/amd/lib/Makefile
> +++ b/drivers/gpu/drm/amd/lib/Makefile
> @@ -27,6 +27,6 @@
>  # driver components or later moved to kernel/lib for sharing with
>  # other drivers.
>
> -ccflags-y := -I$(src)/../include
> +ccflags-y := -I $(srctree)/$(src)/../include
>
>  obj-$(CONFIG_CHASH) += chash.o
> diff --git a/drivers/gpu/drm/arm/display/komeda/Makefile 
> b/drivers/gpu/drm/arm/display/komeda/Makefile
> index 1b875e5..a72e30c 100644
> --- a/drivers/gpu/drm/arm/display/komeda/Makefile
> +++ b/drivers/gpu/drm/arm/display/komeda/Makefile
> @@ -1,8 +1,8 @@
>  # SPDX-License-Identifier: GPL-2.0
>
>  ccflags-y := \
> -   -I$(src)/../include \
> -   -I$(src)
> +   -I $(srctree)/$(src)/../include \
> +   -I $(srctree)/$(src)
>
>  komeda-y := \
> komeda_drv.o \
> diff --git a/drivers/gpu/drm/i915/gvt/Makefile 
> b/drivers/gpu/drm/i915/gvt/Makefile
> index 271fb46..ea8324a 100644
> --- a/drivers/gpu/drm/i915/gvt/Makefile
> +++ b/drivers/gpu/drm/i915/gvt/Makefile
> @@ -5,5 +5,5 @@ GVT_SOURCE := gvt.o aperture_gm.o handlers.o vgpu.o 
> trace_points.o firmware.o \
> execlist.o scheduler.o sched_policy.o mmio_context.o cmd_parser.o 
> debugfs.o \
> fb_decoder.o dmabuf.o page_track.o
>
> -ccflags-y  += -I$(src) -I$(src)/$(GVT_DIR)
> +ccflags-y  += -I $(srctree)/$(src) -I 
> $(srctree)/$(src)/$(GVT_DIR)/
>  i915-y += $(addprefix $(GVT_DIR)/, 
> $(GVT_SOURCE))
> diff --git a/drivers/gpu/drm/msm/Makefile b/drivers/gpu/drm/msm/Makefile
> index 56a70c7..b7b1ebd 100644
> --- a/drivers/gpu/drm/msm/Makefile
> +++ b/drivers/gpu/drm/msm/Makefile
> @@ -1,7 +1,7 @@
>  # SPDX-License-Identifier: GPL-2.0
> -ccflags-y := -Idrivers/gpu/drm/msm
> -ccflags-y += -Idrivers/gpu/drm/msm/disp/dpu1
> -ccflags-$(CONFIG_DRM_MSM_DSI) += -Idrivers/gpu/drm/msm/dsi
> +ccflags-y := -I $(srctree)/$(src)
> +ccflags-y += -I $(srctree)/$(src)/disp/dpu1
> +ccflags-$(CONFIG_DRM_MSM_DSI) += -I $(srctree)/$(src)/dsi
>
>  msm-y := \
> adreno/adreno_device.o \
> diff --git a/drivers/gpu/drm/nouveau/Kbuild b/drivers/gpu/drm/nouveau/Kbuild
> index ea3035e..4fae728 100644
> --- a/drivers/gpu/drm/nouveau/Kbuild
> +++ b/drivers/gpu/drm/nouveau/Kbuild
> @@ -1,7 +1,7 @@
> -ccflags-y += -I$(src)/include
> -ccflags-y += -I$(src)/include/nvkm
> -ccflags-y += -I$(src)/nvkm
> -ccflags-y += -I$(src)
> +ccflags-y += -I $(srctree)/$(src)/incl

[Intel-gfx] [PATCH v2] drm: prefix header search paths with $(srctree)/

2019-03-29 Thread Masahiro Yamada
Currently, the Kbuild core manipulates header search paths in a crazy
way [1].

To fix this mess, I want all Makefiles to add explicit $(srctree)/ to
the search paths in the srctree. Some Makefiles are already written in
that way, but not all. The goal of this work is to make the notation
consistent, and finally get rid of the gross hacks.

Having whitespaces after -I does not matter since commit 48f6e3cf5bc6
("kbuild: do not drop -I without parameter").

[1]: https://patchwork.kernel.org/patch/9632347/

Signed-off-by: Masahiro Yamada 
Reviewed-by: Sam Ravnborg 
---

I put all gpu/drm changes into a single patch because
they are trivial conversion.

If you are interested in the big picture of this work,
the full patch set is available at the following URL.

git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild.git 
build-test


Changes in v2:
  - fix up the new driver komeda
  - Add Sam's Reviewed-by

 drivers/gpu/drm/amd/amdgpu/Makefile | 2 +-
 drivers/gpu/drm/amd/lib/Makefile| 2 +-
 drivers/gpu/drm/arm/display/komeda/Makefile | 4 ++--
 drivers/gpu/drm/i915/gvt/Makefile   | 2 +-
 drivers/gpu/drm/msm/Makefile| 6 +++---
 drivers/gpu/drm/nouveau/Kbuild  | 8 
 6 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/Makefile 
b/drivers/gpu/drm/amd/amdgpu/Makefile
index 466da59..62bf9da 100644
--- a/drivers/gpu/drm/amd/amdgpu/Makefile
+++ b/drivers/gpu/drm/amd/amdgpu/Makefile
@@ -23,7 +23,7 @@
 # Makefile for the drm device driver.  This driver provides support for the
 # Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
 
-FULL_AMD_PATH=$(src)/..
+FULL_AMD_PATH=$(srctree)/$(src)/..
 DISPLAY_FOLDER_NAME=display
 FULL_AMD_DISPLAY_PATH = $(FULL_AMD_PATH)/$(DISPLAY_FOLDER_NAME)
 
diff --git a/drivers/gpu/drm/amd/lib/Makefile b/drivers/gpu/drm/amd/lib/Makefile
index 6902430..d534992 100644
--- a/drivers/gpu/drm/amd/lib/Makefile
+++ b/drivers/gpu/drm/amd/lib/Makefile
@@ -27,6 +27,6 @@
 # driver components or later moved to kernel/lib for sharing with
 # other drivers.
 
-ccflags-y := -I$(src)/../include
+ccflags-y := -I $(srctree)/$(src)/../include
 
 obj-$(CONFIG_CHASH) += chash.o
diff --git a/drivers/gpu/drm/arm/display/komeda/Makefile 
b/drivers/gpu/drm/arm/display/komeda/Makefile
index 1b875e5..a72e30c 100644
--- a/drivers/gpu/drm/arm/display/komeda/Makefile
+++ b/drivers/gpu/drm/arm/display/komeda/Makefile
@@ -1,8 +1,8 @@
 # SPDX-License-Identifier: GPL-2.0
 
 ccflags-y := \
-   -I$(src)/../include \
-   -I$(src)
+   -I $(srctree)/$(src)/../include \
+   -I $(srctree)/$(src)
 
 komeda-y := \
komeda_drv.o \
diff --git a/drivers/gpu/drm/i915/gvt/Makefile 
b/drivers/gpu/drm/i915/gvt/Makefile
index 271fb46..ea8324a 100644
--- a/drivers/gpu/drm/i915/gvt/Makefile
+++ b/drivers/gpu/drm/i915/gvt/Makefile
@@ -5,5 +5,5 @@ GVT_SOURCE := gvt.o aperture_gm.o handlers.o vgpu.o 
trace_points.o firmware.o \
execlist.o scheduler.o sched_policy.o mmio_context.o cmd_parser.o 
debugfs.o \
fb_decoder.o dmabuf.o page_track.o
 
-ccflags-y  += -I$(src) -I$(src)/$(GVT_DIR)
+ccflags-y  += -I $(srctree)/$(src) -I 
$(srctree)/$(src)/$(GVT_DIR)/
 i915-y += $(addprefix $(GVT_DIR)/, 
$(GVT_SOURCE))
diff --git a/drivers/gpu/drm/msm/Makefile b/drivers/gpu/drm/msm/Makefile
index 56a70c7..b7b1ebd 100644
--- a/drivers/gpu/drm/msm/Makefile
+++ b/drivers/gpu/drm/msm/Makefile
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0
-ccflags-y := -Idrivers/gpu/drm/msm
-ccflags-y += -Idrivers/gpu/drm/msm/disp/dpu1
-ccflags-$(CONFIG_DRM_MSM_DSI) += -Idrivers/gpu/drm/msm/dsi
+ccflags-y := -I $(srctree)/$(src)
+ccflags-y += -I $(srctree)/$(src)/disp/dpu1
+ccflags-$(CONFIG_DRM_MSM_DSI) += -I $(srctree)/$(src)/dsi
 
 msm-y := \
adreno/adreno_device.o \
diff --git a/drivers/gpu/drm/nouveau/Kbuild b/drivers/gpu/drm/nouveau/Kbuild
index ea3035e..4fae728 100644
--- a/drivers/gpu/drm/nouveau/Kbuild
+++ b/drivers/gpu/drm/nouveau/Kbuild
@@ -1,7 +1,7 @@
-ccflags-y += -I$(src)/include
-ccflags-y += -I$(src)/include/nvkm
-ccflags-y += -I$(src)/nvkm
-ccflags-y += -I$(src)
+ccflags-y += -I $(srctree)/$(src)/include
+ccflags-y += -I $(srctree)/$(src)/include/nvkm
+ccflags-y += -I $(srctree)/$(src)/nvkm
+ccflags-y += -I $(srctree)/$(src)
 
 # NVKM - HW resource manager
 #- code also used by various userspace tools/tests
-- 
2.7.4

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Re: [Intel-gfx] [PATCH] drm: prefix header search paths with $(srctree)/

2019-02-17 Thread Masahiro Yamada
On Thu, Jan 31, 2019 at 1:01 PM Masahiro Yamada
 wrote:
>
> Currently, the Kbuild core manipulates header search paths in a crazy
> way [1].
>
> To fix this mess, I want all Makefiles to add explicit $(srctree)/ to
> the search paths in the srctree. Some Makefiles are already written in
> that way, but not all. The goal of this work is to make the notation
> consistent, and finally get rid of the gross hacks.
>
> Having whitespaces after -I does not matter since commit 48f6e3cf5bc6
> ("kbuild: do not drop -I without parameter").
>
> [1]: https://patchwork.kernel.org/patch/9632347/
>
> Signed-off-by: Masahiro Yamada 
> ---


Could you take a look at this series, please?

Thanks.





> I put all gpu/drm changes into a single patch because
> they are trivial conversion.
>
> Please let me know if I need to split this into per-driver patches.
>
>
>  drivers/gpu/drm/amd/amdgpu/Makefile | 2 +-
>  drivers/gpu/drm/amd/lib/Makefile| 2 +-
>  drivers/gpu/drm/i915/gvt/Makefile   | 2 +-
>  drivers/gpu/drm/msm/Makefile| 6 +++---
>  drivers/gpu/drm/nouveau/Kbuild  | 8 
>  5 files changed, 10 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/Makefile 
> b/drivers/gpu/drm/amd/amdgpu/Makefile
> index f76bcb9..b21ebb0 100644
> --- a/drivers/gpu/drm/amd/amdgpu/Makefile
> +++ b/drivers/gpu/drm/amd/amdgpu/Makefile
> @@ -23,7 +23,7 @@
>  # Makefile for the drm device driver.  This driver provides support for the
>  # Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
>
> -FULL_AMD_PATH=$(src)/..
> +FULL_AMD_PATH=$(srctree)/$(src)/..
>  DISPLAY_FOLDER_NAME=display
>  FULL_AMD_DISPLAY_PATH = $(FULL_AMD_PATH)/$(DISPLAY_FOLDER_NAME)
>
> diff --git a/drivers/gpu/drm/amd/lib/Makefile 
> b/drivers/gpu/drm/amd/lib/Makefile
> index 6902430..d534992 100644
> --- a/drivers/gpu/drm/amd/lib/Makefile
> +++ b/drivers/gpu/drm/amd/lib/Makefile
> @@ -27,6 +27,6 @@
>  # driver components or later moved to kernel/lib for sharing with
>  # other drivers.
>
> -ccflags-y := -I$(src)/../include
> +ccflags-y := -I $(srctree)/$(src)/../include
>
>  obj-$(CONFIG_CHASH) += chash.o
> diff --git a/drivers/gpu/drm/i915/gvt/Makefile 
> b/drivers/gpu/drm/i915/gvt/Makefile
> index b016dc7..a4a5a96 100644
> --- a/drivers/gpu/drm/i915/gvt/Makefile
> +++ b/drivers/gpu/drm/i915/gvt/Makefile
> @@ -5,6 +5,6 @@ GVT_SOURCE := gvt.o aperture_gm.o handlers.o vgpu.o 
> trace_points.o firmware.o \
> execlist.o scheduler.o sched_policy.o mmio_context.o cmd_parser.o 
> debugfs.o \
> fb_decoder.o dmabuf.o page_track.o
>
> -ccflags-y  += -I$(src) -I$(src)/$(GVT_DIR)
> +ccflags-y  += -I $(srctree)/$(src) -I 
> $(srctree)/$(src)/$(GVT_DIR)/
>  i915-y += $(addprefix $(GVT_DIR)/, 
> $(GVT_SOURCE))
>  obj-$(CONFIG_DRM_I915_GVT_KVMGT)   += $(GVT_DIR)/kvmgt.o
> diff --git a/drivers/gpu/drm/msm/Makefile b/drivers/gpu/drm/msm/Makefile
> index 56a70c7..b7b1ebd 100644
> --- a/drivers/gpu/drm/msm/Makefile
> +++ b/drivers/gpu/drm/msm/Makefile
> @@ -1,7 +1,7 @@
>  # SPDX-License-Identifier: GPL-2.0
> -ccflags-y := -Idrivers/gpu/drm/msm
> -ccflags-y += -Idrivers/gpu/drm/msm/disp/dpu1
> -ccflags-$(CONFIG_DRM_MSM_DSI) += -Idrivers/gpu/drm/msm/dsi
> +ccflags-y := -I $(srctree)/$(src)
> +ccflags-y += -I $(srctree)/$(src)/disp/dpu1
> +ccflags-$(CONFIG_DRM_MSM_DSI) += -I $(srctree)/$(src)/dsi
>
>  msm-y := \
> adreno/adreno_device.o \
> diff --git a/drivers/gpu/drm/nouveau/Kbuild b/drivers/gpu/drm/nouveau/Kbuild
> index b17843d..b4bc88ad 100644
> --- a/drivers/gpu/drm/nouveau/Kbuild
> +++ b/drivers/gpu/drm/nouveau/Kbuild
> @@ -1,7 +1,7 @@
> -ccflags-y += -I$(src)/include
> -ccflags-y += -I$(src)/include/nvkm
> -ccflags-y += -I$(src)/nvkm
> -ccflags-y += -I$(src)
> +ccflags-y += -I $(srctree)/$(src)/include
> +ccflags-y += -I $(srctree)/$(src)/include/nvkm
> +ccflags-y += -I $(srctree)/$(src)/nvkm
> +ccflags-y += -I $(srctree)/$(src)
>
>  # NVKM - HW resource manager
>  #- code also used by various userspace tools/tests
> --
> 2.7.4
>


-- 
Best Regards
Masahiro Yamada
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

[Intel-gfx] [PATCH] drm: prefix header search paths with $(srctree)/

2019-01-30 Thread Masahiro Yamada
Currently, the Kbuild core manipulates header search paths in a crazy
way [1].

To fix this mess, I want all Makefiles to add explicit $(srctree)/ to
the search paths in the srctree. Some Makefiles are already written in
that way, but not all. The goal of this work is to make the notation
consistent, and finally get rid of the gross hacks.

Having whitespaces after -I does not matter since commit 48f6e3cf5bc6
("kbuild: do not drop -I without parameter").

[1]: https://patchwork.kernel.org/patch/9632347/

Signed-off-by: Masahiro Yamada 
---

I put all gpu/drm changes into a single patch because
they are trivial conversion.

Please let me know if I need to split this into per-driver patches.


 drivers/gpu/drm/amd/amdgpu/Makefile | 2 +-
 drivers/gpu/drm/amd/lib/Makefile| 2 +-
 drivers/gpu/drm/i915/gvt/Makefile   | 2 +-
 drivers/gpu/drm/msm/Makefile| 6 +++---
 drivers/gpu/drm/nouveau/Kbuild  | 8 
 5 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/Makefile 
b/drivers/gpu/drm/amd/amdgpu/Makefile
index f76bcb9..b21ebb0 100644
--- a/drivers/gpu/drm/amd/amdgpu/Makefile
+++ b/drivers/gpu/drm/amd/amdgpu/Makefile
@@ -23,7 +23,7 @@
 # Makefile for the drm device driver.  This driver provides support for the
 # Direct Rendering Infrastructure (DRI) in XFree86 4.1.0 and higher.
 
-FULL_AMD_PATH=$(src)/..
+FULL_AMD_PATH=$(srctree)/$(src)/..
 DISPLAY_FOLDER_NAME=display
 FULL_AMD_DISPLAY_PATH = $(FULL_AMD_PATH)/$(DISPLAY_FOLDER_NAME)
 
diff --git a/drivers/gpu/drm/amd/lib/Makefile b/drivers/gpu/drm/amd/lib/Makefile
index 6902430..d534992 100644
--- a/drivers/gpu/drm/amd/lib/Makefile
+++ b/drivers/gpu/drm/amd/lib/Makefile
@@ -27,6 +27,6 @@
 # driver components or later moved to kernel/lib for sharing with
 # other drivers.
 
-ccflags-y := -I$(src)/../include
+ccflags-y := -I $(srctree)/$(src)/../include
 
 obj-$(CONFIG_CHASH) += chash.o
diff --git a/drivers/gpu/drm/i915/gvt/Makefile 
b/drivers/gpu/drm/i915/gvt/Makefile
index b016dc7..a4a5a96 100644
--- a/drivers/gpu/drm/i915/gvt/Makefile
+++ b/drivers/gpu/drm/i915/gvt/Makefile
@@ -5,6 +5,6 @@ GVT_SOURCE := gvt.o aperture_gm.o handlers.o vgpu.o 
trace_points.o firmware.o \
execlist.o scheduler.o sched_policy.o mmio_context.o cmd_parser.o 
debugfs.o \
fb_decoder.o dmabuf.o page_track.o
 
-ccflags-y  += -I$(src) -I$(src)/$(GVT_DIR)
+ccflags-y  += -I $(srctree)/$(src) -I 
$(srctree)/$(src)/$(GVT_DIR)/
 i915-y += $(addprefix $(GVT_DIR)/, 
$(GVT_SOURCE))
 obj-$(CONFIG_DRM_I915_GVT_KVMGT)   += $(GVT_DIR)/kvmgt.o
diff --git a/drivers/gpu/drm/msm/Makefile b/drivers/gpu/drm/msm/Makefile
index 56a70c7..b7b1ebd 100644
--- a/drivers/gpu/drm/msm/Makefile
+++ b/drivers/gpu/drm/msm/Makefile
@@ -1,7 +1,7 @@
 # SPDX-License-Identifier: GPL-2.0
-ccflags-y := -Idrivers/gpu/drm/msm
-ccflags-y += -Idrivers/gpu/drm/msm/disp/dpu1
-ccflags-$(CONFIG_DRM_MSM_DSI) += -Idrivers/gpu/drm/msm/dsi
+ccflags-y := -I $(srctree)/$(src)
+ccflags-y += -I $(srctree)/$(src)/disp/dpu1
+ccflags-$(CONFIG_DRM_MSM_DSI) += -I $(srctree)/$(src)/dsi
 
 msm-y := \
adreno/adreno_device.o \
diff --git a/drivers/gpu/drm/nouveau/Kbuild b/drivers/gpu/drm/nouveau/Kbuild
index b17843d..b4bc88ad 100644
--- a/drivers/gpu/drm/nouveau/Kbuild
+++ b/drivers/gpu/drm/nouveau/Kbuild
@@ -1,7 +1,7 @@
-ccflags-y += -I$(src)/include
-ccflags-y += -I$(src)/include/nvkm
-ccflags-y += -I$(src)/nvkm
-ccflags-y += -I$(src)
+ccflags-y += -I $(srctree)/$(src)/include
+ccflags-y += -I $(srctree)/$(src)/include/nvkm
+ccflags-y += -I $(srctree)/$(src)/nvkm
+ccflags-y += -I $(srctree)/$(src)
 
 # NVKM - HW resource manager
 #- code also used by various userspace tools/tests
-- 
2.7.4

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH 00/12] radix-tree: split out struct radix_tree_root out to

2017-10-10 Thread Masahiro Yamada
2017-10-10 21:18 GMT+09:00 Matthew Wilcox <wi...@infradead.org>:
> On Mon, Oct 09, 2017 at 01:10:01AM +0900, Masahiro Yamada wrote:
>> Reducing the header dependency will help for speeding the kernel
>> build, suppressing unnecessary recompile of objects during
>> git-bisect'ing, etc.
>
> Well, does it?  You could provide measurements showing before/after
> time to compile, or time to recompile after touching a header file that
> is included by radix-tree.h and not by radix-tree-root.h.
>
> Look at the files included (never mind the transitively included files):
>
> #include 
> #include 
> #include 
> #include 
> #include 
> #include 
> #include 
> #include 
>
> These are not exactly rare files to be included.  My guess is that most
> of the files in the kernel end up depending on these files *anyway*, either
> directly or through some path that isn't the radix tree.


Good question.

I tested this series, and I confirmed
the total number of included headers decreased,
but did not decrease as much as I had expected.

The statement "most of the files in the kernel end
up depending on these files" is true.

But, with that excuse,
I do not want to conclude this kind of refactoring is pointless.


For example, how can we explain
commit bc6245e5efd70c41eaf9334b1b5e646745cb0fb3 ?


 includes the following three.

#include 
#include 
#include 

Your statement applies to them too.
Actually, I did not see any impact
by replacing  in my files with 



Generally, people do not pay much attention
in decreasing header dependency.

One refactoring alone does not produce much benefits,
but making continuous efforts will disentangle the knotted threads.
Of course, this might be a pipe dream...



-- 
Best Regards
Masahiro Yamada
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH 00/12] radix-tree: split out struct radix_tree_root out to

2017-10-09 Thread Masahiro Yamada
2017-10-09 3:52 GMT+09:00 Leon Romanovsky <leo...@mellanox.com>:
> On Mon, Oct 09, 2017 at 01:10:01AM +0900, Masahiro Yamada wrote:
>
> <...>
>>
>> By splitting out the radix_tree_root definition,
>> we can reduce the header file dependency.
>>
>> Reducing the header dependency will help for speeding the kernel
>> build, suppressing unnecessary recompile of objects during
>> git-bisect'ing, etc.
>
> If we judge by the diffstat of this series, there won't be any
> visible change in anything mentioned above.


Of course, judging by the diffstat is wrong.



-- 
Best Regards
Masahiro Yamada
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH 12/12] drm/i915: replace with

2017-10-08 Thread Masahiro Yamada
The header drivers/gpu/drm/i915/i915_gem_context.h requires the
definition of struct radix_tree_root, but does not need to know
anything about other radix tree stuff.

Include  instead of  to
reduce the number of included header files.

While we are here, let's add missing  where
radix tree accessors are used.

Signed-off-by: Masahiro Yamada <yamada.masah...@socionext.com>
---

 drivers/gpu/drm/i915/i915_gem.c| 1 +
 drivers/gpu/drm/i915/i915_gem_context.c| 1 +
 drivers/gpu/drm/i915/i915_gem_context.h| 2 +-
 drivers/gpu/drm/i915/i915_gem_execbuffer.c | 1 +
 drivers/gpu/drm/i915/i915_gem_object.h | 1 +
 5 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 19404c9..d2356eb 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -37,6 +37,7 @@
 #include "intel_mocs.h"
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
diff --git a/drivers/gpu/drm/i915/i915_gem_context.c 
b/drivers/gpu/drm/i915/i915_gem_context.c
index 58a2a44..34b2195 100644
--- a/drivers/gpu/drm/i915/i915_gem_context.c
+++ b/drivers/gpu/drm/i915/i915_gem_context.c
@@ -86,6 +86,7 @@
  */
 
 #include 
+#include 
 #include 
 #include 
 #include "i915_drv.h"
diff --git a/drivers/gpu/drm/i915/i915_gem_context.h 
b/drivers/gpu/drm/i915/i915_gem_context.h
index 44688e2..0ebe11f 100644
--- a/drivers/gpu/drm/i915/i915_gem_context.h
+++ b/drivers/gpu/drm/i915/i915_gem_context.h
@@ -27,7 +27,7 @@
 
 #include 
 #include 
-#include 
+#include 
 
 struct pid;
 
diff --git a/drivers/gpu/drm/i915/i915_gem_execbuffer.c 
b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
index 92437f4..af9ee58 100644
--- a/drivers/gpu/drm/i915/i915_gem_execbuffer.c
+++ b/drivers/gpu/drm/i915/i915_gem_execbuffer.c
@@ -27,6 +27,7 @@
  */
 
 #include 
+#include 
 #include 
 #include 
 #include 
diff --git a/drivers/gpu/drm/i915/i915_gem_object.h 
b/drivers/gpu/drm/i915/i915_gem_object.h
index c30d8f8..a5a5506 100644
--- a/drivers/gpu/drm/i915/i915_gem_object.h
+++ b/drivers/gpu/drm/i915/i915_gem_object.h
@@ -25,6 +25,7 @@
 #ifndef __I915_GEM_OBJECT_H__
 #define __I915_GEM_OBJECT_H__
 
+#include 
 #include 
 
 #include 
-- 
2.7.4

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH 00/12] radix-tree: split out struct radix_tree_root out to

2017-10-08 Thread Masahiro Yamada

The motivation of this series is to cut down unnecessary header
dependency in terms of radix tree.

Sub-systems or drivers that use radix-tree for data management
typically embed struct radix_tree_root in their data structures,
like this:

struct foo {
   ...

   struct radix_tree_root   foo_tree;
   ...
};

So,  needs to include ,
therefore, users of  include a lot of bloat
from .

If you see the definition of radix_tree_root,

   struct radix_tree_root {
   gfp_tgfp_mask;
   struct radix_tree_node   __rcu *rnode;
   };

it is a very simple structure.
It only depends on  for gfp_t and
 for __rcu.

By splitting out the radix_tree_root definition,
we can reduce the header file dependency.

Reducing the header dependency will help for speeding the kernel
build, suppressing unnecessary recompile of objects during
git-bisect'ing, etc.

The patch 1 is a trivial clean-up; it is just here
to avoid conflict.

The patch 2 is the main part of this series;
split out struct radix_tree_root.

The rest of the series replace 
with  where appropriate.

Please review if the idea is OK.

If it is OK, I'd like to know how to apply the series.

Perhaps, the first two for v4.15.  Then, rest of series
will be sent per-subsystem for v4.16?

Or, can somebody take care of the whole series?

I checked allmodconfig for x86 and arm64.
I am expecting 0 day testing will check it too.



Masahiro Yamada (12):
  radix-tree: replace  with 
  radix-tree: split struct radix_tree_root to 
  irqdomain: replace  with 
  writeback: replace  with 
  iocontext.h: replace  with

  fs: replace  with 
  blkcg: replace  with 
  fscache: include 
  sh: intc: replace  with 
  net/mlx4: replace  with 
  net/mlx5: replace  with 
  drm/i915: replace  with 

 drivers/gpu/drm/i915/i915_gem.c|  1 +
 drivers/gpu/drm/i915/i915_gem_context.c|  1 +
 drivers/gpu/drm/i915/i915_gem_context.h|  2 +-
 drivers/gpu/drm/i915/i915_gem_execbuffer.c |  1 +
 drivers/gpu/drm/i915/i915_gem_object.h |  1 +
 drivers/net/ethernet/mellanox/mlx4/cq.c|  1 +
 drivers/net/ethernet/mellanox/mlx4/mlx4.h  |  2 +-
 drivers/net/ethernet/mellanox/mlx4/qp.c|  1 +
 drivers/net/ethernet/mellanox/mlx4/srq.c   |  1 +
 drivers/sh/intc/internals.h|  2 +-
 include/linux/backing-dev-defs.h   |  2 +-
 include/linux/blk-cgroup.h |  2 +-
 include/linux/fs.h |  2 +-
 include/linux/fscache.h|  1 +
 include/linux/iocontext.h  |  2 +-
 include/linux/irqdomain.h  |  2 +-
 include/linux/mlx4/device.h|  2 +-
 include/linux/mlx4/qp.h|  1 +
 include/linux/mlx5/driver.h|  2 +-
 include/linux/mlx5/qp.h|  1 +
 include/linux/radix-tree-root.h| 24 
 include/linux/radix-tree.h |  8 ++--
 22 files changed, 46 insertions(+), 16 deletions(-)
 create mode 100644 include/linux/radix-tree-root.h

-- 
2.7.4

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH v3 5/5] drm/i915: squash lines for simple wrapper functions

2016-09-16 Thread Masahiro Yamada
Hi Chris,


2016-09-16 15:15 GMT+09:00 Chris Wilson <ch...@chris-wilson.co.uk>:
> On Fri, Sep 16, 2016 at 10:40:23AM +0900, Masahiro Yamada wrote:
>> Remove unneeded variables and assignments.
>>
>> Signed-off-by: Masahiro Yamada <yamada.masah...@socionext.com>
>> ---
>>
>> Changes in v3:
>>   - Keep the wrapper function.
>> Cleanup of variables and assignments only.
>>   - Fix intel_engine_init_common() as well.
>>
>>  drivers/gpu/drm/i915/i915_drv.c| 8 +---
>>  drivers/gpu/drm/i915/intel_engine_cs.c | 8 +---
>>  2 files changed, 2 insertions(+), 14 deletions(-)
>>
>> diff --git a/drivers/gpu/drm/i915/i915_drv.c 
>> b/drivers/gpu/drm/i915/i915_drv.c
>> index 7f4e8ad..1503c88 100644
>> --- a/drivers/gpu/drm/i915/i915_drv.c
>> +++ b/drivers/gpu/drm/i915/i915_drv.c
>> @@ -1324,13 +1324,7 @@ void i915_driver_unload(struct drm_device *dev)
>>
>>  static int i915_driver_open(struct drm_device *dev, struct drm_file *file)
>>  {
>> - int ret;
>> -
>> - ret = i915_gem_open(dev, file);
>> - if (ret)
>> - return ret;
>> -
>> - return 0;
>> + return i915_gem_open(dev, file);
>>  }
>>
>>  /**
>> diff --git a/drivers/gpu/drm/i915/intel_engine_cs.c 
>> b/drivers/gpu/drm/i915/intel_engine_cs.c
>> index e405f10..ebb4bf8 100644
>> --- a/drivers/gpu/drm/i915/intel_engine_cs.c
>> +++ b/drivers/gpu/drm/i915/intel_engine_cs.c
>> @@ -298,13 +298,7 @@ static void intel_engine_cleanup_scratch(struct 
>> intel_engine_cs *engine)
>>   */
>>  int intel_engine_init_common(struct intel_engine_cs *engine)
>>  {
>> - int ret;
>> -
>> - ret = intel_engine_init_breadcrumbs(engine);
>> - if (ret)
>> - return ret;
>> -
>> - return 0;
>> + return intel_engine_init_breadcrumbs(engine);
>
> These are written like this for consistency and ease of change.
> -Chris
>

OK, then please feel free to reject this patch.




-- 
Best Regards
Masahiro Yamada
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH v3 5/5] drm/i915: squash lines for simple wrapper functions

2016-09-15 Thread Masahiro Yamada
Remove unneeded variables and assignments.

Signed-off-by: Masahiro Yamada <yamada.masah...@socionext.com>
---

Changes in v3:
  - Keep the wrapper function.
Cleanup of variables and assignments only.
  - Fix intel_engine_init_common() as well.

 drivers/gpu/drm/i915/i915_drv.c| 8 +---
 drivers/gpu/drm/i915/intel_engine_cs.c | 8 +---
 2 files changed, 2 insertions(+), 14 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 7f4e8ad..1503c88 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -1324,13 +1324,7 @@ void i915_driver_unload(struct drm_device *dev)
 
 static int i915_driver_open(struct drm_device *dev, struct drm_file *file)
 {
-   int ret;
-
-   ret = i915_gem_open(dev, file);
-   if (ret)
-   return ret;
-
-   return 0;
+   return i915_gem_open(dev, file);
 }
 
 /**
diff --git a/drivers/gpu/drm/i915/intel_engine_cs.c 
b/drivers/gpu/drm/i915/intel_engine_cs.c
index e405f10..ebb4bf8 100644
--- a/drivers/gpu/drm/i915/intel_engine_cs.c
+++ b/drivers/gpu/drm/i915/intel_engine_cs.c
@@ -298,13 +298,7 @@ static void intel_engine_cleanup_scratch(struct 
intel_engine_cs *engine)
  */
 int intel_engine_init_common(struct intel_engine_cs *engine)
 {
-   int ret;
-
-   ret = intel_engine_init_breadcrumbs(engine);
-   if (ret)
-   return ret;
-
-   return 0;
+   return intel_engine_init_breadcrumbs(engine);
 }
 
 void intel_engine_reset_irq(struct intel_engine_cs *engine)
-- 
1.9.1

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH v2 5/5] drm/i915: use i915_gem_open() directly instead of i915_driver_open()

2016-09-15 Thread Masahiro Yamada
2016-09-15 18:46 GMT+09:00 Jani Nikula <jani.nik...@linux.intel.com>:
> On Wed, 14 Sep 2016, Masahiro Yamada <yamada.masah...@socionext.com> wrote:
>> i915_driver_open() is equivalent to i915_gem_open().  Replace the
>> i915_driver_open with the direct use of i915_gem_open().
>
> Sorry I know I asked for this, but there was opposition to doing
> this. Please just do the return i915_gem_open(dev, file) version like
> you had originally.

Sure.

(I was also wondering if it is the right thing to do.)

I will send v3.





-- 
Best Regards
Masahiro Yamada
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH v2 0/5] drm: clean up several wrapper functions

2016-09-14 Thread Masahiro Yamada
Changes in v2:
  - Split per-driver
  - Remove i915_driver_open()
  - Fix dce_virtual_hw_init() as well

Masahiro Yamada (5):
  drm/amdgpu: squash lines for simple wrapper functions
  drm/radeon: squash lines for simple wrapper functions
  drm/bridge: squash lines for simple wrapper functions
  drm/qxl: squash lines for simple wrapper functions
  drm/i915: use i915_gem_open() directly instead of i915_driver_open()

 drivers/gpu/drm/amd/amdgpu/dce_virtual.c  |  6 +-
 drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c|  6 +-
 drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c|  6 +-
 drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c | 20 
 drivers/gpu/drm/i915/i915_drv.c   | 13 +
 drivers/gpu/drm/qxl/qxl_draw.c|  7 ++-
 drivers/gpu/drm/qxl/qxl_release.c |  7 ++-
 drivers/gpu/drm/radeon/cik.c  |  6 +-
 drivers/gpu/drm/radeon/r100.c |  6 +-
 drivers/gpu/drm/radeon/r600.c |  6 +-
 10 files changed, 15 insertions(+), 68 deletions(-)

-- 
1.9.1

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH v2 5/5] drm/i915: use i915_gem_open() directly instead of i915_driver_open()

2016-09-14 Thread Masahiro Yamada
i915_driver_open() is equivalent to i915_gem_open().  Replace the
i915_driver_open with the direct use of i915_gem_open().

Signed-off-by: Masahiro Yamada <yamada.masah...@socionext.com>
---

 drivers/gpu/drm/i915/i915_drv.c | 13 +
 1 file changed, 1 insertion(+), 12 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index 7f4e8ad..d3a33c4 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -1322,17 +1322,6 @@ void i915_driver_unload(struct drm_device *dev)
i915_driver_cleanup_early(dev_priv);
 }
 
-static int i915_driver_open(struct drm_device *dev, struct drm_file *file)
-{
-   int ret;
-
-   ret = i915_gem_open(dev, file);
-   if (ret)
-   return ret;
-
-   return 0;
-}
-
 /**
  * i915_driver_lastclose - clean up after all DRM clients have exited
  * @dev: DRM device
@@ -2569,7 +2558,7 @@ static int intel_runtime_resume(struct device *kdev)
.driver_features =
DRIVER_HAVE_IRQ | DRIVER_IRQ_SHARED | DRIVER_GEM | DRIVER_PRIME |
DRIVER_RENDER | DRIVER_MODESET,
-   .open = i915_driver_open,
+   .open = i915_gem_open,
.lastclose = i915_driver_lastclose,
.preclose = i915_driver_preclose,
.postclose = i915_driver_postclose,
-- 
1.9.1

___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH] drm: squash lines for simple wrapper functions

2016-09-07 Thread Masahiro Yamada
Hi Jani,


2016-09-07 17:34 GMT+09:00 Jani Nikula <jani.nik...@linux.intel.com>:
> On Wed, 07 Sep 2016, Masahiro Yamada <yamada.masah...@socionext.com> wrote:
>> Remove unneeded variables and assignments.
>>
>> Signed-off-by: Masahiro Yamada <yamada.masah...@socionext.com>
>
> ...
>
>> diff --git a/drivers/gpu/drm/i915/i915_drv.c 
>> b/drivers/gpu/drm/i915/i915_drv.c
>> index 95ddd56..59d029d 100644
>> --- a/drivers/gpu/drm/i915/i915_drv.c
>> +++ b/drivers/gpu/drm/i915/i915_drv.c
>> @@ -1361,13 +1361,7 @@ void i915_driver_unload(struct drm_device *dev)
>>
>>  static int i915_driver_open(struct drm_device *dev, struct drm_file *file)
>>  {
>> - int ret;
>> -
>> - ret = i915_gem_open(dev, file);
>> - if (ret)
>> - return ret;
>> -
>> - return 0;
>> + return i915_gem_open(dev, file);
>>  }
>
> Seems to me the whole function could be replaced by a direct use of
> i915_gem_open().

Good catch.


Shall I send v2?

Or, should it be done in a separate follow-up patch?
(I hope you can do it in this case.)



-- 
Best Regards
Masahiro Yamada
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx


[Intel-gfx] [PATCH] drm: squash lines for simple wrapper functions

2016-09-07 Thread Masahiro Yamada
Remove unneeded variables and assignments.

Signed-off-by: Masahiro Yamada <yamada.masah...@socionext.com>
---

 drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c |  6 +-
 drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c|  6 +-
 drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c|  6 +-
 drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c | 20 
 drivers/gpu/drm/drm_dp_mst_topology.c |  7 ++-
 drivers/gpu/drm/i915/i915_drv.c   |  8 +---
 drivers/gpu/drm/qxl/qxl_draw.c|  7 ++-
 drivers/gpu/drm/qxl/qxl_release.c |  7 ++-
 drivers/gpu/drm/radeon/cik.c  |  6 +-
 drivers/gpu/drm/radeon/r100.c |  6 +-
 drivers/gpu/drm/radeon/r600.c |  6 +-
 11 files changed, 17 insertions(+), 68 deletions(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c 
b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
index b818461..0d5307a 100644
--- a/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/gfx_v8_0.c
@@ -5854,11 +5854,7 @@ static int gfx_v8_0_set_clockgating_state(void *handle,
 
 static u32 gfx_v8_0_ring_get_rptr_gfx(struct amdgpu_ring *ring)
 {
-   u32 rptr;
-
-   rptr = ring->adev->wb.wb[ring->rptr_offs];
-
-   return rptr;
+   return ring->adev->wb.wb[ring->rptr_offs];
 }
 
 static u32 gfx_v8_0_ring_get_wptr_gfx(struct amdgpu_ring *ring)
diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c 
b/drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c
index a64715d..b165c78 100644
--- a/drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c
+++ b/drivers/gpu/drm/amd/amdgpu/sdma_v2_4.c
@@ -190,12 +190,8 @@ out:
  */
 static uint32_t sdma_v2_4_ring_get_rptr(struct amdgpu_ring *ring)
 {
-   u32 rptr;
-
/* XXX check if swapping is necessary on BE */
-   rptr = ring->adev->wb.wb[ring->rptr_offs] >> 2;
-
-   return rptr;
+   return ring->adev->wb.wb[ring->rptr_offs] >> 2;
 }
 
 /**
diff --git a/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c 
b/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c
index 653ce5e..cf253b9 100644
--- a/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/sdma_v3_0.c
@@ -335,12 +335,8 @@ out:
  */
 static uint32_t sdma_v3_0_ring_get_rptr(struct amdgpu_ring *ring)
 {
-   u32 rptr;
-
/* XXX check if swapping is necessary on BE */
-   rptr = ring->adev->wb.wb[ring->rptr_offs] >> 2;
-
-   return rptr;
+   return ring->adev->wb.wb[ring->rptr_offs] >> 2;
 }
 
 /**
diff --git a/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c 
b/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c
index 48030f0..d37d112 100644
--- a/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c
+++ b/drivers/gpu/drm/bridge/analogix/analogix_dp_reg.c
@@ -1073,34 +1073,22 @@ void analogix_dp_set_lane3_link_training(struct 
analogix_dp_device *dp,
 
 u32 analogix_dp_get_lane0_link_training(struct analogix_dp_device *dp)
 {
-   u32 reg;
-
-   reg = readl(dp->reg_base + ANALOGIX_DP_LN0_LINK_TRAINING_CTL);
-   return reg;
+   return readl(dp->reg_base + ANALOGIX_DP_LN0_LINK_TRAINING_CTL);
 }
 
 u32 analogix_dp_get_lane1_link_training(struct analogix_dp_device *dp)
 {
-   u32 reg;
-
-   reg = readl(dp->reg_base + ANALOGIX_DP_LN1_LINK_TRAINING_CTL);
-   return reg;
+   return readl(dp->reg_base + ANALOGIX_DP_LN1_LINK_TRAINING_CTL);
 }
 
 u32 analogix_dp_get_lane2_link_training(struct analogix_dp_device *dp)
 {
-   u32 reg;
-
-   reg = readl(dp->reg_base + ANALOGIX_DP_LN2_LINK_TRAINING_CTL);
-   return reg;
+   return readl(dp->reg_base + ANALOGIX_DP_LN2_LINK_TRAINING_CTL);
 }
 
 u32 analogix_dp_get_lane3_link_training(struct analogix_dp_device *dp)
 {
-   u32 reg;
-
-   reg = readl(dp->reg_base + ANALOGIX_DP_LN3_LINK_TRAINING_CTL);
-   return reg;
+   return readl(dp->reg_base + ANALOGIX_DP_LN3_LINK_TRAINING_CTL);
 }
 
 void analogix_dp_reset_macro(struct analogix_dp_device *dp)
diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c 
b/drivers/gpu/drm/drm_dp_mst_topology.c
index 04e4571..302bdcb 100644
--- a/drivers/gpu/drm/drm_dp_mst_topology.c
+++ b/drivers/gpu/drm/drm_dp_mst_topology.c
@@ -737,16 +737,13 @@ static void drm_dp_mst_put_payload_id(struct 
drm_dp_mst_topology_mgr *mgr,
 static bool check_txmsg_state(struct drm_dp_mst_topology_mgr *mgr,
  struct drm_dp_sideband_msg_tx *txmsg)
 {
-   bool ret;
-
/*
 * All updates to txmsg->state are protected by mgr->qlock, and the two
 * cases we check here are terminal states. For those the barriers
 * provided by the wake_up/wait_event pair are enough.
 */
-   ret = (txmsg->state == DRM_DP_SIDEBAND_TX_RX ||
-  txmsg->state == DRM_DP_SIDEBAND_TX_TIMEOUT);
-   return ret;
+   return txmsg->state == DRM_DP_SI