[v2] drm/i915: Move LRC register offsets to a header file

Submitted by Michel Thierry on Jan. 22, 2018, 8:32 p.m.

Details

Message ID 20180122203257.33946-1-michel.thierry@intel.com
State New
Headers show
Series "drm/i915: Move LRC register offsets to a header file" ( rev: 2 ) in Intel GFX

Not browsing as part of any series.

Commit Message

Michel Thierry Jan. 22, 2018, 8:32 p.m.
Newer platforms may have subtle offset changes, which will increase the
number of defines, so it is probably better to start moving them to its
own header file. Also move the macros used while setting the reg state.

v2: Rename to intel_lrc_reg.h, to be consistent with i915_reg.h and
intel_guc_reg.h (Chris)

Signed-off-by: Michel Thierry <michel.thierry@intel.com>
Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
Cc: Lucas De Marchi <lucas.demarchi@intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/intel_lrc.c     | 50 +----------------------
 drivers/gpu/drm/i915/intel_lrc_reg.h | 78 ++++++++++++++++++++++++++++++++++++
 2 files changed, 79 insertions(+), 49 deletions(-)
 create mode 100644 drivers/gpu/drm/i915/intel_lrc_reg.h

Patch hide | download patch | download mbox

diff --git a/drivers/gpu/drm/i915/intel_lrc.c b/drivers/gpu/drm/i915/intel_lrc.c
index 506bc2bc04f9..3cf30b982524 100644
--- a/drivers/gpu/drm/i915/intel_lrc.c
+++ b/drivers/gpu/drm/i915/intel_lrc.c
@@ -137,6 +137,7 @@ 
 #include <drm/i915_drm.h>
 #include "i915_drv.h"
 #include "i915_gem_render_state.h"
+#include "intel_lrc_reg.h"
 #include "intel_mocs.h"
 
 #define RING_EXECLIST_QFULL		(1 << 0x2)
@@ -156,55 +157,6 @@ 
 #define GEN8_CTX_STATUS_COMPLETED_MASK \
 	 (GEN8_CTX_STATUS_COMPLETE | GEN8_CTX_STATUS_PREEMPTED)
 
-#define CTX_LRI_HEADER_0		0x01
-#define CTX_CONTEXT_CONTROL		0x02
-#define CTX_RING_HEAD			0x04
-#define CTX_RING_TAIL			0x06
-#define CTX_RING_BUFFER_START		0x08
-#define CTX_RING_BUFFER_CONTROL		0x0a
-#define CTX_BB_HEAD_U			0x0c
-#define CTX_BB_HEAD_L			0x0e
-#define CTX_BB_STATE			0x10
-#define CTX_SECOND_BB_HEAD_U		0x12
-#define CTX_SECOND_BB_HEAD_L		0x14
-#define CTX_SECOND_BB_STATE		0x16
-#define CTX_BB_PER_CTX_PTR		0x18
-#define CTX_RCS_INDIRECT_CTX		0x1a
-#define CTX_RCS_INDIRECT_CTX_OFFSET	0x1c
-#define CTX_LRI_HEADER_1		0x21
-#define CTX_CTX_TIMESTAMP		0x22
-#define CTX_PDP3_UDW			0x24
-#define CTX_PDP3_LDW			0x26
-#define CTX_PDP2_UDW			0x28
-#define CTX_PDP2_LDW			0x2a
-#define CTX_PDP1_UDW			0x2c
-#define CTX_PDP1_LDW			0x2e
-#define CTX_PDP0_UDW			0x30
-#define CTX_PDP0_LDW			0x32
-#define CTX_LRI_HEADER_2		0x41
-#define CTX_R_PWR_CLK_STATE		0x42
-#define CTX_GPGPU_CSR_BASE_ADDRESS	0x44
-
-#define CTX_REG(reg_state, pos, reg, val) do { \
-	(reg_state)[(pos)+0] = i915_mmio_reg_offset(reg); \
-	(reg_state)[(pos)+1] = (val); \
-} while (0)
-
-#define ASSIGN_CTX_PDP(ppgtt, reg_state, n) do {		\
-	const u64 _addr = i915_page_dir_dma_addr((ppgtt), (n));	\
-	reg_state[CTX_PDP ## n ## _UDW+1] = upper_32_bits(_addr); \
-	reg_state[CTX_PDP ## n ## _LDW+1] = lower_32_bits(_addr); \
-} while (0)
-
-#define ASSIGN_CTX_PML4(ppgtt, reg_state) do { \
-	reg_state[CTX_PDP0_UDW + 1] = upper_32_bits(px_dma(&ppgtt->pml4)); \
-	reg_state[CTX_PDP0_LDW + 1] = lower_32_bits(px_dma(&ppgtt->pml4)); \
-} while (0)
-
-#define GEN8_CTX_RCS_INDIRECT_CTX_OFFSET_DEFAULT	0x17
-#define GEN9_CTX_RCS_INDIRECT_CTX_OFFSET_DEFAULT	0x26
-#define GEN10_CTX_RCS_INDIRECT_CTX_OFFSET_DEFAULT	0x19
-
 /* Typical size of the average request (2 pipecontrols and a MI_BB) */
 #define EXECLISTS_REQUEST_SIZE 64 /* bytes */
 #define WA_TAIL_DWORDS 2
