[dpdk-dev,09/12] Remove iopl operation for IBM Power architecture

Message ID 1411724186-8036-10-git-send-email-bjzhuc@cn.ibm.com (mailing list archive)
State Superseded, archived
Headers

Commit Message

Chao Zhu Sept. 26, 2014, 9:36 a.m. UTC
  iopl() call is mostly for the i386 architecture. In Power architecture.
It doesn't exist. This patch modified rte_eal_iopl_init() and make it
return -1 on Power. This means rte_config.flags will not contain
EAL_FLG_HIGH_IOPL flag on IBM Power architecture.

Signed-off-by: Chao Zhu <bjzhuc@cn.ibm.com>
---
 lib/librte_eal/linuxapp/eal/eal.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
  

Comments

Cyril Chemparathy Oct. 6, 2014, 10:03 p.m. UTC | #1
On 9/26/2014 2:36 AM, Chao Zhu wrote:
> iopl() call is mostly for the i386 architecture. In Power architecture.
> It doesn't exist. This patch modified rte_eal_iopl_init() and make it
> return -1 on Power. This means rte_config.flags will not contain
> EAL_FLG_HIGH_IOPL flag on IBM Power architecture.

Since iopl() is an x86-only thing, shouldn't the code be conditional on 
defined(RTE_ARCH_X86_64) || defined(RTE_ARCH_I686) instead of below?

Better still, should we maybe break out an architecture specific init 
function?  This function could set iopl on x86, and possibly do other 
lowlevel init things on other architectures...

> Signed-off-by: Chao Zhu <bjzhuc@cn.ibm.com>
> ---
>   lib/librte_eal/linuxapp/eal/eal.c |   11 +++++++++++
>   1 files changed, 11 insertions(+), 0 deletions(-)
>
> diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c
> index 4869e7c..8cc1f21 100644
> --- a/lib/librte_eal/linuxapp/eal/eal.c
> +++ b/lib/librte_eal/linuxapp/eal/eal.c
> @@ -50,7 +50,10 @@
>   #include <errno.h>
>   #include <sys/mman.h>
>   #include <sys/queue.h>
> +/* Power architecture doesn't have this header file */
> +#ifndef RTE_ARCH_PPC_64
>   #include <sys/io.h>
> +#endif
>   
>   #include <rte_common.h>
>   #include <rte_debug.h>
> @@ -1019,11 +1022,19 @@ rte_eal_mcfg_complete(void)
>   
>   /*
>    * Request iopl privilege for all RPL, returns 0 on success
> + *
> + * Power architecture doesn't have iopl function, so this function
> + * return -1 on Power architecture, because this function is only used
> + * in rte_eal_init to add EAL_FLG_HIGH_IOPL to rte_config.flags.
>    */
>   static int
>   rte_eal_iopl_init(void)
>   {
> +#ifndef RTE_ARCH_PPC_64
>   	return iopl(HIGHEST_RPL);
> +#else
> +	return -1;
> +#endif
>   }
>   
>   /* Launch threads, called at application init(). */
  
Ananyev, Konstantin Oct. 7, 2014, 2:46 p.m. UTC | #2
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Cyril Chemparathy
> Sent: Monday, October 06, 2014 11:04 PM
> To: Chao Zhu; dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH 09/12] Remove iopl operation for IBM Power architecture
> 
> On 9/26/2014 2:36 AM, Chao Zhu wrote:
> > iopl() call is mostly for the i386 architecture. In Power architecture.
> > It doesn't exist. This patch modified rte_eal_iopl_init() and make it
> > return -1 on Power. This means rte_config.flags will not contain
> > EAL_FLG_HIGH_IOPL flag on IBM Power architecture.
> 
> Since iopl() is an x86-only thing, shouldn't the code be conditional on
> defined(RTE_ARCH_X86_64) || defined(RTE_ARCH_I686) instead of below?
> 
> Better still, should we maybe break out an architecture specific init
> function?  This function could set iopl on x86, and possibly do other
> lowlevel init things on other architectures...

Yep, that sounds like a good way to me too. 

> 
> > Signed-off-by: Chao Zhu <bjzhuc@cn.ibm.com>
> > ---
> >   lib/librte_eal/linuxapp/eal/eal.c |   11 +++++++++++
> >   1 files changed, 11 insertions(+), 0 deletions(-)
> >
> > diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c
> > index 4869e7c..8cc1f21 100644
> > --- a/lib/librte_eal/linuxapp/eal/eal.c
> > +++ b/lib/librte_eal/linuxapp/eal/eal.c
> > @@ -50,7 +50,10 @@
> >   #include <errno.h>
> >   #include <sys/mman.h>
> >   #include <sys/queue.h>
> > +/* Power architecture doesn't have this header file */
> > +#ifndef RTE_ARCH_PPC_64
> >   #include <sys/io.h>
> > +#endif
> >
> >   #include <rte_common.h>
> >   #include <rte_debug.h>
> > @@ -1019,11 +1022,19 @@ rte_eal_mcfg_complete(void)
> >
> >   /*
> >    * Request iopl privilege for all RPL, returns 0 on success
> > + *
> > + * Power architecture doesn't have iopl function, so this function
> > + * return -1 on Power architecture, because this function is only used
> > + * in rte_eal_init to add EAL_FLG_HIGH_IOPL to rte_config.flags.
> >    */
> >   static int
> >   rte_eal_iopl_init(void)
> >   {
> > +#ifndef RTE_ARCH_PPC_64
> >   	return iopl(HIGHEST_RPL);
> > +#else
> > +	return -1;
> > +#endif
> >   }
> >
> >   /* Launch threads, called at application init(). */
  
