diff mbox

[v3,01/12] linux-generic: internal cache line size

Message ID 20160726025625.7343-2-brian.brooks@linaro.org
State Superseded
Headers show

Commit Message

Brian Brooks July 26, 2016, 2:56 a.m. UTC
Define the ODP API for cache line size to the cache line size defined
in the internal architecture specific directories. Prefix internal
cache line size identifier with '_'.

Signed-off-by: Brian Brooks <brian.brooks@linaro.org>

---
 platform/linux-generic/arch/default/odp/api/cpu_arch.h | 10 +---------
 platform/linux-generic/arch/mips64/odp/api/cpu_arch.h  | 10 ++--------
 platform/linux-generic/arch/powerpc/odp/api/cpu_arch.h | 10 +---------
 platform/linux-generic/arch/x86/odp/api/cpu_arch.h     | 10 +---------
 platform/linux-generic/include/odp/api/align.h         | 12 +++++-------
 5 files changed, 10 insertions(+), 42 deletions(-)

-- 
2.9.0

Comments

Christophe Milard July 26, 2016, 11:49 a.m. UTC | #1
On 26 July 2016 at 04:56, Brian Brooks <brian.brooks@linaro.org> wrote:
> Define the ODP API for cache line size to the cache line size defined

> in the internal architecture specific directories. Prefix internal

> cache line size identifier with '_'.

>

> Signed-off-by: Brian Brooks <brian.brooks@linaro.org>


The commit msg should say prefixed with "_odp" not just "_".
Maybe you can change that when merging, Maxim.
I need that first patch in api-next to submit some first driver interface test.

Reviewed-by: Christophe Milard <christophe.milard@linaro.org>


> ---

>  platform/linux-generic/arch/default/odp/api/cpu_arch.h | 10 +---------

>  platform/linux-generic/arch/mips64/odp/api/cpu_arch.h  | 10 ++--------

>  platform/linux-generic/arch/powerpc/odp/api/cpu_arch.h | 10 +---------

>  platform/linux-generic/arch/x86/odp/api/cpu_arch.h     | 10 +---------

>  platform/linux-generic/include/odp/api/align.h         | 12 +++++-------

>  5 files changed, 10 insertions(+), 42 deletions(-)

>

> diff --git a/platform/linux-generic/arch/default/odp/api/cpu_arch.h b/platform/linux-generic/arch/default/odp/api/cpu_arch.h

> index 29f8889..22b1da2 100644

> --- a/platform/linux-generic/arch/default/odp/api/cpu_arch.h

> +++ b/platform/linux-generic/arch/default/odp/api/cpu_arch.h

> @@ -11,15 +11,7 @@