diff --git a/drivers/gpu/drm/i915/intel_lrc_reg.h b/drivers/gpu/drm/i915/intel_lrc_reg.h
new file mode 100644
index 000000000000..f50d63cb4b66
--- /dev/null
+++ b/drivers/gpu/drm/i915/intel_lrc_reg.h
@@ -0,0 +1,78 @@ 
+/* SPDX-License-Identifier: MIT */
+/*
+ * Copyright © 2018 Intel Corporation
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice (including the next
+ * paragraph) shall be included in all copies or substantial portions of the
+ * Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef _INTEL_LRC_REG_H_
+#define _INTEL_LRC_REG_H_
+
+/* GEN8+ Reg State Context */
+#define CTX_LRI_HEADER_0		0x01
+#define CTX_CONTEXT_CONTROL		0x02
+#define CTX_RING_HEAD			0x04
+#define CTX_RING_TAIL			0x06
+#define CTX_RING_BUFFER_START		0x08
+#define CTX_RING_BUFFER_CONTROL		0x0a
+#define CTX_BB_HEAD_U			0x0c
+#define CTX_BB_HEAD_L			0x0e
+#define CTX_BB_STATE			0x10
+#define CTX_SECOND_BB_HEAD_U		0x12
+#define CTX_SECOND_BB_HEAD_L		0x14
+#define CTX_SECOND_BB_STATE		0x16
+#define CTX_BB_PER_CTX_PTR		0x18
+#define CTX_RCS_INDIRECT_CTX		0x1a
+#define CTX_RCS_INDIRECT_CTX_OFFSET	0x1c
+#define CTX_LRI_HEADER_1		0x21
+#define CTX_CTX_TIMESTAMP		0x22
+#define CTX_PDP3_UDW			0x24
+#define CTX_PDP3_LDW			0x26
+#define CTX_PDP2_UDW			0x28
+#define CTX_PDP2_LDW			0x2a
+#define CTX_PDP1_UDW			0x2c
+#define CTX_PDP1_LDW			0x2e
+#define CTX_PDP0_UDW			0x30
+#define CTX_PDP0_LDW			0x32
+#define CTX_LRI_HEADER_2		0x41
+#define CTX_R_PWR_CLK_STATE		0x42
+#define CTX_GPGPU_CSR_BASE_ADDRESS	0x44
+
+#define CTX_REG(reg_state, pos, reg, val) do { \
+	(reg_state)[(pos)+0] = i915_mmio_reg_offset(reg); \
+	(reg_state)[(pos)+1] = (val); \
+} while (0)
+
+#define ASSIGN_CTX_PDP(ppgtt, reg_state, n) do {		\
+	const u64 _addr = i915_page_dir_dma_addr((ppgtt), (n));	\
+	reg_state[CTX_PDP ## n ## _UDW+1] = upper_32_bits(_addr); \
+	reg_state[CTX_PDP ## n ## _LDW+1] = lower_32_bits(_addr); \
+} while (0)
+
+#define ASSIGN_CTX_PML4(ppgtt, reg_state) do { \
+	reg_state[CTX_PDP0_UDW + 1] = upper_32_bits(px_dma(&ppgtt->pml4)); \
+	reg_state[CTX_PDP0_LDW + 1] = lower_32_bits(px_dma(&ppgtt->pml4)); \
+} while (0)
+
+#define GEN8_CTX_RCS_INDIRECT_CTX_OFFSET_DEFAULT	0x17
+#define GEN9_CTX_RCS_INDIRECT_CTX_OFFSET_DEFAULT	0x26
+#define GEN10_CTX_RCS_INDIRECT_CTX_OFFSET_DEFAULT	0x19
+
+#endif /* _INTEL_LRC_REG_H_ */