Chao Zhu Oct. 13, 2014, 2:33 a.m. UTC | #3
OK. I'll update the patches.
Thanks for your comments!

Best Regards!
------------------------------
Chao Zhu 




From:   "Ananyev, Konstantin" <konstantin.ananyev@intel.com>
To:     Cyril Chemparathy <cchemparathy@tilera.com>, Chao CH 
Zhu/China/IBM@IBMCN, "dev@dpdk.org" <dev@dpdk.org>
Date:   2014/10/07 22:45
Subject:        RE: [dpdk-dev] [PATCH 09/12] Remove iopl operation for IBM 
Power architecture



> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Cyril Chemparathy
> Sent: Monday, October 06, 2014 11:04 PM
> To: Chao Zhu; dev@dpdk.org
> Subject: Re: [dpdk-dev] [PATCH 09/12] Remove iopl operation for IBM 
Power architecture
> 
> On 9/26/2014 2:36 AM, Chao Zhu wrote:
> > iopl() call is mostly for the i386 architecture. In Power 
architecture.
> > It doesn't exist. This patch modified rte_eal_iopl_init() and make it
> > return -1 on Power. This means rte_config.flags will not contain
> > EAL_FLG_HIGH_IOPL flag on IBM Power architecture.
> 
> Since iopl() is an x86-only thing, shouldn't the code be conditional on
> defined(RTE_ARCH_X86_64) || defined(RTE_ARCH_I686) instead of below?
> 
> Better still, should we maybe break out an architecture specific init
> function?  This function could set iopl on x86, and possibly do other
> lowlevel init things on other architectures...

Yep, that sounds like a good way to me too. 

> 
> > Signed-off-by: Chao Zhu <bjzhuc@cn.ibm.com>
> > ---
> >   lib/librte_eal/linuxapp/eal/eal.c |   11 +++++++++++
> >   1 files changed, 11 insertions(+), 0 deletions(-)
> >
> > diff --git a/lib/librte_eal/linuxapp/eal/eal.c 
b/lib/librte_eal/linuxapp/eal/eal.c
> > index 4869e7c..8cc1f21 100644
> > --- a/lib/librte_eal/linuxapp/eal/eal.c
> > +++ b/lib/librte_eal/linuxapp/eal/eal.c
> > @@ -50,7 +50,10 @@
> >   #include <errno.h>
> >   #include <sys/mman.h>
> >   #include <sys/queue.h>
> > +/* Power architecture doesn't have this header file */
> > +#ifndef RTE_ARCH_PPC_64
> >   #include <sys/io.h>
> > +#endif
> >
> >   #include <rte_common.h>
> >   #include <rte_debug.h>
> > @@ -1019,11 +1022,19 @@ rte_eal_mcfg_complete(void)
> >
> >   /*
> >    * Request iopl privilege for all RPL, returns 0 on success
> > + *
> > + * Power architecture doesn't have iopl function, so this function
> > + * return -1 on Power architecture, because this function is only 
used
> > + * in rte_eal_init to add EAL_FLG_HIGH_IOPL to rte_config.flags.
> >    */
> >   static int
> >   rte_eal_iopl_init(void)
> >   {
> > +#ifndef RTE_ARCH_PPC_64
> >              return iopl(HIGHEST_RPL);
> > +#else
> > +            return -1;
> > +#endif
> >   }
> >
> >   /* Launch threads, called at application init(). */
  

Patch

diff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c
index 4869e7c..8cc1f21 100644
--- a/lib/librte_eal/linuxapp/eal/eal.c
+++ b/lib/librte_eal/linuxapp/eal/eal.c
@@ -50,7 +50,10 @@ 
 #include <errno.h>
 #include <sys/mman.h>
 #include <sys/queue.h>
+/* Power architecture doesn't have this header file */
+#ifndef RTE_ARCH_PPC_64
 #include <sys/io.h>
+#endif
 
 #include <rte_common.h>
 #include <rte_debug.h>
@@ -1019,11 +1022,19 @@  rte_eal_mcfg_complete(void)
 
 /*
  * Request iopl privilege for all RPL, returns 0 on success
+ *
+ * Power architecture doesn't have iopl function, so this function
+ * return -1 on Power architecture, because this function is only used
+ * in rte_eal_init to add EAL_FLG_HIGH_IOPL to rte_config.flags.
  */
 static int
 rte_eal_iopl_init(void)
 {
+#ifndef RTE_ARCH_PPC_64
 	return iopl(HIGHEST_RPL);
+#else
+	return -1;
+#endif
 }
 
 /* Launch threads, called at application init(). */