>  extern "C" {

>  #endif

>

> -/** @ingroup odp_compiler_optim

> - *  @{

> - */

> -

> -#define ODP_CACHE_LINE_SIZE 64

> -

> -/**

> - * @}

> - */

> +#define _ODP_CACHE_LINE_SIZE 64

>

>  static inline void odp_cpu_pause(void)

>  {

> diff --git a/platform/linux-generic/arch/mips64/odp/api/cpu_arch.h b/platform/linux-generic/arch/mips64/odp/api/cpu_arch.h

> index 7b5bfd2..5f4cf39 100644

> --- a/platform/linux-generic/arch/mips64/odp/api/cpu_arch.h

> +++ b/platform/linux-generic/arch/mips64/odp/api/cpu_arch.h

> @@ -11,18 +11,12 @@

>  extern "C" {

>  #endif

>

> -/** @ingroup odp_compiler_optim

> - *  @{

> - */

> -

>  #if defined __OCTEON__

>  #define ODP_CACHE_LINE_SIZE 128

> +#else

> +#error Please add support for your arch in cpu_arch.h

>  #endif

>

> -/**

> - * @}

> - */

> -

>  static inline void odp_cpu_pause(void)

>  {

>         __asm__ __volatile__ ("nop");

> diff --git a/platform/linux-generic/arch/powerpc/odp/api/cpu_arch.h b/platform/linux-generic/arch/powerpc/odp/api/cpu_arch.h

> index 29f8889..22b1da2 100644

> --- a/platform/linux-generic/arch/powerpc/odp/api/cpu_arch.h

> +++ b/platform/linux-generic/arch/powerpc/odp/api/cpu_arch.h

> @@ -11,15 +11,7 @@

>  extern "C" {

>  #endif

>

> -/** @ingroup odp_compiler_optim

> - *  @{

> - */

> -

> -#define ODP_CACHE_LINE_SIZE 64

> -

> -/**

> - * @}

> - */

> +#define _ODP_CACHE_LINE_SIZE 64

>

>  static inline void odp_cpu_pause(void)

>  {

> diff --git a/platform/linux-generic/arch/x86/odp/api/cpu_arch.h b/platform/linux-generic/arch/x86/odp/api/cpu_arch.h

> index 3a16fa6..44e6b30 100644

> --- a/platform/linux-generic/arch/x86/odp/api/cpu_arch.h

> +++ b/platform/linux-generic/arch/x86/odp/api/cpu_arch.h

> @@ -11,15 +11,7 @@

>  extern "C" {

>  #endif

>

> -/** @ingroup odp_compiler_optim

> - *  @{

> - */

> -

> -#define ODP_CACHE_LINE_SIZE 64

> -

> -/**

> - * @}

> - */

> +#define _ODP_CACHE_LINE_SIZE 64

>

>  static inline void odp_cpu_pause(void)

>  {

> diff --git a/platform/linux-generic/include/odp/api/align.h b/platform/linux-generic/include/odp/api/align.h

> index d8bc653..df9a3c1 100644

> --- a/platform/linux-generic/include/odp/api/align.h

> +++ b/platform/linux-generic/include/odp/api/align.h

> @@ -17,6 +17,8 @@

>  extern "C" {

>  #endif

>

> +#include <odp/api/cpu_arch.h>

> +

>  /** @ingroup odp_compiler_optim

>   *  @{

>   */

> @@ -31,16 +33,12 @@ extern "C" {

>

>  #define ODP_FIELD_SIZEOF(type, member) sizeof(((type *)0)->member)

>

> -#if defined __arm__ || defined __aarch64__

> -

> -#define ODP_CACHE_LINE_SIZE 64

> -

> -#endif

> -

>  #else

>  #error Non-gcc compatible compiler

>  #endif

>

> +#define ODP_CACHE_LINE_SIZE _ODP_CACHE_LINE_SIZE

> +

>  #define ODP_PAGE_SIZE       4096

>

>  #define ODP_ALIGNED_CACHE   ODP_ALIGNED(ODP_CACHE_LINE_SIZE)

> @@ -52,7 +50,7 @@ extern "C" {

>   */

>

>  #include <odp/api/spec/align.h>

> -#include <odp/api/cpu_arch.h>

> +

>

>  #ifdef __cplusplus

>  }

> --

> 2.9.0

>
Maxim Uvarov July 26, 2016, 2:39 p.m. UTC | #2
On 07/26/16 05:56, Brian Brooks wrote:
> Define the ODP API for cache line size to the cache line size defined

> in the internal architecture specific directories. Prefix internal

> cache line size identifier with '_'.

>

> Signed-off-by: Brian Brooks <brian.brooks@linaro.org>

> ---

>   platform/linux-generic/arch/default/odp/api/cpu_arch.h | 10 +---------

>   platform/linux-generic/arch/mips64/odp/api/cpu_arch.h  | 10 ++--------

>   platform/linux-generic/arch/powerpc/odp/api/cpu_arch.h | 10 +---------

>   platform/linux-generic/arch/x86/odp/api/cpu_arch.h     | 10 +---------

>   platform/linux-generic/include/odp/api/align.h         | 12 +++++-------

>   5 files changed, 10 insertions(+), 42 deletions(-)


comments bellow...

> diff --git a/platform/linux-generic/arch/default/odp/api/cpu_arch.h b/platform/linux-generic/arch/default/odp/api/cpu_arch.h

> index 29f8889..22b1da2 100644

> --- a/platform/linux-generic/arch/default/odp/api/cpu_arch.h

> +++ b/platform/linux-generic/arch/default/odp/api/cpu_arch.h

> @@ -11,15 +11,7 @@

>   extern "C" {

>   #endif

>   

> -/** @ingroup odp_compiler_optim

> - *  @{

> - */

> -

> -#define ODP_CACHE_LINE_SIZE 64

> -

> -/**

> - * @}

> - */

> +#define _ODP_CACHE_LINE_SIZE 64

>   

>   static inline void odp_cpu_pause(void)

>   {

> diff --git a/platform/linux-generic/arch/mips64/odp/api/cpu_arch.h b/platform/linux-generic/arch/mips64/odp/api/cpu_arch.h

> index 7b5bfd2..5f4cf39 100644

> --- a/platform/linux-generic/arch/mips64/odp/api/cpu_arch.h

> +++ b/platform/linux-generic/arch/mips64/odp/api/cpu_arch.h

> @@ -11,18 +11,12 @@

>   extern "C" {

>   #endif

>   

> -/** @ingroup odp_compiler_optim

> - *  @{

> - */

> -

>   #if defined __OCTEON__

>   #define ODP_CACHE_LINE_SIZE 128


prefix missing


> +#else

> +#error Please add support for your arch in cpu_arch.h

>   #endif

>   

> -/**

> - * @}

> - */

> -

>   static inline void odp_cpu_pause(void)

>   {

>   	__asm__ __volatile__ ("nop");

> diff --git a/platform/linux-generic/arch/powerpc/odp/api/cpu_arch.h b/platform/linux-generic/arch/powerpc/odp/api/cpu_arch.h

> index 29f8889..22b1da2 100644

> --- a/platform/linux-generic/arch/powerpc/odp/api/cpu_arch.h

> +++ b/platform/linux-generic/arch/powerpc/odp/api/cpu_arch.h

> @@ -11,15 +11,7 @@

>   extern "C" {

>   #endif

>   

> -/** @ingroup odp_compiler_optim

> - *  @{

> - */

> -

> -#define ODP_CACHE_LINE_SIZE 64

> -

> -/**

> - * @}

> - */

> +#define _ODP_CACHE_LINE_SIZE 64

>   

>   static inline void odp_cpu_pause(void)

>   {

> diff --git a/platform/linux-generic/arch/x86/odp/api/cpu_arch.h b/platform/linux-generic/arch/x86/odp/api/cpu_arch.h

> index 3a16fa6..44e6b30 100644

> --- a/platform/linux-generic/arch/x86/odp/api/cpu_arch.h

> +++ b/platform/linux-generic/arch/x86/odp/api/cpu_arch.h

> @@ -11,15 +11,7 @@

>   extern "C" {

>   #endif

>   

> -/** @ingroup odp_compiler_optim

> - *  @{

> - */

> -

> -#define ODP_CACHE_LINE_SIZE 64

> -

> -/**

> - * @}

> - */

> +#define _ODP_CACHE_LINE_SIZE 64

>   

>   static inline void odp_cpu_pause(void)

>   {

> diff --git a/platform/linux-generic/include/odp/api/align.h b/platform/linux-generic/include/odp/api/align.h

> index d8bc653..df9a3c1 100644

> --- a/platform/linux-generic/include/odp/api/align.h

> +++ b/platform/linux-generic/include/odp/api/align.h

> @@ -17,6 +17,8 @@

>   extern "C" {

>   #endif

>   

> +#include <odp/api/cpu_arch.h>

> +

>   /** @ingroup odp_compiler_optim

>    *  @{

>    */

> @@ -31,16 +33,12 @@ extern "C" {

>   

>   #define ODP_FIELD_SIZEOF(type, member) sizeof(((type *)0)->member)

>   

> -#if defined __arm__ || defined __aarch64__

> -

> -#define ODP_CACHE_LINE_SIZE 64

> -

> -#endif

> -

>   #else

>   #error Non-gcc compatible compiler

>   #endif

>   

> +#define ODP_CACHE_LINE_SIZE _ODP_CACHE_LINE_SIZE

> +

>   #define ODP_PAGE_SIZE       4096

>   

>   #define ODP_ALIGNED_CACHE   ODP_ALIGNED(ODP_CACHE_LINE_SIZE)

> @@ -52,7 +50,7 @@ extern "C" {

>    */

>   

>   #include <odp/api/spec/align.h>

> -#include <odp/api/cpu_arch.h>

> +

>   

>   #ifdef __cplusplus

>   }

did you test arm case? it's not clear where _ODP_C_L_S is declared for arm.

Maxim.
Brian Brooks July 26, 2016, 4:35 p.m. UTC | #3
On 07/26 17:39:31, Maxim Uvarov wrote:
> On 07/26/16 05:56, Brian Brooks wrote:

> >   #if defined __OCTEON__

> >   #define ODP_CACHE_LINE_SIZE 128

> 

> prefix missing


thanks for catching this. changed in v4

> > -#if defined __arm__ || defined __aarch64__

> > -

> > -#define ODP_CACHE_LINE_SIZE 64

> > -

> > -#endif

> > -

> >   #else

> >   #error Non-gcc compatible compiler

> >   #endif

> > +#define ODP_CACHE_LINE_SIZE _ODP_CACHE_LINE_SIZE

> > +

> >   #define ODP_PAGE_SIZE       4096

> >   #define ODP_ALIGNED_CACHE   ODP_ALIGNED(ODP_CACHE_LINE_SIZE)

> > @@ -52,7 +50,7 @@ extern "C" {

> >    */

> >   #include <odp/api/spec/align.h>

> > -#include <odp/api/cpu_arch.h>

> > +

> >   #ifdef __cplusplus

> >   }

> did you test arm case? it's not clear where _ODP_C_L_S is declared for arm.


arm's cpu_arch.h is a symlink to default's cpu_arch.h where it is defined.

The reason this worked before is because you can #define the same thing
twice as long as both expand to the same value.
Brian Brooks July 26, 2016, 4:36 p.m. UTC | #4
On 07/26 13:49:15, Christophe Milard wrote:
> On 26 July 2016 at 04:56, Brian Brooks <brian.brooks@linaro.org> wrote:

> > Define the ODP API for cache line size to the cache line size defined

> > in the internal architecture specific directories. Prefix internal

> > cache line size identifier with '_'.

> >

> > Signed-off-by: Brian Brooks <brian.brooks@linaro.org>

> 

> The commit msg should say prefixed with "_odp" not just "_".


Changed in v4.

> Maybe you can change that when merging, Maxim.

> I need that first patch in api-next to submit some first driver interface test.

> 

> Reviewed-by: Christophe Milard <christophe.milard@linaro.org>
diff mbox

Patch

diff --git a/platform/linux-generic/arch/default/odp/api/cpu_arch.h b/platform/linux-generic/arch/default/odp/api/cpu_arch.h
index 29f8889..22b1da2 100644
--- a/platform/linux-generic/arch/default/odp/api/cpu_arch.h
+++ b/platform/linux-generic/arch/default/odp/api/cpu_arch.h
@@ -11,15 +11,7 @@ 
 extern "C" {
 #endif
 
-/** @ingroup odp_compiler_optim
- *  @{
- */
-
-#define ODP_CACHE_LINE_SIZE 64
-
-/**
- * @}
- */
+#define _ODP_CACHE_LINE_SIZE 64
 
 static inline void odp_cpu_pause(void)
 {
diff --git a/platform/linux-generic/arch/mips64/odp/api/cpu_arch.h b/platform/linux-generic/arch/mips64/odp/api/cpu_arch.h
index 7b5bfd2..5f4cf39 100644
--- a/platform/linux-generic/arch/mips64/odp/api/cpu_arch.h
+++ b/platform/linux-generic/arch/mips64/odp/api/cpu_arch.h
@@ -11,18 +11,12 @@ 
 extern "C" {
 #endif
 
-/** @ingroup odp_compiler_optim
- *  @{
- */
-
 #if defined __OCTEON__
 #define ODP_CACHE_LINE_SIZE 128
+#else
+#error Please add support for your arch in cpu_arch.h
 #endif
 
-/**
- * @}
- */
-
 static inline void odp_cpu_pause(void)
 {
 	__asm__ __volatile__ ("nop");
diff --git a/platform/linux-generic/arch/powerpc/odp/api/cpu_arch.h b/platform/linux-generic/arch/powerpc/odp/api/cpu_arch.h
index 29f8889..22b1da2 100644
--- a/platform/linux-generic/arch/powerpc/odp/api/cpu_arch.h
+++ b/platform/linux-generic/arch/powerpc/odp/api/cpu_arch.h
@@ -11,15 +11,7 @@ 
 extern "C" {
 #endif
 
-/** @ingroup odp_compiler_optim
- *  @{
- */
-
-#define ODP_CACHE_LINE_SIZE 64
-
-/**
- * @}
- */
+#define _ODP_CACHE_LINE_SIZE 64
 
 static inline void odp_cpu_pause(void)
 {
diff --git a/platform/linux-generic/arch/x86/odp/api/cpu_arch.h b/platform/linux-generic/arch/x86/odp/api/cpu_arch.h
index 3a16fa6..44e6b30 100644
--- a/platform/linux-generic/arch/x86/odp/api/cpu_arch.h
+++ b/platform/linux-generic/arch/x86/odp/api/cpu_arch.h
@@ -11,15 +11,7 @@ 
 extern "C" {
 #endif
 
-/** @ingroup odp_compiler_optim
- *  @{
- */
-
-#define ODP_CACHE_LINE_SIZE 64
-
-/**
- * @}
- */
+#define _ODP_CACHE_LINE_SIZE 64
 
 static inline void odp_cpu_pause(void)
 {
diff --git a/platform/linux-generic/include/odp/api/align.h b/platform/linux-generic/include/odp/api/align.h
index d8bc653..df9a3c1 100644
--- a/platform/linux-generic/include/odp/api/align.h
+++ b/platform/linux-generic/include/odp/api/align.h
@@ -17,6 +17,8 @@ 
 extern "C" {
 #endif
 
+#include <odp/api/cpu_arch.h>
+
 /** @ingroup odp_compiler_optim
  *  @{
  */
@@ -31,16 +33,12 @@  extern "C" {
 
 #define ODP_FIELD_SIZEOF(type, member) sizeof(((type *)0)->member)
 
-#if defined __arm__ || defined __aarch64__
-
-#define ODP_CACHE_LINE_SIZE 64
-
-#endif
-
 #else
 #error Non-gcc compatible compiler
 #endif
 
+#define ODP_CACHE_LINE_SIZE _ODP_CACHE_LINE_SIZE
+
 #define ODP_PAGE_SIZE       4096
 
 #define ODP_ALIGNED_CACHE   ODP_ALIGNED(ODP_CACHE_LINE_SIZE)
@@ -52,7 +50,7 @@  extern "C" {
  */
 
 #include <odp/api/spec/align.h>
-#include <odp/api/cpu_arch.h>
+
 
 #ifdef __cplusplus
 }