Comments

On Mon, Jan 22, 2018 at 12:32:57PM -0800, Michel Thierry wrote:
> Newer platforms may have subtle offset changes, which will increase the
> number of defines, so it is probably better to start moving them to its
> own header file. Also move the macros used while setting the reg state.
> 
> v2: Rename to intel_lrc_reg.h, to be consistent with i915_reg.h and
> intel_guc_reg.h (Chris)
> 
> Signed-off-by: Michel Thierry <michel.thierry@intel.com>
> Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
> Cc: Lucas De Marchi <lucas.demarchi@intel.com>
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> ---

[ ... ]

> diff --git a/drivers/gpu/drm/i915/intel_lrc_reg.h b/drivers/gpu/drm/i915/intel_lrc_reg.h
> new file mode 100644
> index 000000000000..f50d63cb4b66
> --- /dev/null
> +++ b/drivers/gpu/drm/i915/intel_lrc_reg.h
> @@ -0,0 +1,78 @@
> +/* SPDX-License-Identifier: MIT */
> +/*
> + * Copyright © 2018 Intel Corporation
> + *
> + * Permission is hereby granted, free of charge, to any person obtaining a
> + * copy of this software and associated documentation files (the "Software"),
> + * to deal in the Software without restriction, including without limitation
> + * the rights to use, copy, modify, merge, publish, distribute, sublicense,
> + * and/or sell copies of the Software, and to permit persons to whom the
> + * Software is furnished to do so, subject to the following conditions:
> + *
> + * The above copyright notice and this permission notice (including the next
> + * paragraph) shall be included in all copies or substantial portions of the
> + * Software.
> + *
> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
> + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
> + * DEALINGS IN THE SOFTWARE.
> + */

Looking at other files added after the SPDX change, it doesn't look
like we should duplicate the information about license. So in this case
AFAIU it should contain only the SPDX tag and the Copyright, but not
license text. See

git log --grep "Remove redundant license text"


Lucas De Marchi


> +
> +#ifndef _INTEL_LRC_REG_H_
> +#define _INTEL_LRC_REG_H_
> +
> +/* GEN8+ Reg State Context */
> +#define CTX_LRI_HEADER_0		0x01
> +#define CTX_CONTEXT_CONTROL		0x02
> +#define CTX_RING_HEAD			0x04
> +#define CTX_RING_TAIL			0x06
> +#define CTX_RING_BUFFER_START		0x08
> +#define CTX_RING_BUFFER_CONTROL		0x0a
> +#define CTX_BB_HEAD_U			0x0c
> +#define CTX_BB_HEAD_L			0x0e
> +#define CTX_BB_STATE			0x10
> +#define CTX_SECOND_BB_HEAD_U		0x12
> +#define CTX_SECOND_BB_HEAD_L		0x14
> +#define CTX_SECOND_BB_STATE		0x16
> +#define CTX_BB_PER_CTX_PTR		0x18
> +#define CTX_RCS_INDIRECT_CTX		0x1a
> +#define CTX_RCS_INDIRECT_CTX_OFFSET	0x1c
> +#define CTX_LRI_HEADER_1		0x21
> +#define CTX_CTX_TIMESTAMP		0x22
> +#define CTX_PDP3_UDW			0x24
> +#define CTX_PDP3_LDW			0x26
> +#define CTX_PDP2_UDW			0x28
> +#define CTX_PDP2_LDW			0x2a
> +#define CTX_PDP1_UDW			0x2c
> +#define CTX_PDP1_LDW			0x2e
> +#define CTX_PDP0_UDW			0x30
> +#define CTX_PDP0_LDW			0x32
> +#define CTX_LRI_HEADER_2		0x41
> +#define CTX_R_PWR_CLK_STATE		0x42
> +#define CTX_GPGPU_CSR_BASE_ADDRESS	0x44
> +
> +#define CTX_REG(reg_state, pos, reg, val) do { \
> +	(reg_state)[(pos)+0] = i915_mmio_reg_offset(reg); \
> +	(reg_state)[(pos)+1] = (val); \
> +} while (0)
> +
> +#define ASSIGN_CTX_PDP(ppgtt, reg_state, n) do {		\
> +	const u64 _addr = i915_page_dir_dma_addr((ppgtt), (n));	\
> +	reg_state[CTX_PDP ## n ## _UDW+1] = upper_32_bits(_addr); \
> +	reg_state[CTX_PDP ## n ## _LDW+1] = lower_32_bits(_addr); \
> +} while (0)
> +
> +#define ASSIGN_CTX_PML4(ppgtt, reg_state) do { \
> +	reg_state[CTX_PDP0_UDW + 1] = upper_32_bits(px_dma(&ppgtt->pml4)); \
> +	reg_state[CTX_PDP0_LDW + 1] = lower_32_bits(px_dma(&ppgtt->pml4)); \
> +} while (0)
> +
> +#define GEN8_CTX_RCS_INDIRECT_CTX_OFFSET_DEFAULT	0x17
> +#define GEN9_CTX_RCS_INDIRECT_CTX_OFFSET_DEFAULT	0x26
> +#define GEN10_CTX_RCS_INDIRECT_CTX_OFFSET_DEFAULT	0x19
> +
> +#endif /* _INTEL_LRC_REG_H_ */
> -- 
> 2.15.1
>
On Mon, 22 Jan 2018 21:56:36 +0100, Lucas De Marchi  
<lucas.demarchi@intel.com> wrote:

> On Mon, Jan 22, 2018 at 12:32:57PM -0800, Michel Thierry wrote:
>> Newer platforms may have subtle offset changes, which will increase the
>> number of defines, so it is probably better to start moving them to its
>> own header file. Also move the macros used while setting the reg state.
>>
>> v2: Rename to intel_lrc_reg.h, to be consistent with i915_reg.h and
>> intel_guc_reg.h (Chris)
>>
>> Signed-off-by: Michel Thierry <michel.thierry@intel.com>
>> Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
>> Cc: Lucas De Marchi <lucas.demarchi@intel.com>
>> Cc: Chris Wilson <chris@chris-wilson.co.uk>
>> ---
>
> [ ... ]
>
>> diff --git a/drivers/gpu/drm/i915/intel_lrc_reg.h  
>> b/drivers/gpu/drm/i915/intel_lrc_reg.h
>> new file mode 100644
>> index 000000000000..f50d63cb4b66
>> --- /dev/null
>> +++ b/drivers/gpu/drm/i915/intel_lrc_reg.h
>> @@ -0,0 +1,78 @@
>> +/* SPDX-License-Identifier: MIT */
>> +/*
>> + * Copyright © 2018 Intel Corporation
                    ^^^^
hmm, maybe years should be "2014-2018"

>> + *
>> + * Permission is hereby granted, free of charge, to any person  
>> obtaining a
>> + * copy of this software and associated documentation files (the  
>> "Software"),
>> + * to deal in the Software without restriction, including without  
>> limitation
>> + * the rights to use, copy, modify, merge, publish, distribute,  
>> sublicense,
>> + * and/or sell copies of the Software, and to permit persons to whom  
>> the
>> + * Software is furnished to do so, subject to the following conditions:
>> + *
>> + * The above copyright notice and this permission notice (including  
>> the next
>> + * paragraph) shall be included in all copies or substantial portions  
>> of the
>> + * Software.
>> + *
>> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,  
>> EXPRESS OR
>> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF  
>> MERCHANTABILITY,
>> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT  
>> SHALL
>> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES  
>> OR OTHER
>> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,  
>> ARISING
>> + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
>> + * DEALINGS IN THE SOFTWARE.
>> + */
>
> Looking at other files added after the SPDX change, it doesn't look
> like we should duplicate the information about license. So in this case
> AFAIU it should contain only the SPDX tag and the Copyright, but not
> license text. See
>
> git log --grep "Remove redundant license text"
>
>
> Lucas De Marchi
>

and by looking at other examples I think best practice is to put this tag
right under a copyright line:

/*
  * Copyright © 2014-2018 Intel Corporation
  *
  * SPDX-License-Identifier: MIT
  */

Michal
On 22/01/18 13:28, Michal Wajdeczko wrote:
> On Mon, 22 Jan 2018 21:56:36 +0100, Lucas De Marchi 
> <lucas.demarchi@intel.com> wrote:
> 
>> On Mon, Jan 22, 2018 at 12:32:57PM -0800, Michel Thierry wrote:
>>> Newer platforms may have subtle offset changes, which will increase the
>>> number of defines, so it is probably better to start moving them to its
>>> own header file. Also move the macros used while setting the reg state.
>>>
>>> v2: Rename to intel_lrc_reg.h, to be consistent with i915_reg.h and
>>> intel_guc_reg.h (Chris)
>>>
>>> Signed-off-by: Michel Thierry <michel.thierry@intel.com>
>>> Cc: Michal Wajdeczko <michal.wajdeczko@intel.com>
>>> Cc: Lucas De Marchi <lucas.demarchi@intel.com>
>>> Cc: Chris Wilson <chris@chris-wilson.co.uk>
>>> ---
>>
>> [ ... ]
>>
>>> diff --git a/drivers/gpu/drm/i915/intel_lrc_reg.h 
>>> b/drivers/gpu/drm/i915/intel_lrc_reg.h
>>> new file mode 100644
>>> index 000000000000..f50d63cb4b66
>>> --- /dev/null
>>> +++ b/drivers/gpu/drm/i915/intel_lrc_reg.h
>>> @@ -0,0 +1,78 @@
>>> +/* SPDX-License-Identifier: MIT */
>>> +/*
>>> + * Copyright © 2018 Intel Corporation
>                     ^^^^
> hmm, maybe years should be "2014-2018"
> 

2014 because that's when these #define were originally added?

>>> + *
>>> + * Permission is hereby granted, free of charge, to any person 
>>> obtaining a
>>> + * copy of this software and associated documentation files (the 
>>> "Software"),
>>> + * to deal in the Software without restriction, including without 
>>> limitation
>>> + * the rights to use, copy, modify, merge, publish, distribute, 
>>> sublicense,
>>> + * and/or sell copies of the Software, and to permit persons to whom 
>>> the
>>> + * Software is furnished to do so, subject to the following conditions:
>>> + *
>>> + * The above copyright notice and this permission notice (including 
>>> the next
>>> + * paragraph) shall be included in all copies or substantial 
>>> portions of the
>>> + * Software.
>>> + *
>>> + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 
>>> EXPRESS OR
>>> + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 
>>> MERCHANTABILITY,
>>> + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO 
>>> EVENT SHALL
>>> + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES 
>>> OR OTHER
>>> + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 
>>> ARISING
>>> + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
>>> + * DEALINGS IN THE SOFTWARE.
>>> + */
>>
>> Looking at other files added after the SPDX change, it doesn't look
>> like we should duplicate the information about license. So in this case
>> AFAIU it should contain only the SPDX tag and the Copyright, but not
>> license text. See
>>
>> git log --grep "Remove redundant license text"
>>
>>
>> Lucas De Marchi
>>
> 
> and by looking at other examples I think best practice is to put this tag
> right under a copyright line:
> 
> /*
>   * Copyright © 2014-2018 Intel Corporation
>   *
>   * SPDX-License-Identifier: MIT
>   */
> 

Best practice, but not the most common:

$ git grep " \* SPDX-License-Identifier:" |wc -l
94

$ git grep "/\* SPDX-License-Identifier:" |wc -l
7822

Anyway it looks ok to me, objections?
On Mon, Jan 22, 2018 at 01:49:19PM -0800, Michel Thierry wrote:
> > > > diff --git a/drivers/gpu/drm/i915/intel_lrc_reg.h
> > > > b/drivers/gpu/drm/i915/intel_lrc_reg.h
> > > > new file mode 100644
> > > > index 000000000000..f50d63cb4b66
> > > > --- /dev/null
> > > > +++ b/drivers/gpu/drm/i915/intel_lrc_reg.h
> > > > @@ -0,0 +1,78 @@
> > > > +/* SPDX-License-Identifier: MIT */
> > > > +/*
> > > > + * Copyright © 2018 Intel Corporation
> >                     ^^^^
> > hmm, maybe years should be "2014-2018"
> > 
> 
> 2014 because that's when these #define were originally added?

Because that's what is in the copyright line in that file I suppose.

> 
> > > > + *
> > > > + * Permission is hereby granted, free of charge, to any person
> > > > obtaining a
> > > > + * copy of this software and associated documentation files
> > > > (the "Software"),
> > > > + * to deal in the Software without restriction, including
> > > > without limitation
> > > > + * the rights to use, copy, modify, merge, publish, distribute,
> > > > sublicense,
> > > > + * and/or sell copies of the Software, and to permit persons to
> > > > whom the
> > > > + * Software is furnished to do so, subject to the following conditions:
> > > > + *
> > > > + * The above copyright notice and this permission notice
> > > > (including the next
> > > > + * paragraph) shall be included in all copies or substantial
> > > > portions of the
> > > > + * Software.
> > > > + *
> > > > + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
> > > > KIND, EXPRESS OR
> > > > + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
> > > > MERCHANTABILITY,
> > > > + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO
> > > > EVENT SHALL
> > > > + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
> > > > DAMAGES OR OTHER
> > > > + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
> > > > OTHERWISE, ARISING
> > > > + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
> > > > + * DEALINGS IN THE SOFTWARE.
> > > > + */
> > > 
> > > Looking at other files added after the SPDX change, it doesn't look
> > > like we should duplicate the information about license. So in this case
> > > AFAIU it should contain only the SPDX tag and the Copyright, but not
> > > license text. See
> > > 
> > > git log --grep "Remove redundant license text"
> > > 
> > > 
> > > Lucas De Marchi
> > > 
> > 
> > and by looking at other examples I think best practice is to put this tag
> > right under a copyright line:
> > 
> > /*
> >   * Copyright © 2014-2018 Intel Corporation
> >   *
> >   * SPDX-License-Identifier: MIT
> >   */
> > 
> 
> Best practice, but not the most common:
> 
> $ git grep " \* SPDX-License-Identifier:" |wc -l
> 94
> 
> $ git grep "/\* SPDX-License-Identifier:" |wc -l
> 7822
> 
> Anyway it looks ok to me, objections?

I remember Linus stating his preference for `// SPDX ... ' as the first
line. The copyright could then follow the comment format.  Searching now
I found this:

https://lkml.org/lkml/2017/11/2/715

(and see the thread why it was used /* rather than // in headers...
which as been fixed by 5cb0512c02ecd7e6214e912e4c150f4219ac78e0).

So for this file what I understand is that it should be:

	// SPDX-License-Identifier: MIT
	// Copyright (C) 2014-2018 Intel Corporation

Lucas De Marchi


> 
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
On 1/22/2018 4:31 PM, Lucas De Marchi wrote:
> So for this file what I understand is that it should be:
> 
> 	// SPDX-License-Identifier: MIT
> 	// Copyright (C) 2014-2018 Intel Corporation

So be it.
Quoting Michel Thierry (2018-01-23 00:41:07)
> On 1/22/2018 4:31 PM, Lucas De Marchi wrote:
> > So for this file what I understand is that it should be:
> > 
> >       // SPDX-License-Identifier: MIT
> >       // Copyright (C) 2014-2018 Intel Corporation
> 
> So be it.

Oh no, we don't do C++ comments.
-Chris
On Tue, Jan 23, 2018 at 08:48:01AM +0000, Chris Wilson wrote:
> Quoting Michel Thierry (2018-01-23 00:41:07)
> > On 1/22/2018 4:31 PM, Lucas De Marchi wrote:
> > > So for this file what I understand is that it should be:
> > > 
> > >       // SPDX-License-Identifier: MIT
> > >       // Copyright (C) 2014-2018 Intel Corporation
> > 
> > So be it.
> 
> Oh no, we don't do C++ comments.

We drm or we kernel devs?

$ git grep "// SPDX"| wc -l 
4487

The suggestion was actually from Linus in the thread I linked. Quoting
here:

> So in general, the _hope_ is that we can just end up replacing
> existing boilerplate comments with that single line SPDX comment
> (using "//" in *.[ch] files, but obviously some other kinds of files
> end up having a different comment character, typically '#').
...
> And yes, feel free to replace block comments with // while at it.
...
> We already have something like 700 different versions of the same
> silly copyright license boiler-plate due to typos, whitespace
> differences, comment style choices, yadda yadda. Let's avoid that mess
> by just picking _one_ single format and placement for the SPDX line.

Which I agree with, hence my suggestion. Let me know if it should be
different in drm/


Lucas De Marchi
On Tue, 23 Jan 2018 17:06:16 +0100, Lucas De Marchi  
<lucas.demarchi@intel.com> wrote:

> On Tue, Jan 23, 2018 at 08:48:01AM +0000, Chris Wilson wrote:
>> Quoting Michel Thierry (2018-01-23 00:41:07)
>> > On 1/22/2018 4:31 PM, Lucas De Marchi wrote:
>> > > So for this file what I understand is that it should be:
>> > >
>> > >       // SPDX-License-Identifier: MIT
>> > >       // Copyright (C) 2014-2018 Intel Corporation
>> >
>> > So be it.
>>
>> Oh no, we don't do C++ comments.
>
> We drm or we kernel devs?
>
> $ git grep "// SPDX"| wc -l
> 4487
>

But on the other hand:

$ git grep "/* SPDX" | wc -l
14087

> The suggestion was actually from Linus in the thread I linked. Quoting
> here:
>
>> So in general, the _hope_ is that we can just end up replacing
>> existing boilerplate comments with that single line SPDX comment
>> (using "//" in *.[ch] files, but obviously some other kinds of files
>> end up having a different comment character, typically '#').
> ...
>> And yes, feel free to replace block comments with // while at it.
> ...
>> We already have something like 700 different versions of the same
>> silly copyright license boiler-plate due to typos, whitespace
>> differences, comment style choices, yadda yadda. Let's avoid that mess
>> by just picking _one_ single format and placement for the SPDX line.
>
> Which I agree with, hence my suggestion. Let me know if it should be
> different in drm/
>
>
> Lucas De Marchi
> _______________________________________________
> Intel-gfx mailing list
> Intel-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/intel-gfx
On Tue, Jan 23, 2018 at 05:18:36PM +0100, Michal Wajdeczko wrote:
> On Tue, 23 Jan 2018 17:06:16 +0100, Lucas De Marchi
> <lucas.demarchi@intel.com> wrote:
> 
> > On Tue, Jan 23, 2018 at 08:48:01AM +0000, Chris Wilson wrote:
> > > Quoting Michel Thierry (2018-01-23 00:41:07)
> > > > On 1/22/2018 4:31 PM, Lucas De Marchi wrote:
> > > > > So for this file what I understand is that it should be:
> > > > >
> > > > >       // SPDX-License-Identifier: MIT
> > > > >       // Copyright (C) 2014-2018 Intel Corporation
> > > >
> > > > So be it.
> > > 
> > > Oh no, we don't do C++ comments.
> > 
> > We drm or we kernel devs?
> > 
> > $ git grep "// SPDX"| wc -l
> > 4487
> > 
> 
> But on the other hand:
> 
> $ git grep "/* SPDX" | wc -l
> 14087

Yes, because initially during the conversion it was thought // couldn't
be in headers, but in the end it was actually a build system bug.

Lucas De Marchi
Quoting Lucas De Marchi (2018-01-23 16:06:16)
> On Tue, Jan 23, 2018 at 08:48:01AM +0000, Chris Wilson wrote:
> > Quoting Michel Thierry (2018-01-23 00:41:07)
> > > On 1/22/2018 4:31 PM, Lucas De Marchi wrote:
> > > > So for this file what I understand is that it should be:
> > > > 
> > > >       // SPDX-License-Identifier: MIT
> > > >       // Copyright (C) 2014-2018 Intel Corporation
> > > 
> > > So be it.
> > 
> > Oh no, we don't do C++ comments.
> 
> We drm or we kernel devs?
> 
> $ git grep "// SPDX"| wc -l 
> 4487
> 
> The suggestion was actually from Linus in the thread I linked. Quoting
> here:
> 
> > So in general, the _hope_ is that we can just end up replacing
> > existing boilerplate comments with that single line SPDX comment
> > (using "//" in *.[ch] files, but obviously some other kinds of files
> > end up having a different comment character, typically '#').
> ...
> > And yes, feel free to replace block comments with // while at it.
> ...
> > We already have something like 700 different versions of the same
> > silly copyright license boiler-plate due to typos, whitespace
> > differences, comment style choices, yadda yadda. Let's avoid that mess
> > by just picking _one_ single format and placement for the SPDX line.
> 
> Which I agree with, hence my suggestion. Let me know if it should be
> different in drm/

Being consistent is far more important.
Documentation/process/coding-style.rst is what we follow, breaking the
rule and being inconsistent for copyright headers doesn't make any sense.
-Chris
On Tue, 23 Jan 2018, Chris Wilson <chris@chris-wilson.co.uk> wrote:
> Quoting Lucas De Marchi (2018-01-23 16:06:16)
>> On Tue, Jan 23, 2018 at 08:48:01AM +0000, Chris Wilson wrote:
>> > Quoting Michel Thierry (2018-01-23 00:41:07)
>> > > On 1/22/2018 4:31 PM, Lucas De Marchi wrote:
>> > > > So for this file what I understand is that it should be:
>> > > > 
>> > > >       // SPDX-License-Identifier: MIT
>> > > >       // Copyright (C) 2014-2018 Intel Corporation
>> > > 
>> > > So be it.
>> > 
>> > Oh no, we don't do C++ comments.
>> 
>> We drm or we kernel devs?
>> 
>> $ git grep "// SPDX"| wc -l 
>> 4487
>> 
>> The suggestion was actually from Linus in the thread I linked. Quoting
>> here:
>> 
>> > So in general, the _hope_ is that we can just end up replacing
>> > existing boilerplate comments with that single line SPDX comment
>> > (using "//" in *.[ch] files, but obviously some other kinds of files
>> > end up having a different comment character, typically '#').
>> ...
>> > And yes, feel free to replace block comments with // while at it.
>> ...
>> > We already have something like 700 different versions of the same
>> > silly copyright license boiler-plate due to typos, whitespace
>> > differences, comment style choices, yadda yadda. Let's avoid that mess
>> > by just picking _one_ single format and placement for the SPDX line.
>> 
>> Which I agree with, hence my suggestion. Let me know if it should be
>> different in drm/
>
> Being consistent is far more important.
> Documentation/process/coding-style.rst is what we follow, breaking the
> rule and being inconsistent for copyright headers doesn't make any sense.

Please use /* */ rather than // in i915 throughout.

BR,
Jani.