Re: [PATCH net-next] ibmvnic: Use list_for_each_entry() to simplify code in ibmvnic.c

2021-06-10 Thread Lijun Pan
On Thu, Jun 10, 2021 at 7:56 AM Wang Hai  wrote:
>
> Convert list_for_each() to list_for_each_entry() where
> applicable. This simplifies the code.
>
> Reported-by: Hulk Robot 
> Signed-off-by: Wang Hai 
> ---

Acked-by: Lijun Pan 


Re: [PATCH net-next] ibmveth: fix kobj_to_dev.cocci warnings

2021-05-18 Thread Lijun Pan



> On May 18, 2021, at 9:28 PM, YueHaibing  wrote:
> 
> Use kobj_to_dev() instead of container_of()
> 
> Generated by: scripts/coccinelle/api/kobj_to_dev.cocci
> 
> Signed-off-by: YueHaibing 
> ---

Acked-by: Lijun Pan 


> drivers/net/ethernet/ibm/ibmveth.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/ibm/ibmveth.c 
> b/drivers/net/ethernet/ibm/ibmveth.c
> index 7fea9ae60f13..bc67a7ee872b 100644
> --- a/drivers/net/ethernet/ibm/ibmveth.c
> +++ b/drivers/net/ethernet/ibm/ibmveth.c
> @@ -1799,8 +1799,7 @@ static ssize_t veth_pool_store(struct kobject *kobj, 
> struct attribute *attr,
>   struct ibmveth_buff_pool *pool = container_of(kobj,
> struct ibmveth_buff_pool,
> kobj);
> - struct net_device *netdev = dev_get_drvdata(
> - container_of(kobj->parent, struct device, kobj));
> + struct net_device *netdev = dev_get_drvdata(kobj_to_dev(kobj->parent));
>   struct ibmveth_adapter *adapter = netdev_priv(netdev);
>   long value = simple_strtol(buf, NULL, 10);
>   long rc;
> -- 
> 2.17.1
> 



Re: [PATCH net v3] ibmvnic: Continue with reset if set link down failed

2021-05-07 Thread Lijun Pan
On Tue, May 4, 2021 at 3:24 PM Dany Madden  wrote:
>
> On 2021-05-04 12:31, Lijun Pan wrote:
> > On Tue, May 4, 2021 at 2:27 PM Lijun Pan  wrote:
> >>
> >> On Tue, May 4, 2021 at 2:14 PM Dany Madden  wrote:
> >> >
> >> > When ibmvnic gets a FATAL error message from the vnicserver, it marks
> >> > the Command Respond Queue (CRQ) inactive and resets the adapter. If this
> >> > FATAL reset fails and a transmission timeout reset follows, the CRQ is
> >> > still inactive, ibmvnic's attempt to set link down will also fail. If
> >> > ibmvnic abandons the reset because of this failed set link down and this
> >> > is the last reset in the workqueue, then this adapter will be left in an
> >> > inoperable state.
> >> >
> >> > Instead, make the driver ignore this link down failure and continue to
> >> > free and re-register CRQ so that the adapter has an opportunity to
> >> > recover.
> >> >
> >> > Fixes: ed651a10875f ("ibmvnic: Updated reset handling")
> >> > Signed-off-by: Dany Madden 
> >> > Reviewed-by: Rick Lindsley 
> >> > Reviewed-by: Sukadev Bhattiprolu 
> >> > ---
> >> > Changes in V2:
> >> > - Update description to clarify background for the patch
> >> > - Include Reviewed-by tags
> >> > Changes in V3:
> >> > - Add comment above the code change
> >> > ---
> >> >  drivers/net/ethernet/ibm/ibmvnic.c | 11 +--
> >> >  1 file changed, 9 insertions(+), 2 deletions(-)
> >> >
> >> > diff --git a/drivers/net/ethernet/ibm/ibmvnic.c 
> >> > b/drivers/net/ethernet/ibm/ibmvnic.c
> >> > index 5788bb956d73..9e005a08d43b 100644
> >> > --- a/drivers/net/ethernet/ibm/ibmvnic.c
> >> > +++ b/drivers/net/ethernet/ibm/ibmvnic.c
> >> > @@ -2017,8 +2017,15 @@ static int do_reset(struct ibmvnic_adapter 
> >> > *adapter,
> >> > rtnl_unlock();
> >> > rc = set_link_state(adapter, 
> >> > IBMVNIC_LOGICAL_LNK_DN);
> >> > rtnl_lock();
> >> > -   if (rc)
> >> > -   goto out;
> >> > +
> >> > +   /* Attempted to set the link down. It could fail 
> >> > if the
> >> > +* vnicserver has already torn down the CRQ. We 
> >> > will
> >> > +* note it and continue with reset to reinit the 
> >> > CRQ.
> >> > +*/
> >> > +   if (rc) {
> >> > +   netdev_dbg(netdev,
> >> > +  "Setting link down failed 
> >> > rc=%d. Continue anyway\n", rc);
> >> > +   }
> >>
> >> There are other places which check and rely on the return value of
> >> this function. Your change makes that inconsistent. Can you stop
> >
> > To be more specific, __ibmvnic_close, __ibmvnic_open both call this
> > set_link_state.
> Inconsistent would have been not checking for the rc at all. Here we
> checked and noted it that there are times that it's ok to continue.
>
> >
> >> posting new versions and soliciting the maintainer to accept it before
> >> there is material change? There are many ways to make reset
> >> successful. I think this is the worst approach of all.
>
> Can you show me a patch that is better than this one, that has gone thru
> a 30+ hours of testing?

The patch review convention is: community review the patch, and the
patch author modifies the patch and resend. We are talking about the
patch itself, you came up with something about testing. You do not
take the reviewer's opinions but ask the reviewer to write a patch,
which is a little bit odd.


Re: [PATCH v2 net-next resend] ibmvnic: remove default label from to_string switch

2021-05-04 Thread Lijun Pan
On Tue, May 4, 2021 at 2:19 PM Michal Suchanek  wrote:
>
> This way the compiler warns when a new value is added to the enum but
> not to the string translation like:
>
> drivers/net/ethernet/ibm/ibmvnic.c: In function 'adapter_state_to_string':
> drivers/net/ethernet/ibm/ibmvnic.c:832:2: warning: enumeration value 
> 'VNIC_FOOBAR' not handled in switch [-Wswitch]
>   switch (state) {
>   ^~
> drivers/net/ethernet/ibm/ibmvnic.c: In function 'reset_reason_to_string':
> drivers/net/ethernet/ibm/ibmvnic.c:1935:2: warning: enumeration value 
> 'VNIC_RESET_FOOBAR' not handled in switch [-Wswitch]
>   switch (reason) {
>   ^~
>
> Signed-off-by: Michal Suchanek 
> Acked-by: Lijun Pan 
> ---
> v2: Fix typo in commit message
> ---

Hi Michal,

Thank you for reposting the patch and including the Ack-by tag. I
think you need to wait till next Tuesday or so when net-next reopens,
then you can repost the patch.
http://vger.kernel.org/~davem/net-next.html.

Thanks,
Lijun


Re: [PATCH net v3] ibmvnic: Continue with reset if set link down failed

2021-05-04 Thread Lijun Pan
On Tue, May 4, 2021 at 2:27 PM Lijun Pan  wrote:
>
> On Tue, May 4, 2021 at 2:14 PM Dany Madden  wrote:
> >
> > When ibmvnic gets a FATAL error message from the vnicserver, it marks
> > the Command Respond Queue (CRQ) inactive and resets the adapter. If this
> > FATAL reset fails and a transmission timeout reset follows, the CRQ is
> > still inactive, ibmvnic's attempt to set link down will also fail. If
> > ibmvnic abandons the reset because of this failed set link down and this
> > is the last reset in the workqueue, then this adapter will be left in an
> > inoperable state.
> >
> > Instead, make the driver ignore this link down failure and continue to
> > free and re-register CRQ so that the adapter has an opportunity to
> > recover.
> >
> > Fixes: ed651a10875f ("ibmvnic: Updated reset handling")
> > Signed-off-by: Dany Madden 
> > Reviewed-by: Rick Lindsley 
> > Reviewed-by: Sukadev Bhattiprolu 
> > ---
> > Changes in V2:
> > - Update description to clarify background for the patch
> > - Include Reviewed-by tags
> > Changes in V3:
> > - Add comment above the code change
> > ---
> >  drivers/net/ethernet/ibm/ibmvnic.c | 11 +--
> >  1 file changed, 9 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/net/ethernet/ibm/ibmvnic.c 
> > b/drivers/net/ethernet/ibm/ibmvnic.c
> > index 5788bb956d73..9e005a08d43b 100644
> > --- a/drivers/net/ethernet/ibm/ibmvnic.c
> > +++ b/drivers/net/ethernet/ibm/ibmvnic.c
> > @@ -2017,8 +2017,15 @@ static int do_reset(struct ibmvnic_adapter *adapter,
> > rtnl_unlock();
> > rc = set_link_state(adapter, 
> > IBMVNIC_LOGICAL_LNK_DN);
> > rtnl_lock();
> > -   if (rc)
> > -   goto out;
> > +
> > +   /* Attempted to set the link down. It could fail if 
> > the
> > +* vnicserver has already torn down the CRQ. We will
> > +* note it and continue with reset to reinit the 
> > CRQ.
> > +*/
> > +   if (rc) {
> > +   netdev_dbg(netdev,
> > +  "Setting link down failed rc=%d. 
> > Continue anyway\n", rc);
> > +   }
>
> There are other places which check and rely on the return value of
> this function. Your change makes that inconsistent. Can you stop

To be more specific, __ibmvnic_close, __ibmvnic_open both call this
set_link_state.

> posting new versions and soliciting the maintainer to accept it before
> there is material change? There are many ways to make reset
> successful. I think this is the worst approach of all.
>
>
> >
> > if (adapter->state == VNIC_OPEN) {
> > /* When we dropped rtnl, ibmvnic_open() got
> > --
> > 2.18.2
> >


Re: [PATCH net v3] ibmvnic: Continue with reset if set link down failed

2021-05-04 Thread Lijun Pan
On Tue, May 4, 2021 at 2:14 PM Dany Madden  wrote:
>
> When ibmvnic gets a FATAL error message from the vnicserver, it marks
> the Command Respond Queue (CRQ) inactive and resets the adapter. If this
> FATAL reset fails and a transmission timeout reset follows, the CRQ is
> still inactive, ibmvnic's attempt to set link down will also fail. If
> ibmvnic abandons the reset because of this failed set link down and this
> is the last reset in the workqueue, then this adapter will be left in an
> inoperable state.
>
> Instead, make the driver ignore this link down failure and continue to
> free and re-register CRQ so that the adapter has an opportunity to
> recover.
>
> Fixes: ed651a10875f ("ibmvnic: Updated reset handling")
> Signed-off-by: Dany Madden 
> Reviewed-by: Rick Lindsley 
> Reviewed-by: Sukadev Bhattiprolu 
> ---
> Changes in V2:
> - Update description to clarify background for the patch
> - Include Reviewed-by tags
> Changes in V3:
> - Add comment above the code change
> ---
>  drivers/net/ethernet/ibm/ibmvnic.c | 11 +--
>  1 file changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/ethernet/ibm/ibmvnic.c 
> b/drivers/net/ethernet/ibm/ibmvnic.c
> index 5788bb956d73..9e005a08d43b 100644
> --- a/drivers/net/ethernet/ibm/ibmvnic.c
> +++ b/drivers/net/ethernet/ibm/ibmvnic.c
> @@ -2017,8 +2017,15 @@ static int do_reset(struct ibmvnic_adapter *adapter,
> rtnl_unlock();
> rc = set_link_state(adapter, IBMVNIC_LOGICAL_LNK_DN);
> rtnl_lock();
> -   if (rc)
> -   goto out;
> +
> +   /* Attempted to set the link down. It could fail if 
> the
> +* vnicserver has already torn down the CRQ. We will
> +* note it and continue with reset to reinit the CRQ.
> +*/
> +   if (rc) {
> +   netdev_dbg(netdev,
> +  "Setting link down failed rc=%d. 
> Continue anyway\n", rc);
> +   }

There are other places which check and rely on the return value of
this function. Your change makes that inconsistent. Can you stop
posting new versions and soliciting the maintainer to accept it before
there is material change? There are many ways to make reset
successful. I think this is the worst approach of all.


>
> if (adapter->state == VNIC_OPEN) {
> /* When we dropped rtnl, ibmvnic_open() got
> --
> 2.18.2
>


Re: [PATCH] ibmvnic: remove default label from to_string switch

2021-05-03 Thread Lijun Pan
On Mon, May 3, 2021 at 5:54 AM Michal Suchanek  wrote:
>
> This way the compiler warns when a new value is added to the enum but
> not the string transation like:

s/transation/translation/

This trick works.
Since the original code does not generate gcc warnings/errors, should
this patch be sent to net-next as an improvement?

>
> drivers/net/ethernet/ibm/ibmvnic.c: In function 'adapter_state_to_string':
> drivers/net/ethernet/ibm/ibmvnic.c:832:2: warning: enumeration value 
> 'VNIC_FOOBAR' not handled in switch [-Wswitch]
>   switch (state) {
>   ^~
> drivers/net/ethernet/ibm/ibmvnic.c: In function 'reset_reason_to_string':
> drivers/net/ethernet/ibm/ibmvnic.c:1935:2: warning: enumeration value 
> 'VNIC_RESET_FOOBAR' not handled in switch [-Wswitch]
>   switch (reason) {
>   ^~
>
> Signed-off-by: Michal Suchanek 
> ---

Acked-by: Lijun Pan 

>  drivers/net/ethernet/ibm/ibmvnic.c | 6 ++
>  1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/net/ethernet/ibm/ibmvnic.c 
> b/drivers/net/ethernet/ibm/ibmvnic.c
> index 5788bb956d73..4d439413f6d9 100644
> --- a/drivers/net/ethernet/ibm/ibmvnic.c
> +++ b/drivers/net/ethernet/ibm/ibmvnic.c
> @@ -846,9 +846,8 @@ static const char *adapter_state_to_string(enum 
> vnic_state state)
> return "REMOVING";
> case VNIC_REMOVED:
> return "REMOVED";
> -   default:
> -   return "UNKNOWN";
> }
> +   return "UNKNOWN";
>  }
>
>  static int ibmvnic_login(struct net_device *netdev)
> @@ -1946,9 +1945,8 @@ static const char *reset_reason_to_string(enum 
> ibmvnic_reset_reason reason)
> return "TIMEOUT";
> case VNIC_RESET_CHANGE_PARAM:
> return "CHANGE_PARAM";
> -   default:
> -   return "UNKNOWN";
> }
> +   return "UNKNOWN";
>  }
>
>  /*
> --
> 2.26.2
>


Re: [PATCH V2 net] ibmvnic: Continue with reset if set link down failed

2021-04-22 Thread Lijun Pan
On Thu, Apr 22, 2021 at 12:21 PM Michal Suchánek  wrote:
>
> Hello,
>
> On Thu, Apr 22, 2021 at 12:06:45AM -0500, Lijun Pan wrote:
> > On Wed, Apr 21, 2021 at 2:25 AM Sukadev Bhattiprolu
> >  wrote:
> > >
> > > Lijun Pan [l...@linux.vnet.ibm.com] wrote:
> > > >
> > > >
> > > > > On Apr 20, 2021, at 4:35 PM, Dany Madden  wrote:
> > > > >
> > > > > When ibmvnic gets a FATAL error message from the vnicserver, it marks
> > > > > the Command Respond Queue (CRQ) inactive and resets the adapter. If 
> > > > > this
> > > > > FATAL reset fails and a transmission timeout reset follows, the CRQ is
> > > > > still inactive, ibmvnic's attempt to set link down will also fail. If
> > > > > ibmvnic abandons the reset because of this failed set link down and 
> > > > > this
> > > > > is the last reset in the workqueue, then this adapter will be left in 
> > > > > an
> > > > > inoperable state.
> > > > >
> > > > > Instead, make the driver ignore this link down failure and continue to
> > > > > free and re-register CRQ so that the adapter has an opportunity to
> > > > > recover.
> > > >
> > > > This v2 does not adddress the concerns mentioned in v1.
> > > > And I think it is better to exit with error from do_reset, and schedule 
> > > > a thorough
> > > > do_hard_reset if the the adapter is already in unstable state.
> > >
> > > We had a FATAL error and when handling it, we failed to send a
> > > link-down message to the VIOS. So what we need to try next is to
> > > reset the connection with the VIOS. For this we must talk to the
> > > firmware using the H_FREE_CRQ and H_REG_CRQ hcalls. do_reset()
> > > does just that in ibmvnic_reset_crq().
> > >
> > > Now, sure we can attempt a "thorough hard reset" which also does
> > > the same hcalls to reestablish the connection. Is there any
> > > other magic in do_hard_reset()? But in addition, it also frees lot
> > > more Linux kernel buffers and reallocates them for instance.
> >
> > Working around everything in do_reset will make the code very difficult
> > to manage. Ultimately do_reset can do anything I am afraid, and 
> > do_hard_reset
> > can be removed completely or merged into do_reset.

Michal,

I should have given more details about the above statement. Thanks for
your detailed info in the below.

>
> This debate is not very constructive.
>
> In the context of driver that has separate do_reset and do_hard_reset
> this fix picks the correct one unless you can refute the arguments
> provided.
>
> Merging do_reset and do_hard_reset might be a good code cleanup which is
> out of the scope of this fix.

Right.

>
>
>
> Given that vast majority of fixes to the vnic driver are related to the
> reset handling it would improve stability and testability if every
> reset took the same code path.

I agree.

>
> In the context of merging do_hard_reset and do_reset the question is
> what is the intended distinction and performance gain by having
> 'lightweight' reset.

Right.

>
> I don't have a vnic protocol manual at hand and I suspect I would not
> get one even if I searched for one.
>
> From reading through the fixes in the past my understanding is that the
> full reset is required when the backend changes which then potentially
> requires different size/number of buffers.

Yes, full reset is better when the backend changes.

>
> What is the expected situation when reset is required without changing
> the backend?
>
> Is this so common that it warrants a separate 'lightweight' optimized
> function?
>


Re: [PATCH V2 net] ibmvnic: Continue with reset if set link down failed

2021-04-22 Thread Lijun Pan
On Thu, Apr 22, 2021 at 2:07 AM Rick Lindsley
 wrote:
>
> On 4/21/21 10:30 PM, Lijun Pan wrote:
> >> Fixes: ed651a10875f ("ibmvnic: Updated reset handling")
> >> Signed-off-by: Dany Madden 
> >> Reviewed-by: Rick Lindsley 
> >> Reviewed-by: Sukadev Bhattiprolu 
> >
> > One thing I would like to point out as already pointed out by Nathan Lynch 
> > is
> > that those review-by tags given by the same groups of people from the same
> > company loses credibility over time if you never critique or ask
> > questions on the list.
> >
>
> Well, so far you aren't addressing either my critiques or questions.
>
> I have been asking questions but all I have from you are the above
> attempts to discredit the reputation of myself and other people, and
> non-technical statements like
>
>  will make the code very difficult to manage
>  I think there should be a trade off between optimization and stability.
>  So I don't think you could even compare the two results
>
> On the other hand, from the original submission I see some very specific
> details:
>
>  If ibmvnic abandons the reset because of this failed set link
>  down and this is the last reset in the workqueue, then this
>  adapter will be left in an inoperable state.
>
> and from a followup discussion:
>
>  We had a FATAL error and when handling it, we failed to
>  send a link-down message to the VIOS. So what we need
>  to try next is to reset the connection with the VIOS. For
>  this we must ...
>
> These are great technical points that could be argued or discussed.
> Problem is, I agree with them.
>
> I will ask again:  can you please supply some technical reasons for
> your objections.  Otherwise, your objections are meritless and at worst
> simply an ad hominem attack.

Well, from the beginning of v1, I started to provide technical inputs.
Then I was not
allowed to post anything in the community about this patch and VNIC
via l...@linux.ibm.com except giving an ack-by/reviewed-by.


Re: [PATCH V2 net] ibmvnic: Continue with reset if set link down failed

2021-04-21 Thread Lijun Pan
On Tue, Apr 20, 2021 at 4:37 PM Dany Madden  wrote:
>
> When ibmvnic gets a FATAL error message from the vnicserver, it marks
> the Command Respond Queue (CRQ) inactive and resets the adapter. If this
> FATAL reset fails and a transmission timeout reset follows, the CRQ is
> still inactive, ibmvnic's attempt to set link down will also fail. If
> ibmvnic abandons the reset because of this failed set link down and this
> is the last reset in the workqueue, then this adapter will be left in an
> inoperable state.
>
> Instead, make the driver ignore this link down failure and continue to
> free and re-register CRQ so that the adapter has an opportunity to
> recover.
>
> Fixes: ed651a10875f ("ibmvnic: Updated reset handling")
> Signed-off-by: Dany Madden 
> Reviewed-by: Rick Lindsley 
> Reviewed-by: Sukadev Bhattiprolu 

One thing I would like to point out as already pointed out by Nathan Lynch is
that those review-by tags given by the same groups of people from the same
company loses credibility over time if you never critique or ask
questions on the list.


Re: [PATCH V2 net] ibmvnic: Continue with reset if set link down failed

2021-04-21 Thread Lijun Pan
On Wed, Apr 21, 2021 at 3:06 AM Rick Lindsley
 wrote:
>
> On 4/20/21 2:42 PM, Lijun Pan wrote:
> >
> > This v2 does not adddress the concerns mentioned in v1.
> > And I think it is better to exit with error from do_reset, and schedule a 
> > thorough
> > do_hard_reset if the the adapter is already in unstable state.
>
> But the point is that the testing and analysis has indicated that doing a full
> hard reset is not necessary. We are about to take the very action which will 
> fix
> this situation, but currently do not.

The testing was done on this patch. It was not performed on a full hard reset.
So I don't think you could even compare the two results.

>
> Please describe the advantage in deferring it further by routing it through
> do_hard_reset().  I don't see one.

It is not deferred. It exits with error and calls do_hard_reset.
See my reply to Suka's.


Re: [PATCH V2 net] ibmvnic: Continue with reset if set link down failed

2021-04-21 Thread Lijun Pan
On Wed, Apr 21, 2021 at 2:25 AM Sukadev Bhattiprolu
 wrote:
>
> Lijun Pan [l...@linux.vnet.ibm.com] wrote:
> >
> >
> > > On Apr 20, 2021, at 4:35 PM, Dany Madden  wrote:
> > >
> > > When ibmvnic gets a FATAL error message from the vnicserver, it marks
> > > the Command Respond Queue (CRQ) inactive and resets the adapter. If this
> > > FATAL reset fails and a transmission timeout reset follows, the CRQ is
> > > still inactive, ibmvnic's attempt to set link down will also fail. If
> > > ibmvnic abandons the reset because of this failed set link down and this
> > > is the last reset in the workqueue, then this adapter will be left in an
> > > inoperable state.
> > >
> > > Instead, make the driver ignore this link down failure and continue to
> > > free and re-register CRQ so that the adapter has an opportunity to
> > > recover.
> >
> > This v2 does not adddress the concerns mentioned in v1.
> > And I think it is better to exit with error from do_reset, and schedule a 
> > thorough
> > do_hard_reset if the the adapter is already in unstable state.
>
> We had a FATAL error and when handling it, we failed to send a
> link-down message to the VIOS. So what we need to try next is to
> reset the connection with the VIOS. For this we must talk to the
> firmware using the H_FREE_CRQ and H_REG_CRQ hcalls. do_reset()
> does just that in ibmvnic_reset_crq().
>
> Now, sure we can attempt a "thorough hard reset" which also does
> the same hcalls to reestablish the connection. Is there any
> other magic in do_hard_reset()? But in addition, it also frees lot
> more Linux kernel buffers and reallocates them for instance.

Working around everything in do_reset will make the code very difficult
to manage. Ultimately do_reset can do anything I am afraid, and do_hard_reset
can be removed completely or merged into do_reset.

>
> If we are having a communication problem with the VIOS, what is
> the point of freeing and reallocating Linux kernel buffers? Beside
> being inefficient, it would expose us to even more errors during
> reset under heavy workloads?

No real customer runs the system under that heavy load created by
HTX stress test, which can tear down any working system.

>
> From what I understand so far, do_reset() is complicated because
> it is attempting some optimizations.  If we are going to fall back
> to hard reset for every error we might as well drop the do_reset()
> and just do the "thorough hard reset" every time right?

I think such optimizations are catered for passing HTX tests. Whether
the optimization benefits the adapter, say making the adapter more stable,
I doubt it. I think there should be a trade off between optimization
and stability.


Re: [PATCH V2 net] ibmvnic: Continue with reset if set link down failed

2021-04-20 Thread Lijun Pan



> On Apr 20, 2021, at 4:35 PM, Dany Madden  wrote:
> 
> When ibmvnic gets a FATAL error message from the vnicserver, it marks
> the Command Respond Queue (CRQ) inactive and resets the adapter. If this
> FATAL reset fails and a transmission timeout reset follows, the CRQ is
> still inactive, ibmvnic's attempt to set link down will also fail. If
> ibmvnic abandons the reset because of this failed set link down and this
> is the last reset in the workqueue, then this adapter will be left in an
> inoperable state.
> 
> Instead, make the driver ignore this link down failure and continue to
> free and re-register CRQ so that the adapter has an opportunity to
> recover.

This v2 does not adddress the concerns mentioned in v1.
And I think it is better to exit with error from do_reset, and schedule a 
thorough
do_hard_reset if the the adapter is already in unstable state.

> 
> Fixes: ed651a10875f ("ibmvnic: Updated reset handling")
> Signed-off-by: Dany Madden 
> Reviewed-by: Rick Lindsley 
> Reviewed-by: Sukadev Bhattiprolu 
> ---
> Changes in V2:
> - Update description to clarify background for the patch
> - Include Reviewed-by tags
> ---
> drivers/net/ethernet/ibm/ibmvnic.c | 6 --
> 1 file changed, 4 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/ibm/ibmvnic.c 
> b/drivers/net/ethernet/ibm/ibmvnic.c
> index ffb2a91750c7..4bd8c5d1a275 100644
> --- a/drivers/net/ethernet/ibm/ibmvnic.c
> +++ b/drivers/net/ethernet/ibm/ibmvnic.c
> @@ -1970,8 +1970,10 @@ static int do_reset(struct ibmvnic_adapter *adapter,
>   rtnl_unlock();
>   rc = set_link_state(adapter, IBMVNIC_LOGICAL_LNK_DN);
>   rtnl_lock();
> - if (rc)
> - goto out;
> + if (rc) {
> + netdev_dbg(netdev,
> +"Setting link down failed rc=%d. 
> Continue anyway\n", rc);
> + }
> 
>   if (adapter->state == VNIC_OPEN) {
>   /* When we dropped rtnl, ibmvnic_open() got
> -- 
> 2.26.2
> 



Re: [PATCH v1] ibmvnic: remove excessive irqsave

2021-03-05 Thread Lijun Pan
On Mar 5, 2021, at 2:48 AM, angkery <angk...@163.com> wrote:From: Junlin Yang <yangjun...@yulong.com>ibmvnic_remove locks multiple spinlocks while disabling interrupts:spin_lock_irqsave(>state_lock, flags);spin_lock_irqsave(>rwi_lock, flags);As reported by coccinelle, the second _irqsave() overwrites the valuesaved in 'flags' by the first _irqsave(),   therefore when the second_irqrestore() comes,the value in 'flags' is not valid,the value savedby the first _irqsave() has been lost.This likely leads to IRQs remaining disabled. So remove the second_irqsave():spin_lock_irqsave(>state_lock, flags);spin_lock(>rwi_lock);Generated by: ./scripts/coccinelle/locks/flags.cocci./drivers/net/ethernet/ibm/ibmvnic.c:5413:1-18:ERROR: nested lock+irqsave that reuses flags from line 5404.Fixes: 4a41c421f367 ("ibmvnic: serialize access to work queue on remove")Signed-off-by: Junlin Yang <yangjun...@yulong.com>---Acked-by: Lijun Pan <l...@linux.ibm.com>Changes in v1:	a.According to Christophe Leroy's explanation, update the commit information.	b.Add fixes tags. drivers/net/ethernet/ibm/ibmvnic.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.cindex 2464c8a..a52668d 100644--- a/drivers/net/ethernet/ibm/ibmvnic.c+++ b/drivers/net/ethernet/ibm/ibmvnic.c@@ -5408,9 +5408,9 @@ static void ibmvnic_remove(struct vio_dev *dev) 	 * after setting state, so __ibmvnic_reset() which is called 	 * from the flush_work() below, can make progress. 	 */-	spin_lock_irqsave(>rwi_lock, flags);+	spin_lock(>rwi_lock); 	adapter->state = VNIC_REMOVING;-	spin_unlock_irqrestore(>rwi_lock, flags);+	spin_unlock(>rwi_lock); 	spin_unlock_irqrestore(>state_lock, flags);-- 1.9.1

Re: [PATCH] vio: make remove callback return void

2021-01-29 Thread Lijun Pan
On Wed, Jan 27, 2021 at 6:41 PM Uwe Kleine-König  wrote:
>
> The driver core ignores the return value of struct bus_type::remove()
> because there is only little that can be done. To simplify the quest to
> make this function return void, let struct vio_driver::remove() return
> void, too. All users already unconditionally return 0, this commit makes
> it obvious that returning an error code is a bad idea and makes it
> obvious for future driver authors that returning an error code isn't
> intended.
>
> Note there are two nominally different implementations for a vio bus:
> one in arch/sparc/kernel/vio.c and the other in
> arch/powerpc/platforms/pseries/vio.c. I didn't care to check which
> driver is using which of these busses (or if even some of them can be
> used with both) and simply adapt all drivers and the two bus codes in
> one go.
>
> Note that for the powerpc implementation there is a semantical change:
> Before this patch for a device that was bound to a driver without a
> remove callback vio_cmo_bus_remove(viodev) wasn't called. As the device
> core still considers the device unbound after vio_bus_remove() returns
> calling this unconditionally is the consistent behaviour which is
> implemented here.
>
> Signed-off-by: Uwe Kleine-König 

Acked-by: Lijun Pan 


[PATCH net v2] ibmvnic: device remove has higher precedence over reset

2021-01-28 Thread Lijun Pan
Returning -EBUSY in ibmvnic_remove() does not actually hold the
removal procedure since driver core doesn't care for the return
value (see __device_release_driver() in drivers/base/dd.c
calling dev->bus->remove()) though vio_bus_remove
(in arch/powerpc/platforms/pseries/vio.c) records the
return value and passes it on. [1]

During the device removal precedure, checking for resetting
bit is dropped so that we can continue executing all the
cleanup calls in the rest of the remove function. Otherwise,
it can cause latent memory leaks and kernel crashes.

[1] 
https://lore.kernel.org/linuxppc-dev/20210117101242.dpwayq6wdgfdz...@pengutronix.de/T/#m48f5befd96bc9842ece2a3ad14f4c27747206a53
Reported-by: Uwe Kleine-König 
Fixes: 7d7195a026ba ("ibmvnic: Do not process device remove during device 
reset")
Signed-off-by: Lijun Pan 
---
v2: drop v1's deletion of REMOVING check in __ibmvnic_reset.

 drivers/net/ethernet/ibm/ibmvnic.c | 5 -
 1 file changed, 5 deletions(-)

diff --git a/drivers/net/ethernet/ibm/ibmvnic.c 
b/drivers/net/ethernet/ibm/ibmvnic.c
index 9778c83150f1..e19fa8bc763c 100644
--- a/drivers/net/ethernet/ibm/ibmvnic.c
+++ b/drivers/net/ethernet/ibm/ibmvnic.c
@@ -5438,11 +5438,6 @@ static int ibmvnic_remove(struct vio_dev *dev)
unsigned long flags;
 
spin_lock_irqsave(>state_lock, flags);
-   if (test_bit(0, >resetting)) {
-   spin_unlock_irqrestore(>state_lock, flags);
-   return -EBUSY;
-   }
-
adapter->state = VNIC_REMOVING;
spin_unlock_irqrestore(>state_lock, flags);
 
-- 
2.23.0



Re: [PATCH net] ibmvnic: device remove has higher precedence over reset

2021-01-21 Thread Lijun Pan
> > diff --git a/drivers/net/ethernet/ibm/ibmvnic.c
> > b/drivers/net/ethernet/ibm/ibmvnic.c
> > index aed985e08e8a..11f28fd03057 100644
> > --- a/drivers/net/ethernet/ibm/ibmvnic.c
> > +++ b/drivers/net/ethernet/ibm/ibmvnic.c
> > @@ -2235,8 +2235,7 @@ static void __ibmvnic_reset(struct work_struct
> > *work)
> >   while (rwi) {
> >   spin_lock_irqsave(>state_lock, flags);
> >
> > - if (adapter->state == VNIC_REMOVING ||
> > - adapter->state == VNIC_REMOVED) {
> > + if (adapter->state == VNIC_REMOVED) {
>
> If we do get here, we would crash because ibmvnic_remove() happened. It
> frees the adapter struct already.

Not exactly. viodev is gone; netdev is gone; ibmvnic_adapter is still there.

Lijun


Re: [PATCH net] ibmvnic: device remove has higher precedence over reset

2021-01-21 Thread Lijun Pan
On Thu, Jan 21, 2021 at 12:42 PM Dany Madden  wrote:
>
> On 2021-01-20 22:20, Lijun Pan wrote:
> > Returning -EBUSY in ibmvnic_remove() does not actually hold the
> > removal procedure since driver core doesn't care for the return
> > value (see __device_release_driver() in drivers/base/dd.c
> > calling dev->bus->remove()) though vio_bus_remove
> > (in arch/powerpc/platforms/pseries/vio.c) records the
> > return value and passes it on. [1]
> >
> > During the device removal precedure, we should not schedule
> > any new reset (ibmvnic_reset check for REMOVING and exit),
> > and should rely on the flush_work and flush_delayed_work
> > to complete the pending resets, specifically we need to
> > let __ibmvnic_reset() keep running while in REMOVING state since
> > flush_work and flush_delayed_work shall call __ibmvnic_reset finally.
> > So we skip the checking for REMOVING in __ibmvnic_reset.
> >
> > [1]
> > https://lore.kernel.org/linuxppc-dev/20210117101242.dpwayq6wdgfdz...@pengutronix.de/T/#m48f5befd96bc9842ece2a3ad14f4c27747206a53
> > Reported-by: Uwe Kleine-König 
> > Fixes: 7d7195a026ba ("ibmvnic: Do not process device remove during
> > device reset")
> > Signed-off-by: Lijun Pan 
> > ---
> > v1 versus RFC:
> >   1/ articulate why remove the REMOVING checking in __ibmvnic_reset
> >   and why keep the current checking for REMOVING in ibmvnic_reset.
> >   2/ The locking issue mentioned by Uwe are being addressed separately
> >  by   https://lists.openwall.net/netdev/2021/01/08/89
> >   3/ This patch does not have merge conflict with 2/
> >
> >  drivers/net/ethernet/ibm/ibmvnic.c | 8 +---
> >  1 file changed, 1 insertion(+), 7 deletions(-)
> >
> > diff --git a/drivers/net/ethernet/ibm/ibmvnic.c
> > b/drivers/net/ethernet/ibm/ibmvnic.c
> > index aed985e08e8a..11f28fd03057 100644
> > --- a/drivers/net/ethernet/ibm/ibmvnic.c
> > +++ b/drivers/net/ethernet/ibm/ibmvnic.c
> > @@ -2235,8 +2235,7 @@ static void __ibmvnic_reset(struct work_struct
> > *work)
> >   while (rwi) {
> >   spin_lock_irqsave(>state_lock, flags);
> >
> > - if (adapter->state == VNIC_REMOVING ||
> > - adapter->state == VNIC_REMOVED) {
> > + if (adapter->state == VNIC_REMOVED) {
>
> If we do get here, we would crash because ibmvnic_remove() happened. It
> frees the adapter struct already.

Not exactly. viodev is gone; netdev is done; ibmvnic_adapter is still there.

Lijun
>
> >   spin_unlock_irqrestore(>state_lock, flags);
> >   kfree(rwi);
> >   rc = EBUSY;
> > @@ -5372,11 +5371,6 @@ static int ibmvnic_remove(struct vio_dev *dev)
> >   unsigned long flags;
> >
> >   spin_lock_irqsave(>state_lock, flags);
> > - if (test_bit(0, >resetting)) {
> > - spin_unlock_irqrestore(>state_lock, flags);
> > - return -EBUSY;
> > - }
> > -
> >   adapter->state = VNIC_REMOVING;
> >   spin_unlock_irqrestore(>state_lock, flags);


[PATCH net] ibmvnic: device remove has higher precedence over reset

2021-01-20 Thread Lijun Pan
Returning -EBUSY in ibmvnic_remove() does not actually hold the
removal procedure since driver core doesn't care for the return
value (see __device_release_driver() in drivers/base/dd.c
calling dev->bus->remove()) though vio_bus_remove
(in arch/powerpc/platforms/pseries/vio.c) records the
return value and passes it on. [1]

During the device removal precedure, we should not schedule
any new reset (ibmvnic_reset check for REMOVING and exit),
and should rely on the flush_work and flush_delayed_work
to complete the pending resets, specifically we need to
let __ibmvnic_reset() keep running while in REMOVING state since
flush_work and flush_delayed_work shall call __ibmvnic_reset finally.
So we skip the checking for REMOVING in __ibmvnic_reset.

[1] 
https://lore.kernel.org/linuxppc-dev/20210117101242.dpwayq6wdgfdz...@pengutronix.de/T/#m48f5befd96bc9842ece2a3ad14f4c27747206a53
Reported-by: Uwe Kleine-König 
Fixes: 7d7195a026ba ("ibmvnic: Do not process device remove during device 
reset")
Signed-off-by: Lijun Pan 
---
v1 versus RFC: 
  1/ articulate why remove the REMOVING checking in __ibmvnic_reset
  and why keep the current checking for REMOVING in ibmvnic_reset.
  2/ The locking issue mentioned by Uwe are being addressed separately 
 by https://lists.openwall.net/netdev/2021/01/08/89
  3/ This patch does not have merge conflict with 2/

 drivers/net/ethernet/ibm/ibmvnic.c | 8 +---
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/net/ethernet/ibm/ibmvnic.c 
b/drivers/net/ethernet/ibm/ibmvnic.c
index aed985e08e8a..11f28fd03057 100644
--- a/drivers/net/ethernet/ibm/ibmvnic.c
+++ b/drivers/net/ethernet/ibm/ibmvnic.c
@@ -2235,8 +2235,7 @@ static void __ibmvnic_reset(struct work_struct *work)
while (rwi) {
spin_lock_irqsave(>state_lock, flags);
 
-   if (adapter->state == VNIC_REMOVING ||
-   adapter->state == VNIC_REMOVED) {
+   if (adapter->state == VNIC_REMOVED) {
spin_unlock_irqrestore(>state_lock, flags);
kfree(rwi);
rc = EBUSY;
@@ -5372,11 +5371,6 @@ static int ibmvnic_remove(struct vio_dev *dev)
unsigned long flags;
 
spin_lock_irqsave(>state_lock, flags);
-   if (test_bit(0, >resetting)) {
-   spin_unlock_irqrestore(>state_lock, flags);
-   return -EBUSY;
-   }
-
adapter->state = VNIC_REMOVING;
spin_unlock_irqrestore(>state_lock, flags);
 
-- 
2.22.0



Re: [PATCH net RFC] ibmvnic: device remove has higher precedence over reset

2021-01-19 Thread Lijun Pan
On Tue, Jan 19, 2021 at 1:56 PM Uwe Kleine-König
 wrote:
>
> On Tue, Jan 19, 2021 at 01:33:13PM -0600, Lijun Pan wrote:
> > Returning -EBUSY in ibmvnic_remove() does not actually hold the
> > removal procedure since driver core doesn't care for the return
> > value (see __device_release_driver() in drivers/base/dd.c
> > calling dev->bus->remove()) though vio_bus_remove
> > (in arch/powerpc/platforms/pseries/vio.c) records the
> > return value and passes it on. [1]
> >
> > During the device removal precedure, we should not schedule
> > any new reset, and rely on the flush_work and flush_delayed_work
> > to complete the pending resets, and specifically we need to
> > let __ibmvnic_reset() keep running while in REMOVING state since
> > flush_work and flush_delayed_work shall call __ibmvnic_reset finally.
> >
> > [1] 
> > https://lore.kernel.org/linuxppc-dev/20210117101242.dpwayq6wdgfdz...@pengutronix.de/T/#m48f5befd96bc9842ece2a3ad14f4c27747206a53
> > Reported-by: Uwe Kleine-König 
> > Fixes: 7d7195a026ba ("ibmvnic: Do not process device remove during device 
> > reset")
> > Signed-off-by: Lijun Pan 
> > ---
> >  drivers/net/ethernet/ibm/ibmvnic.c | 8 +---
> >  1 file changed, 1 insertion(+), 7 deletions(-)
> >
> > diff --git a/drivers/net/ethernet/ibm/ibmvnic.c 
> > b/drivers/net/ethernet/ibm/ibmvnic.c
> > index aed985e08e8a..11f28fd03057 100644
> > --- a/drivers/net/ethernet/ibm/ibmvnic.c
> > +++ b/drivers/net/ethernet/ibm/ibmvnic.c
> > @@ -2235,8 +2235,7 @@ static void __ibmvnic_reset(struct work_struct *work)
> >   while (rwi) {
> >   spin_lock_irqsave(>state_lock, flags);
> >
> > - if (adapter->state == VNIC_REMOVING ||
> > - adapter->state == VNIC_REMOVED) {
> > + if (adapter->state == VNIC_REMOVED) {
>
> I think you need to keep the check for VNIC_REMOVING. Otherwise you
> don't prevent that a new reset being queued after ibmvnic_remove() set
> the state to VNIC_REMOVING. Am I missing something?

I leave the checking for REMOVING there in ibmvnic_reset, which is the
function to schedule/queue up the resets.
Here I delete the REMOVING in __ibmvnic_reset to let it run and finish.
Otherwise flush_work will not do anything if __ibmvnic_reset() just return
doing nothing.

I can explain it in the commit message.

>
> >   spin_unlock_irqrestore(>state_lock, flags);
> >   kfree(rwi);
> >   rc = EBUSY;
> > @@ -5372,11 +5371,6 @@ static int ibmvnic_remove(struct vio_dev *dev)
> >   unsigned long flags;
> >
> >   spin_lock_irqsave(>state_lock, flags);
> > - if (test_bit(0, >resetting)) {
> > - spin_unlock_irqrestore(>state_lock, flags);
> > - return -EBUSY;
> > - }
> > -
> >   adapter->state = VNIC_REMOVING;
> >   spin_unlock_irqrestore(>state_lock, flags);
>
> Best regards
> Uwe
>
> --
> Pengutronix e.K.   | Uwe Kleine-König|
> Industrial Linux Solutions | https://www.pengutronix.de/ |


[PATCH net RFC] ibmvnic: device remove has higher precedence over reset

2021-01-19 Thread Lijun Pan
Returning -EBUSY in ibmvnic_remove() does not actually hold the
removal procedure since driver core doesn't care for the return
value (see __device_release_driver() in drivers/base/dd.c
calling dev->bus->remove()) though vio_bus_remove
(in arch/powerpc/platforms/pseries/vio.c) records the
return value and passes it on. [1]

During the device removal precedure, we should not schedule
any new reset, and rely on the flush_work and flush_delayed_work
to complete the pending resets, and specifically we need to
let __ibmvnic_reset() keep running while in REMOVING state since
flush_work and flush_delayed_work shall call __ibmvnic_reset finally.

[1] 
https://lore.kernel.org/linuxppc-dev/20210117101242.dpwayq6wdgfdz...@pengutronix.de/T/#m48f5befd96bc9842ece2a3ad14f4c27747206a53
Reported-by: Uwe Kleine-König 
Fixes: 7d7195a026ba ("ibmvnic: Do not process device remove during device 
reset")
Signed-off-by: Lijun Pan 
---
 drivers/net/ethernet/ibm/ibmvnic.c | 8 +---
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/net/ethernet/ibm/ibmvnic.c 
b/drivers/net/ethernet/ibm/ibmvnic.c
index aed985e08e8a..11f28fd03057 100644
--- a/drivers/net/ethernet/ibm/ibmvnic.c
+++ b/drivers/net/ethernet/ibm/ibmvnic.c
@@ -2235,8 +2235,7 @@ static void __ibmvnic_reset(struct work_struct *work)
while (rwi) {
spin_lock_irqsave(>state_lock, flags);
 
-   if (adapter->state == VNIC_REMOVING ||
-   adapter->state == VNIC_REMOVED) {
+   if (adapter->state == VNIC_REMOVED) {
spin_unlock_irqrestore(>state_lock, flags);
kfree(rwi);
rc = EBUSY;
@@ -5372,11 +5371,6 @@ static int ibmvnic_remove(struct vio_dev *dev)
unsigned long flags;
 
spin_lock_irqsave(>state_lock, flags);
-   if (test_bit(0, >resetting)) {
-   spin_unlock_irqrestore(>state_lock, flags);
-   return -EBUSY;
-   }
-
adapter->state = VNIC_REMOVING;
spin_unlock_irqrestore(>state_lock, flags);
 
-- 
2.22.0



Re: [PATCH] ibmvnic: fix: NULL pointer dereference.

2020-12-30 Thread Lijun Pan
On Wed, Dec 30, 2020 at 1:25 AM YANG LI  wrote:
>
> The error is due to dereference a null pointer in function
> reset_one_sub_crq_queue():
>
> if (!scrq) {
> netdev_dbg(adapter->netdev,
>"Invalid scrq reset. irq (%d) or msgs(%p).\n",
> scrq->irq, scrq->msgs);
> return -EINVAL;
> }
>
> If the expression is true, scrq must be a null pointer and cannot
> dereference.
>
> Signed-off-by: YANG LI 
> Reported-by: Abaci 
> ---

Acked-by: Lijun Pan 


[PATCH net-next v2 4/4] ibmvnic: merge ibmvnic_reset_init and ibmvnic_init

2020-08-19 Thread Lijun Pan
These two functions share the majority of the code, hence merge
them together. In the meanwhile, add a reset pass-in parameter
to differentiate them. Thus, the code is easier to read and to tell
the difference between reset_init and regular init.

Signed-off-by: Lijun Pan 
---
 drivers/net/ethernet/ibm/ibmvnic.c | 65 ++
 1 file changed, 13 insertions(+), 52 deletions(-)

diff --git a/drivers/net/ethernet/ibm/ibmvnic.c 
b/drivers/net/ethernet/ibm/ibmvnic.c
index 4ca4647db72a..47fbe0553570 100644
--- a/drivers/net/ethernet/ibm/ibmvnic.c
+++ b/drivers/net/ethernet/ibm/ibmvnic.c
@@ -104,8 +104,7 @@ static int send_login(struct ibmvnic_adapter *adapter);
 static void send_cap_queries(struct ibmvnic_adapter *adapter);
 static int init_sub_crqs(struct ibmvnic_adapter *);
 static int init_sub_crq_irqs(struct ibmvnic_adapter *adapter);
-static int ibmvnic_init(struct ibmvnic_adapter *);
-static int ibmvnic_reset_init(struct ibmvnic_adapter *);
+static int ibmvnic_reset_init(struct ibmvnic_adapter *, bool reset);
 static void release_crq_queue(struct ibmvnic_adapter *);
 static int __ibmvnic_set_mac(struct net_device *, u8 *);
 static int init_crq_queue(struct ibmvnic_adapter *adapter);
@@ -1868,7 +1867,7 @@ static int do_change_param_reset(struct ibmvnic_adapter 
*adapter,
return rc;
}
 
-   rc = ibmvnic_reset_init(adapter);
+   rc = ibmvnic_reset_init(adapter, true);
if (rc)
return IBMVNIC_INIT_FAILED;
 
@@ -1986,7 +1985,7 @@ static int do_reset(struct ibmvnic_adapter *adapter,
goto out;
}
 
-   rc = ibmvnic_reset_init(adapter);
+   rc = ibmvnic_reset_init(adapter, true);
if (rc) {
rc = IBMVNIC_INIT_FAILED;
goto out;
@@ -2093,7 +2092,7 @@ static int do_hard_reset(struct ibmvnic_adapter *adapter,
return rc;
}
 
-   rc = ibmvnic_init(adapter);
+   rc = ibmvnic_reset_init(adapter, false);
if (rc)
return rc;
 
@@ -4970,7 +4969,7 @@ static int init_crq_queue(struct ibmvnic_adapter *adapter)
return retrc;
 }
 
-static int ibmvnic_reset_init(struct ibmvnic_adapter *adapter)
+static int ibmvnic_reset_init(struct ibmvnic_adapter *adapter, bool reset)
 {
struct device *dev = >vdev->dev;
unsigned long timeout = msecs_to_jiffies(3);
@@ -4979,10 +4978,12 @@ static int ibmvnic_reset_init(struct ibmvnic_adapter 
*adapter)
 
adapter->from_passive_init = false;
 
-   old_num_rx_queues = adapter->req_rx_queues;
-   old_num_tx_queues = adapter->req_tx_queues;
+   if (reset) {
+   old_num_rx_queues = adapter->req_rx_queues;
+   old_num_tx_queues = adapter->req_tx_queues;
+   reinit_completion(>init_done);
+   }
 
-   reinit_completion(>init_done);
adapter->init_done_rc = 0;
rc = ibmvnic_send_crq_init(adapter);
if (rc) {
@@ -5000,7 +5001,8 @@ static int ibmvnic_reset_init(struct ibmvnic_adapter 
*adapter)
return adapter->init_done_rc;
}
 
-   if (test_bit(0, >resetting) && !adapter->wait_for_reset &&
+   if (reset &&
+   test_bit(0, >resetting) && !adapter->wait_for_reset &&
adapter->reset_reason != VNIC_RESET_MOBILITY) {
if (adapter->req_rx_queues != old_num_rx_queues ||
adapter->req_tx_queues != old_num_tx_queues) {
@@ -5028,47 +5030,6 @@ static int ibmvnic_reset_init(struct ibmvnic_adapter 
*adapter)
return rc;
 }
 
-static int ibmvnic_init(struct ibmvnic_adapter *adapter)
-{
-   struct device *dev = >vdev->dev;
-   unsigned long timeout = msecs_to_jiffies(3);
-   int rc;
-
-   adapter->from_passive_init = false;
-
-   adapter->init_done_rc = 0;
-   rc = ibmvnic_send_crq_init(adapter);
-   if (rc) {
-   dev_err(dev, "Send crq init failed with error %d\n", rc);
-   return rc;
-   }
-
-   if (!wait_for_completion_timeout(>init_done, timeout)) {
-   dev_err(dev, "Initialization sequence timed out\n");
-   return -1;
-   }
-
-   if (adapter->init_done_rc) {
-   release_crq_queue(adapter);
-   return adapter->init_done_rc;
-   }
-
-   rc = init_sub_crqs(adapter);
-   if (rc) {
-   dev_err(dev, "Initialization of sub crqs failed\n");
-   release_crq_queue(adapter);
-   return rc;
-   }
-
-   rc = init_sub_crq_irqs(adapter);
-   if (rc) {
-   dev_err(dev, "Failed to initialize sub crq irqs\n");
-   release_crq_queue(adapter);
-   }
-
-   return rc;
-}
-
 static struct device_attribute dev_attr_failover;

[PATCH net-next v2 3/4] ibmvnic: remove never executed if statement

2020-08-19 Thread Lijun Pan
At the beginning of the function, from_passive_init is set false by
"adapter->from_passive_init = false;",
hence the if statement will never run.

Signed-off-by: Lijun Pan 
---
 drivers/net/ethernet/ibm/ibmvnic.c | 12 
 1 file changed, 12 deletions(-)

diff --git a/drivers/net/ethernet/ibm/ibmvnic.c 
b/drivers/net/ethernet/ibm/ibmvnic.c
index 644352e5056d..4ca4647db72a 100644
--- a/drivers/net/ethernet/ibm/ibmvnic.c
+++ b/drivers/net/ethernet/ibm/ibmvnic.c
@@ -5000,12 +5000,6 @@ static int ibmvnic_reset_init(struct ibmvnic_adapter 
*adapter)
return adapter->init_done_rc;
}
 
-   if (adapter->from_passive_init) {
-   adapter->state = VNIC_OPEN;
-   adapter->from_passive_init = false;
-   return -1;
-   }
-
if (test_bit(0, >resetting) && !adapter->wait_for_reset &&
adapter->reset_reason != VNIC_RESET_MOBILITY) {
if (adapter->req_rx_queues != old_num_rx_queues ||
@@ -5059,12 +5053,6 @@ static int ibmvnic_init(struct ibmvnic_adapter *adapter)
return adapter->init_done_rc;
}
 
-   if (adapter->from_passive_init) {
-   adapter->state = VNIC_OPEN;
-   adapter->from_passive_init = false;
-   return -1;
-   }
-
rc = init_sub_crqs(adapter);
if (rc) {
dev_err(dev, "Initialization of sub crqs failed\n");
-- 
2.23.0



[PATCH net-next v2 2/4] ibmvnic: improve ibmvnic_init and ibmvnic_reset_init

2020-08-19 Thread Lijun Pan
When H_SEND_CRQ command returns with H_CLOSED, it means the
server's CRQ is not ready yet. Instead of resetting immediately,
we wait for the server to launch passive init.
ibmvnic_init() and ibmvnic_reset_init() should also return the
error code from ibmvnic_send_crq_init() call.

Signed-off-by: Lijun Pan 
---
v2: removes __func__ in error messages.

 drivers/net/ethernet/ibm/ibmvnic.c | 17 +
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/ibm/ibmvnic.c 
b/drivers/net/ethernet/ibm/ibmvnic.c
index 65f5d99f97dc..644352e5056d 100644
--- a/drivers/net/ethernet/ibm/ibmvnic.c
+++ b/drivers/net/ethernet/ibm/ibmvnic.c
@@ -3568,8 +3568,7 @@ static int ibmvnic_send_crq(struct ibmvnic_adapter 
*adapter,
if (rc) {
if (rc == H_CLOSED) {
dev_warn(dev, "CRQ Queue closed\n");
-   if (test_bit(0, >resetting))
-   ibmvnic_reset(adapter, VNIC_RESET_FATAL);
+   /* do not reset, report the fail, wait for passive init 
from server */
}
 
dev_warn(dev, "Send error (rc=%d)\n", rc);
@@ -4985,7 +4984,12 @@ static int ibmvnic_reset_init(struct ibmvnic_adapter 
*adapter)
 
reinit_completion(>init_done);
adapter->init_done_rc = 0;
-   ibmvnic_send_crq_init(adapter);
+   rc = ibmvnic_send_crq_init(adapter);
+   if (rc) {
+   dev_err(dev, "Send crq init failed with error %d\n", rc);
+   return rc;
+   }
+
if (!wait_for_completion_timeout(>init_done, timeout)) {
dev_err(dev, "Initialization sequence timed out\n");
return -1;
@@ -5039,7 +5043,12 @@ static int ibmvnic_init(struct ibmvnic_adapter *adapter)
adapter->from_passive_init = false;
 
adapter->init_done_rc = 0;
-   ibmvnic_send_crq_init(adapter);
+   rc = ibmvnic_send_crq_init(adapter);
+   if (rc) {
+   dev_err(dev, "Send crq init failed with error %d\n", rc);
+   return rc;
+   }
+
if (!wait_for_completion_timeout(>init_done, timeout)) {
dev_err(dev, "Initialization sequence timed out\n");
return -1;
-- 
2.23.0



[PATCH net-next v2 1/4] ibmvnic: compare adapter->init_done_rc with more readable ibmvnic_rc_codes

2020-08-19 Thread Lijun Pan
Instead of comparing (adapter->init_done_rc == 1), let it
be (adapter->init_done_rc == PARTIALSUCCESS).

Signed-off-by: Lijun Pan 
---
 drivers/net/ethernet/ibm/ibmvnic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/ibm/ibmvnic.c 
b/drivers/net/ethernet/ibm/ibmvnic.c
index 5afb3c9c52d2..65f5d99f97dc 100644
--- a/drivers/net/ethernet/ibm/ibmvnic.c
+++ b/drivers/net/ethernet/ibm/ibmvnic.c
@@ -974,7 +974,7 @@ static int set_link_state(struct ibmvnic_adapter *adapter, 
u8 link_state)
return -1;
}
 
-   if (adapter->init_done_rc == 1) {
+   if (adapter->init_done_rc == PARTIALSUCCESS) {
/* Partuial success, delay and re-send */
mdelay(1000);
resend = true;
-- 
2.23.0



[PATCH net-next v2 0/4] refactoring of ibmvnic code

2020-08-19 Thread Lijun Pan
This patch series refactor reset_init and init functions,
and make some other cosmetic changes to make the code
easier to read and debug. v2 removes __func__ and v1's 1/5.

Lijun Pan (4):
  ibmvnic: compare adapter->init_done_rc with more readable
ibmvnic_rc_codes
  ibmvnic: improve ibmvnic_init and ibmvnic_reset_init
  ibmvnic: remove never executed if statement
  ibmvnic: merge ibmvnic_reset_init and ibmvnic_init

 drivers/net/ethernet/ibm/ibmvnic.c | 84 --
 1 file changed, 21 insertions(+), 63 deletions(-)

-- 
2.23.0



[PATCH net-next 5/5] ibmvnic: merge ibmvnic_reset_init and ibmvnic_init

2020-08-18 Thread Lijun Pan
These two functions share the majority of the code, hence merge
them together. In the meanwhile, add a reset pass-in parameter
to differentiate them. Thus, the code is easier to read and to tell
the difference between reset_init and regular init.

Signed-off-by: Lijun Pan 
---
 drivers/net/ethernet/ibm/ibmvnic.c | 65 ++
 1 file changed, 13 insertions(+), 52 deletions(-)

diff --git a/drivers/net/ethernet/ibm/ibmvnic.c 
b/drivers/net/ethernet/ibm/ibmvnic.c
index 280358dce8ba..c92615b74833 100644
--- a/drivers/net/ethernet/ibm/ibmvnic.c
+++ b/drivers/net/ethernet/ibm/ibmvnic.c
@@ -104,8 +104,7 @@ static int send_login(struct ibmvnic_adapter *adapter);
 static void send_cap_queries(struct ibmvnic_adapter *adapter);
 static int init_sub_crqs(struct ibmvnic_adapter *);
 static int init_sub_crq_irqs(struct ibmvnic_adapter *adapter);
-static int ibmvnic_init(struct ibmvnic_adapter *);
-static int ibmvnic_reset_init(struct ibmvnic_adapter *);
+static int ibmvnic_reset_init(struct ibmvnic_adapter *, bool reset);
 static void release_crq_queue(struct ibmvnic_adapter *);
 static int __ibmvnic_set_mac(struct net_device *, u8 *);
 static int init_crq_queue(struct ibmvnic_adapter *adapter);
@@ -1868,7 +1867,7 @@ static int do_change_param_reset(struct ibmvnic_adapter 
*adapter,
return rc;
}
 
-   rc = ibmvnic_reset_init(adapter);
+   rc = ibmvnic_reset_init(adapter, true);
if (rc)
return IBMVNIC_INIT_FAILED;
 
@@ -1986,7 +1985,7 @@ static int do_reset(struct ibmvnic_adapter *adapter,
goto out;
}
 
-   rc = ibmvnic_reset_init(adapter);
+   rc = ibmvnic_reset_init(adapter, true);
if (rc) {
rc = IBMVNIC_INIT_FAILED;
goto out;
@@ -2093,7 +2092,7 @@ static int do_hard_reset(struct ibmvnic_adapter *adapter,
return rc;
}
 
-   rc = ibmvnic_init(adapter);
+   rc = ibmvnic_reset_init(adapter, false);
if (rc)
return rc;
 
@@ -4970,7 +4969,7 @@ static int init_crq_queue(struct ibmvnic_adapter *adapter)
return retrc;
 }
 
-static int ibmvnic_reset_init(struct ibmvnic_adapter *adapter)
+static int ibmvnic_reset_init(struct ibmvnic_adapter *adapter, bool reset)
 {
struct device *dev = >vdev->dev;
unsigned long timeout = msecs_to_jiffies(3);
@@ -4979,10 +4978,12 @@ static int ibmvnic_reset_init(struct ibmvnic_adapter 
*adapter)
 
adapter->from_passive_init = false;
 
-   old_num_rx_queues = adapter->req_rx_queues;
-   old_num_tx_queues = adapter->req_tx_queues;
+   if (reset) {
+   old_num_rx_queues = adapter->req_rx_queues;
+   old_num_tx_queues = adapter->req_tx_queues;
+   reinit_completion(>init_done);
+   }
 
-   reinit_completion(>init_done);
adapter->init_done_rc = 0;
rc = ibmvnic_send_crq_init(adapter);
if (rc) {
@@ -5000,7 +5001,8 @@ static int ibmvnic_reset_init(struct ibmvnic_adapter 
*adapter)
return adapter->init_done_rc;
}
 
-   if (test_bit(0, >resetting) && !adapter->wait_for_reset &&
+   if (reset &&
+   test_bit(0, >resetting) && !adapter->wait_for_reset &&
adapter->reset_reason != VNIC_RESET_MOBILITY) {
if (adapter->req_rx_queues != old_num_rx_queues ||
adapter->req_tx_queues != old_num_tx_queues) {
@@ -5028,47 +5030,6 @@ static int ibmvnic_reset_init(struct ibmvnic_adapter 
*adapter)
return rc;
 }
 
-static int ibmvnic_init(struct ibmvnic_adapter *adapter)
-{
-   struct device *dev = >vdev->dev;
-   unsigned long timeout = msecs_to_jiffies(3);
-   int rc;
-
-   adapter->from_passive_init = false;
-
-   adapter->init_done_rc = 0;
-   rc = ibmvnic_send_crq_init(adapter);
-   if (rc) {
-   dev_err(dev, "%s: Send crq init failed with error %d\n", 
__func__, rc);
-   return rc;
-   }
-
-   if (!wait_for_completion_timeout(>init_done, timeout)) {
-   dev_err(dev, "Initialization sequence timed out\n");
-   return -1;
-   }
-
-   if (adapter->init_done_rc) {
-   release_crq_queue(adapter);
-   return adapter->init_done_rc;
-   }
-
-   rc = init_sub_crqs(adapter);
-   if (rc) {
-   dev_err(dev, "Initialization of sub crqs failed\n");
-   release_crq_queue(adapter);
-   return rc;
-   }
-
-   rc = init_sub_crq_irqs(adapter);
-   if (rc) {
-   dev_err(dev, "Failed to initialize sub crq irqs\n");
-   release_crq_queue(adapter);
-   }
-
-   return rc;
-}
-
 static struct device_attribute dev_at

[PATCH net-next 4/5] ibmvnic: remove never executed if statement

2020-08-18 Thread Lijun Pan
At the beginning of the function, from_passive_init is set false by
"adapter->from_passive_init = false;",
hence the if statement will never run.

Signed-off-by: Lijun Pan 
---
 drivers/net/ethernet/ibm/ibmvnic.c | 12 
 1 file changed, 12 deletions(-)

diff --git a/drivers/net/ethernet/ibm/ibmvnic.c 
b/drivers/net/ethernet/ibm/ibmvnic.c
index e366fd42a8c4..280358dce8ba 100644
--- a/drivers/net/ethernet/ibm/ibmvnic.c
+++ b/drivers/net/ethernet/ibm/ibmvnic.c
@@ -5000,12 +5000,6 @@ static int ibmvnic_reset_init(struct ibmvnic_adapter 
*adapter)
return adapter->init_done_rc;
}
 
-   if (adapter->from_passive_init) {
-   adapter->state = VNIC_OPEN;
-   adapter->from_passive_init = false;
-   return -1;
-   }
-
if (test_bit(0, >resetting) && !adapter->wait_for_reset &&
adapter->reset_reason != VNIC_RESET_MOBILITY) {
if (adapter->req_rx_queues != old_num_rx_queues ||
@@ -5059,12 +5053,6 @@ static int ibmvnic_init(struct ibmvnic_adapter *adapter)
return adapter->init_done_rc;
}
 
-   if (adapter->from_passive_init) {
-   adapter->state = VNIC_OPEN;
-   adapter->from_passive_init = false;
-   return -1;
-   }
-
rc = init_sub_crqs(adapter);
if (rc) {
dev_err(dev, "Initialization of sub crqs failed\n");
-- 
2.23.0



[PATCH net-next 3/5] ibmvnic: improve ibmvnic_init and ibmvnic_reset_init

2020-08-18 Thread Lijun Pan
When H_SEND_CRQ command returns with H_CLOSED, it means the
server's CRQ is not ready yet. Instead of resetting immediately,
we wait for the server to launch passive init.
ibmvnic_init() and ibmvnic_reset_init() should also return the
error code from ibmvnic_send_crq_init() call.

Signed-off-by: Lijun Pan 
---
 drivers/net/ethernet/ibm/ibmvnic.c | 17 +
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/ibm/ibmvnic.c 
b/drivers/net/ethernet/ibm/ibmvnic.c
index 50e86e65961e..e366fd42a8c4 100644
--- a/drivers/net/ethernet/ibm/ibmvnic.c
+++ b/drivers/net/ethernet/ibm/ibmvnic.c
@@ -3568,8 +3568,7 @@ static int ibmvnic_send_crq(struct ibmvnic_adapter 
*adapter,
if (rc) {
if (rc == H_CLOSED) {
dev_warn(dev, "CRQ Queue closed\n");
-   if (test_bit(0, >resetting))
-   ibmvnic_reset(adapter, VNIC_RESET_FATAL);
+   /* do not reset, report the fail, wait for passive init 
from server */
}
 
dev_warn(dev, "Send error (rc=%d)\n", rc);
@@ -4985,7 +4984,12 @@ static int ibmvnic_reset_init(struct ibmvnic_adapter 
*adapter)
 
reinit_completion(>init_done);
adapter->init_done_rc = 0;
-   ibmvnic_send_crq_init(adapter);
+   rc = ibmvnic_send_crq_init(adapter);
+   if (rc) {
+   dev_err(dev, "%s: Send crq init failed with error %d\n", 
__func__, rc);
+   return rc;
+   }
+
if (!wait_for_completion_timeout(>init_done, timeout)) {
dev_err(dev, "Initialization sequence timed out\n");
return -1;
@@ -5039,7 +5043,12 @@ static int ibmvnic_init(struct ibmvnic_adapter *adapter)
adapter->from_passive_init = false;
 
adapter->init_done_rc = 0;
-   ibmvnic_send_crq_init(adapter);
+   rc = ibmvnic_send_crq_init(adapter);
+   if (rc) {
+   dev_err(dev, "%s: Send crq init failed with error %d\n", 
__func__, rc);
+   return rc;
+   }
+
if (!wait_for_completion_timeout(>init_done, timeout)) {
dev_err(dev, "Initialization sequence timed out\n");
return -1;
-- 
2.23.0



[PATCH net-next 1/5] ibmvnic: print caller in several error messages

2020-08-18 Thread Lijun Pan
The error messages in the changed functions are exactly the same.
In order to differentiate them and make debugging easier,
we print the function names in the error messages.

Signed-off-by: Lijun Pan 
---
 drivers/net/ethernet/ibm/ibmvnic.c | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ethernet/ibm/ibmvnic.c 
b/drivers/net/ethernet/ibm/ibmvnic.c
index 5afb3c9c52d2..aba1cd9862ac 100644
--- a/drivers/net/ethernet/ibm/ibmvnic.c
+++ b/drivers/net/ethernet/ibm/ibmvnic.c
@@ -1864,7 +1864,7 @@ static int do_change_param_reset(struct ibmvnic_adapter 
*adapter,
 
if (rc) {
netdev_err(adapter->netdev,
-  "Couldn't initialize crq. rc=%d\n", rc);
+  "%s: Couldn't initialize crq. rc=%d\n", __func__, 
rc);
return rc;
}
 
@@ -2089,7 +2089,7 @@ static int do_hard_reset(struct ibmvnic_adapter *adapter,
rc = init_crq_queue(adapter);
if (rc) {
netdev_err(adapter->netdev,
-  "Couldn't initialize crq. rc=%d\n", rc);
+  "%s: Couldn't initialize crq. rc=%d\n", __func__, 
rc);
return rc;
}
 
@@ -2912,7 +2912,7 @@ static struct ibmvnic_sub_crq_queue 
*init_sub_crq_queue(struct ibmvnic_adapter
rc = ibmvnic_reset_crq(adapter);
 
if (rc == H_CLOSED) {
-   dev_warn(dev, "Partner adapter not ready, waiting.\n");
+   dev_warn(dev, "%s: Partner adapter not ready, waiting.\n", 
__func__);
} else if (rc) {
dev_warn(dev, "Error %d registering sub-crq\n", rc);
goto reg_failed;
@@ -4865,7 +4865,7 @@ static int ibmvnic_reset_crq(struct ibmvnic_adapter 
*adapter)
 
if (rc == H_CLOSED)
/* Adapter is good, but other end is not ready */
-   dev_warn(dev, "Partner adapter not ready\n");
+   dev_warn(dev, "%s: Partner adapter not ready\n", __func__);
else if (rc != 0)
dev_warn(dev, "Couldn't register crq (rc=%d)\n", rc);
 
@@ -4926,7 +4926,7 @@ static int init_crq_queue(struct ibmvnic_adapter *adapter)
retrc = rc;
 
if (rc == H_CLOSED) {
-   dev_warn(dev, "Partner adapter not ready\n");
+   dev_warn(dev, "%s: Partner adapter not ready\n", __func__);
} else if (rc) {
dev_warn(dev, "Error %d opening adapter\n", rc);
goto reg_crq_failed;
@@ -5129,8 +5129,8 @@ static int ibmvnic_probe(struct vio_dev *dev, const 
struct vio_device_id *id)
do {
rc = init_crq_queue(adapter);
if (rc) {
-   dev_err(>dev, "Couldn't initialize crq. rc=%d\n",
-   rc);
+   dev_err(>dev, "%s: Couldn't initialize crq. 
rc=%d\n",
+   __func__, rc);
goto ibmvnic_init_fail;
}
 
-- 
2.23.0



[PATCH net-next 2/5] ibmvnic: compare adapter->init_done_rc with more readable ibmvnic_rc_codes

2020-08-18 Thread Lijun Pan
Instead of comparing (adapter->init_done_rc == 1), let it
be (adapter->init_done_rc == PARTIALSUCCESS).

Signed-off-by: Lijun Pan 
---
 drivers/net/ethernet/ibm/ibmvnic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/ibm/ibmvnic.c 
b/drivers/net/ethernet/ibm/ibmvnic.c
index aba1cd9862ac..50e86e65961e 100644
--- a/drivers/net/ethernet/ibm/ibmvnic.c
+++ b/drivers/net/ethernet/ibm/ibmvnic.c
@@ -974,7 +974,7 @@ static int set_link_state(struct ibmvnic_adapter *adapter, 
u8 link_state)
return -1;
}
 
-   if (adapter->init_done_rc == 1) {
+   if (adapter->init_done_rc == PARTIALSUCCESS) {
/* Partuial success, delay and re-send */
mdelay(1000);
resend = true;
-- 
2.23.0



[PATCH net-next 0/5] refactoring of ibmvnic code

2020-08-18 Thread Lijun Pan
This patch series refactor reset_init and init functions,
improve the debugging messages, and make some other cosmetic changes
to make the code easier to read and debug.

Lijun Pan (5):
  ibmvnic: print caller in several error messages
  ibmvnic: compare adapter->init_done_rc with more readable
ibmvnic_rc_codes
  ibmvnic: improve ibmvnic_init and ibmvnic_reset_init
  ibmvnic: remove never executed if statement
  ibmvnic: merge ibmvnic_reset_init and ibmvnic_init

 drivers/net/ethernet/ibm/ibmvnic.c | 98 +-
 1 file changed, 28 insertions(+), 70 deletions(-)

-- 
2.23.0



[PATCH net 5/5] ibmvnic: merge ibmvnic_reset_init and ibmvnic_init

2020-08-14 Thread Lijun Pan
These two functions share the majority of the code, hence merge
them together. In the meanwhile, add a reset pass-in parameter
to differentiate them. Thus, the code is easier to read and to tell
the difference between reset_init and regular init.

Signed-off-by: Lijun Pan 
---
 drivers/net/ethernet/ibm/ibmvnic.c | 65 ++
 1 file changed, 13 insertions(+), 52 deletions(-)

diff --git a/drivers/net/ethernet/ibm/ibmvnic.c 
b/drivers/net/ethernet/ibm/ibmvnic.c
index 280358dce8ba..c92615b74833 100644
--- a/drivers/net/ethernet/ibm/ibmvnic.c
+++ b/drivers/net/ethernet/ibm/ibmvnic.c
@@ -104,8 +104,7 @@ static int send_login(struct ibmvnic_adapter *adapter);
 static void send_cap_queries(struct ibmvnic_adapter *adapter);
 static int init_sub_crqs(struct ibmvnic_adapter *);
 static int init_sub_crq_irqs(struct ibmvnic_adapter *adapter);
-static int ibmvnic_init(struct ibmvnic_adapter *);
-static int ibmvnic_reset_init(struct ibmvnic_adapter *);
+static int ibmvnic_reset_init(struct ibmvnic_adapter *, bool reset);
 static void release_crq_queue(struct ibmvnic_adapter *);
 static int __ibmvnic_set_mac(struct net_device *, u8 *);
 static int init_crq_queue(struct ibmvnic_adapter *adapter);
@@ -1868,7 +1867,7 @@ static int do_change_param_reset(struct ibmvnic_adapter 
*adapter,
return rc;
}
 
-   rc = ibmvnic_reset_init(adapter);
+   rc = ibmvnic_reset_init(adapter, true);
if (rc)
return IBMVNIC_INIT_FAILED;
 
@@ -1986,7 +1985,7 @@ static int do_reset(struct ibmvnic_adapter *adapter,
goto out;
}
 
-   rc = ibmvnic_reset_init(adapter);
+   rc = ibmvnic_reset_init(adapter, true);
if (rc) {
rc = IBMVNIC_INIT_FAILED;
goto out;
@@ -2093,7 +2092,7 @@ static int do_hard_reset(struct ibmvnic_adapter *adapter,
return rc;
}
 
-   rc = ibmvnic_init(adapter);
+   rc = ibmvnic_reset_init(adapter, false);
if (rc)
return rc;
 
@@ -4970,7 +4969,7 @@ static int init_crq_queue(struct ibmvnic_adapter *adapter)
return retrc;
 }
 
-static int ibmvnic_reset_init(struct ibmvnic_adapter *adapter)
+static int ibmvnic_reset_init(struct ibmvnic_adapter *adapter, bool reset)
 {
struct device *dev = >vdev->dev;
unsigned long timeout = msecs_to_jiffies(3);
@@ -4979,10 +4978,12 @@ static int ibmvnic_reset_init(struct ibmvnic_adapter 
*adapter)
 
adapter->from_passive_init = false;
 
-   old_num_rx_queues = adapter->req_rx_queues;
-   old_num_tx_queues = adapter->req_tx_queues;
+   if (reset) {
+   old_num_rx_queues = adapter->req_rx_queues;
+   old_num_tx_queues = adapter->req_tx_queues;
+   reinit_completion(>init_done);
+   }
 
-   reinit_completion(>init_done);
adapter->init_done_rc = 0;
rc = ibmvnic_send_crq_init(adapter);
if (rc) {
@@ -5000,7 +5001,8 @@ static int ibmvnic_reset_init(struct ibmvnic_adapter 
*adapter)
return adapter->init_done_rc;
}
 
-   if (test_bit(0, >resetting) && !adapter->wait_for_reset &&
+   if (reset &&
+   test_bit(0, >resetting) && !adapter->wait_for_reset &&
adapter->reset_reason != VNIC_RESET_MOBILITY) {
if (adapter->req_rx_queues != old_num_rx_queues ||
adapter->req_tx_queues != old_num_tx_queues) {
@@ -5028,47 +5030,6 @@ static int ibmvnic_reset_init(struct ibmvnic_adapter 
*adapter)
return rc;
 }
 
-static int ibmvnic_init(struct ibmvnic_adapter *adapter)
-{
-   struct device *dev = >vdev->dev;
-   unsigned long timeout = msecs_to_jiffies(3);
-   int rc;
-
-   adapter->from_passive_init = false;
-
-   adapter->init_done_rc = 0;
-   rc = ibmvnic_send_crq_init(adapter);
-   if (rc) {
-   dev_err(dev, "%s: Send crq init failed with error %d\n", 
__func__, rc);
-   return rc;
-   }
-
-   if (!wait_for_completion_timeout(>init_done, timeout)) {
-   dev_err(dev, "Initialization sequence timed out\n");
-   return -1;
-   }
-
-   if (adapter->init_done_rc) {
-   release_crq_queue(adapter);
-   return adapter->init_done_rc;
-   }
-
-   rc = init_sub_crqs(adapter);
-   if (rc) {
-   dev_err(dev, "Initialization of sub crqs failed\n");
-   release_crq_queue(adapter);
-   return rc;
-   }
-
-   rc = init_sub_crq_irqs(adapter);
-   if (rc) {
-   dev_err(dev, "Failed to initialize sub crq irqs\n");
-   release_crq_queue(adapter);
-   }
-
-   return rc;
-}
-
 static struct device_attribute dev_at

[PATCH net 0/5] refactoring of ibmvnic code

2020-08-14 Thread Lijun Pan
This patch series refactor reset_init and init functions,
improve the debugging messages, and make some other cosmetic changes
to make the code easier to read and debug.

Lijun Pan (5):
  ibmvnic: print caller in several error messages
  ibmvnic: compare adapter->init_done_rc with more readable
ibmvnic_rc_codes
  ibmvnic: improve ibmvnic_init and ibmvnic_reset_init
  ibmvnic: remove never executed if statement
  ibmvnic: merge ibmvnic_reset_init and ibmvnic_init

 drivers/net/ethernet/ibm/ibmvnic.c | 98 +-
 1 file changed, 28 insertions(+), 70 deletions(-)

-- 
2.23.0



[PATCH net 4/5] ibmvnic: remove never executed if statement

2020-08-14 Thread Lijun Pan
At the beginning of the function, from_passive_init is set false by
"adapter->from_passive_init = false;",
hence the if statement will never run.

Signed-off-by: Lijun Pan 
---
 drivers/net/ethernet/ibm/ibmvnic.c | 12 
 1 file changed, 12 deletions(-)

diff --git a/drivers/net/ethernet/ibm/ibmvnic.c 
b/drivers/net/ethernet/ibm/ibmvnic.c
index e366fd42a8c4..280358dce8ba 100644
--- a/drivers/net/ethernet/ibm/ibmvnic.c
+++ b/drivers/net/ethernet/ibm/ibmvnic.c
@@ -5000,12 +5000,6 @@ static int ibmvnic_reset_init(struct ibmvnic_adapter 
*adapter)
return adapter->init_done_rc;
}
 
-   if (adapter->from_passive_init) {
-   adapter->state = VNIC_OPEN;
-   adapter->from_passive_init = false;
-   return -1;
-   }
-
if (test_bit(0, >resetting) && !adapter->wait_for_reset &&
adapter->reset_reason != VNIC_RESET_MOBILITY) {
if (adapter->req_rx_queues != old_num_rx_queues ||
@@ -5059,12 +5053,6 @@ static int ibmvnic_init(struct ibmvnic_adapter *adapter)
return adapter->init_done_rc;
}
 
-   if (adapter->from_passive_init) {
-   adapter->state = VNIC_OPEN;
-   adapter->from_passive_init = false;
-   return -1;
-   }
-
rc = init_sub_crqs(adapter);
if (rc) {
dev_err(dev, "Initialization of sub crqs failed\n");
-- 
2.23.0



[PATCH net 2/5] ibmvnic: compare adapter->init_done_rc with more readable ibmvnic_rc_codes

2020-08-14 Thread Lijun Pan
Instead of comparing (adapter->init_done_rc == 1), let it
be (adapter->init_done_rc == PARTIALSUCCESS).

Signed-off-by: Lijun Pan 
---
 drivers/net/ethernet/ibm/ibmvnic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/ibm/ibmvnic.c 
b/drivers/net/ethernet/ibm/ibmvnic.c
index aba1cd9862ac..50e86e65961e 100644
--- a/drivers/net/ethernet/ibm/ibmvnic.c
+++ b/drivers/net/ethernet/ibm/ibmvnic.c
@@ -974,7 +974,7 @@ static int set_link_state(struct ibmvnic_adapter *adapter, 
u8 link_state)
return -1;
}
 
-   if (adapter->init_done_rc == 1) {
+   if (adapter->init_done_rc == PARTIALSUCCESS) {
/* Partuial success, delay and re-send */
mdelay(1000);
resend = true;
-- 
2.23.0



[PATCH net 3/5] ibmvnic: improve ibmvnic_init and ibmvnic_reset_init

2020-08-14 Thread Lijun Pan
When H_SEND_CRQ command returns with H_CLOSED, it means the
server's CRQ is not ready yet. Instead of resetting immediately,
we wait for the server to launch passive init.
ibmvnic_init() and ibmvnic_reset_init() should also return the
error code from ibmvnic_send_crq_init() call.

Signed-off-by: Lijun Pan 
---
 drivers/net/ethernet/ibm/ibmvnic.c | 17 +
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/ibm/ibmvnic.c 
b/drivers/net/ethernet/ibm/ibmvnic.c
index 50e86e65961e..e366fd42a8c4 100644
--- a/drivers/net/ethernet/ibm/ibmvnic.c
+++ b/drivers/net/ethernet/ibm/ibmvnic.c
@@ -3568,8 +3568,7 @@ static int ibmvnic_send_crq(struct ibmvnic_adapter 
*adapter,
if (rc) {
if (rc == H_CLOSED) {
dev_warn(dev, "CRQ Queue closed\n");
-   if (test_bit(0, >resetting))
-   ibmvnic_reset(adapter, VNIC_RESET_FATAL);
+   /* do not reset, report the fail, wait for passive init 
from server */
}
 
dev_warn(dev, "Send error (rc=%d)\n", rc);
@@ -4985,7 +4984,12 @@ static int ibmvnic_reset_init(struct ibmvnic_adapter 
*adapter)
 
reinit_completion(>init_done);
adapter->init_done_rc = 0;
-   ibmvnic_send_crq_init(adapter);
+   rc = ibmvnic_send_crq_init(adapter);
+   if (rc) {
+   dev_err(dev, "%s: Send crq init failed with error %d\n", 
__func__, rc);
+   return rc;
+   }
+
if (!wait_for_completion_timeout(>init_done, timeout)) {
dev_err(dev, "Initialization sequence timed out\n");
return -1;
@@ -5039,7 +5043,12 @@ static int ibmvnic_init(struct ibmvnic_adapter *adapter)
adapter->from_passive_init = false;
 
adapter->init_done_rc = 0;
-   ibmvnic_send_crq_init(adapter);
+   rc = ibmvnic_send_crq_init(adapter);
+   if (rc) {
+   dev_err(dev, "%s: Send crq init failed with error %d\n", 
__func__, rc);
+   return rc;
+   }
+
if (!wait_for_completion_timeout(>init_done, timeout)) {
dev_err(dev, "Initialization sequence timed out\n");
return -1;
-- 
2.23.0



[PATCH net 1/5] ibmvnic: print caller in several error messages

2020-08-14 Thread Lijun Pan
The error messages in the changed functions are exactly the same.
In order to differentiate them and make debugging easier,
we print the function names in the error messages.

Signed-off-by: Lijun Pan 
---
 drivers/net/ethernet/ibm/ibmvnic.c | 14 +++---
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/net/ethernet/ibm/ibmvnic.c 
b/drivers/net/ethernet/ibm/ibmvnic.c
index 5afb3c9c52d2..aba1cd9862ac 100644
--- a/drivers/net/ethernet/ibm/ibmvnic.c
+++ b/drivers/net/ethernet/ibm/ibmvnic.c
@@ -1864,7 +1864,7 @@ static int do_change_param_reset(struct ibmvnic_adapter 
*adapter,
 
if (rc) {
netdev_err(adapter->netdev,
-  "Couldn't initialize crq. rc=%d\n", rc);
+  "%s: Couldn't initialize crq. rc=%d\n", __func__, 
rc);
return rc;
}
 
@@ -2089,7 +2089,7 @@ static int do_hard_reset(struct ibmvnic_adapter *adapter,
rc = init_crq_queue(adapter);
if (rc) {
netdev_err(adapter->netdev,
-  "Couldn't initialize crq. rc=%d\n", rc);
+  "%s: Couldn't initialize crq. rc=%d\n", __func__, 
rc);
return rc;
}
 
@@ -2912,7 +2912,7 @@ static struct ibmvnic_sub_crq_queue 
*init_sub_crq_queue(struct ibmvnic_adapter
rc = ibmvnic_reset_crq(adapter);
 
if (rc == H_CLOSED) {
-   dev_warn(dev, "Partner adapter not ready, waiting.\n");
+   dev_warn(dev, "%s: Partner adapter not ready, waiting.\n", 
__func__);
} else if (rc) {
dev_warn(dev, "Error %d registering sub-crq\n", rc);
goto reg_failed;
@@ -4865,7 +4865,7 @@ static int ibmvnic_reset_crq(struct ibmvnic_adapter 
*adapter)
 
if (rc == H_CLOSED)
/* Adapter is good, but other end is not ready */
-   dev_warn(dev, "Partner adapter not ready\n");
+   dev_warn(dev, "%s: Partner adapter not ready\n", __func__);
else if (rc != 0)
dev_warn(dev, "Couldn't register crq (rc=%d)\n", rc);
 
@@ -4926,7 +4926,7 @@ static int init_crq_queue(struct ibmvnic_adapter *adapter)
retrc = rc;
 
if (rc == H_CLOSED) {
-   dev_warn(dev, "Partner adapter not ready\n");
+   dev_warn(dev, "%s: Partner adapter not ready\n", __func__);
} else if (rc) {
dev_warn(dev, "Error %d opening adapter\n", rc);
goto reg_crq_failed;
@@ -5129,8 +5129,8 @@ static int ibmvnic_probe(struct vio_dev *dev, const 
struct vio_device_id *id)
do {
rc = init_crq_queue(adapter);
if (rc) {
-   dev_err(>dev, "Couldn't initialize crq. rc=%d\n",
-   rc);
+   dev_err(>dev, "%s: Couldn't initialize crq. 
rc=%d\n",
+   __func__, rc);
goto ibmvnic_init_fail;
}
 
-- 
2.23.0



Re: [PATCH v2 1/2] KVM: PPC: Book3S HV: XIVE: Free previous EQ page when setting up a new one

2019-11-20 Thread Lijun Pan


> On Nov 13, 2019, at 10:46 AM, Greg Kurz  wrote:
> 
> The EQ page is allocated by the guest and then passed to the hypervisor
> with the H_INT_SET_QUEUE_CONFIG hcall. A reference is taken on the page
> before handing it over to the HW. This reference is dropped either when
> the guest issues the H_INT_RESET hcall or when the KVM device is released.
> But, the guest can legitimately call H_INT_SET_QUEUE_CONFIG several times,
> either to reset the EQ (vCPU hot unplug) or to set a new EQ (guest reboot).
> In both cases the existing EQ page reference is leaked because we simply
> overwrite it in the XIVE queue structure without calling put_page().
> 
> This is especially visible when the guest memory is backed with huge pages:
> start a VM up to the guest userspace, either reboot it or unplug a vCPU,
> quit QEMU. The leak is observed by comparing the value of HugePages_Free in
> /proc/meminfo before and after the VM is run.
> 
> Ideally we'd want the XIVE code to handle the EQ page de-allocation at the
> platform level. This isn't the case right now because the various XIVE
> drivers have different allocation needs. It could maybe worth introducing
> hooks for this purpose instead of exposing XIVE internals to the drivers,
> but this is certainly a huge work to be done later.
> 
> In the meantime, for easier backport, fix both vCPU unplug and guest reboot
> leaks by introducing a wrapper around xive_native_configure_queue() that
> does the necessary cleanup.
> 
> Reported-by: Satheesh Rajendran 
> Cc: sta...@vger.kernel.org # v5.2
> Fixes: 13ce3297c576 ("KVM: PPC: Book3S HV: XIVE: Add controls for the EQ 
> configuration")
> Signed-off-by: Cédric Le Goater 
> Signed-off-by: Greg Kurz 

Tested-by: Lijun Pan mailto:l...@linux.ibm>.com>

> ---
> v2: use wrapper as suggested by Cedric
> ---
> arch/powerpc/kvm/book3s_xive_native.c |   31 ++-
> 1 file changed, 22 insertions(+), 9 deletions(-)
> 
> diff --git a/arch/powerpc/kvm/book3s_xive_native.c 
> b/arch/powerpc/kvm/book3s_xive_native.c
> index 34bd123fa024..0e1fc5a16729 100644
> --- a/arch/powerpc/kvm/book3s_xive_native.c
> +++ b/arch/powerpc/kvm/book3s_xive_native.c
> @@ -50,6 +50,24 @@ static void kvmppc_xive_native_cleanup_queue(struct 
> kvm_vcpu *vcpu, int prio)
>   }
> }
> 
> +static int kvmppc_xive_native_configure_queue(u32 vp_id, struct xive_q *q,
> +   u8 prio, __be32 *qpage,
> +   u32 order, bool can_escalate)
> +{
> + int rc;
> + __be32 *qpage_prev = q->qpage;
> +
> + rc = xive_native_configure_queue(vp_id, q, prio, qpage, order,
> +  can_escalate);
> + if (rc)
> + return rc;
> +
> + if (qpage_prev)
> + put_page(virt_to_page(qpage_prev));
> +
> + return rc;
> +}
> +
> void kvmppc_xive_native_cleanup_vcpu(struct kvm_vcpu *vcpu)
> {
>   struct kvmppc_xive_vcpu *xc = vcpu->arch.xive_vcpu;
> @@ -575,19 +593,14 @@ static int kvmppc_xive_native_set_queue_config(struct 
> kvmppc_xive *xive,
>   q->guest_qaddr  = 0;
>   q->guest_qshift = 0;
> 
> - rc = xive_native_configure_queue(xc->vp_id, q, priority,
> -  NULL, 0, true);
> + rc = kvmppc_xive_native_configure_queue(xc->vp_id, q, priority,
> + NULL, 0, true);
>   if (rc) {
>   pr_err("Failed to reset queue %d for VCPU %d: %d\n",
>  priority, xc->server_num, rc);
>   return rc;
>   }
> 
> - if (q->qpage) {
> - put_page(virt_to_page(q->qpage));
> - q->qpage = NULL;
> - }
> -
>   return 0;
>   }
> 
> @@ -646,8 +659,8 @@ static int kvmppc_xive_native_set_queue_config(struct 
> kvmppc_xive *xive,
> * OPAL level because the use of END ESBs is not supported by
> * Linux.
> */
> - rc = xive_native_configure_queue(xc->vp_id, q, priority,
> -  (__be32 *) qaddr, kvm_eq.qshift, true);
> + rc = kvmppc_xive_native_configure_queue(xc->vp_id, q, priority,
> + (__be32 *) qaddr, kvm_eq.qshift, true);
>   if (rc) {
>   pr_err("Failed to configure queue %d for VCPU %d: %d\n",
>  priority, xc->server_num, rc);
> 



Re: [PATCH v2 1/2] KVM: PPC: Book3S HV: XIVE: Free previous EQ page when setting up a new one

2019-11-20 Thread Lijun Pan



> On Nov 13, 2019, at 10:46 AM, Greg Kurz  wrote:
> 
> The EQ page is allocated by the guest and then passed to the hypervisor
> with the H_INT_SET_QUEUE_CONFIG hcall. A reference is taken on the page
> before handing it over to the HW. This reference is dropped either when
> the guest issues the H_INT_RESET hcall or when the KVM device is released.
> But, the guest can legitimately call H_INT_SET_QUEUE_CONFIG several times,
> either to reset the EQ (vCPU hot unplug) or to set a new EQ (guest reboot).
> In both cases the existing EQ page reference is leaked because we simply
> overwrite it in the XIVE queue structure without calling put_page().
> 
> This is especially visible when the guest memory is backed with huge pages:
> start a VM up to the guest userspace, either reboot it or unplug a vCPU,
> quit QEMU. The leak is observed by comparing the value of HugePages_Free in
> /proc/meminfo before and after the VM is run.
> 
> Ideally we'd want the XIVE code to handle the EQ page de-allocation at the
> platform level. This isn't the case right now because the various XIVE
> drivers have different allocation needs. It could maybe worth introducing
> hooks for this purpose instead of exposing XIVE internals to the drivers,
> but this is certainly a huge work to be done later.
> 
> In the meantime, for easier backport, fix both vCPU unplug and guest reboot
> leaks by introducing a wrapper around xive_native_configure_queue() that
> does the necessary cleanup.
> 
> Reported-by: Satheesh Rajendran 
> Cc: sta...@vger.kernel.org # v5.2
> Fixes: 13ce3297c576 ("KVM: PPC: Book3S HV: XIVE: Add controls for the EQ 
> configuration")
> Signed-off-by: Cédric Le Goater 
> Signed-off-by: Greg Kurz 

Tested-by: Lijun Pan 

> ---
> v2: use wrapper as suggested by Cedric
> ---
> arch/powerpc/kvm/book3s_xive_native.c |   31 ++-
> 1 file changed, 22 insertions(+), 9 deletions(-)
> 
> diff --git a/arch/powerpc/kvm/book3s_xive_native.c 
> b/arch/powerpc/kvm/book3s_xive_native.c
> index 34bd123fa024..0e1fc5a16729 100644
> --- a/arch/powerpc/kvm/book3s_xive_native.c
> +++ b/arch/powerpc/kvm/book3s_xive_native.c
> @@ -50,6 +50,24 @@ static void kvmppc_xive_native_cleanup_queue(struct 
> kvm_vcpu *vcpu, int prio)
>   }
> }
> 
> +static int kvmppc_xive_native_configure_queue(u32 vp_id, struct xive_q *q,
> +   u8 prio, __be32 *qpage,
> +   u32 order, bool can_escalate)
> +{
> + int rc;
> + __be32 *qpage_prev = q->qpage;
> +
> + rc = xive_native_configure_queue(vp_id, q, prio, qpage, order,
> +  can_escalate);
> + if (rc)
> + return rc;
> +
> + if (qpage_prev)
> + put_page(virt_to_page(qpage_prev));
> +
> + return rc;
> +}
> +
> void kvmppc_xive_native_cleanup_vcpu(struct kvm_vcpu *vcpu)
> {
>   struct kvmppc_xive_vcpu *xc = vcpu->arch.xive_vcpu;
> @@ -575,19 +593,14 @@ static int kvmppc_xive_native_set_queue_config(struct 
> kvmppc_xive *xive,
>   q->guest_qaddr  = 0;
>   q->guest_qshift = 0;
> 
> - rc = xive_native_configure_queue(xc->vp_id, q, priority,
> -  NULL, 0, true);
> + rc = kvmppc_xive_native_configure_queue(xc->vp_id, q, priority,
> + NULL, 0, true);
>   if (rc) {
>   pr_err("Failed to reset queue %d for VCPU %d: %d\n",
>  priority, xc->server_num, rc);
>   return rc;
>   }
> 
> - if (q->qpage) {
> - put_page(virt_to_page(q->qpage));
> - q->qpage = NULL;
> - }
> -
>   return 0;
>   }
> 
> @@ -646,8 +659,8 @@ static int kvmppc_xive_native_set_queue_config(struct 
> kvmppc_xive *xive,
> * OPAL level because the use of END ESBs is not supported by
> * Linux.
> */
> - rc = xive_native_configure_queue(xc->vp_id, q, priority,
> -  (__be32 *) qaddr, kvm_eq.qshift, true);
> + rc = kvmppc_xive_native_configure_queue(xc->vp_id, q, priority,
> + (__be32 *) qaddr, kvm_eq.qshift, true);
>   if (rc) {
>   pr_err("Failed to configure queue %d for VCPU %d: %d\n",
>  priority, xc->server_num, rc);
> 



[RFC] powerpc/pseries/hcall: remove the save/restore of CR

2019-09-26 Thread Lijun Pan
According to the PAPR, hcalls should not modify the Condition
Register fields, hence save/restore the CR is not necessary.

Signed-off-by: Lijun Pan 
---
 arch/powerpc/platforms/pseries/hvCall.S | 36 -
 1 file changed, 36 deletions(-)

diff --git a/arch/powerpc/platforms/pseries/hvCall.S 
b/arch/powerpc/platforms/pseries/hvCall.S
index 2136e42833af..b26a79331994 100644
--- a/arch/powerpc/platforms/pseries/hvCall.S
+++ b/arch/powerpc/platforms/pseries/hvCall.S
@@ -105,13 +105,9 @@ END_FTR_SECTION(0, 1); 
\
 _GLOBAL_TOC(plpar_hcall_norets)
HMT_MEDIUM
 
-   mfcrr0
-   stw r0,8(r1)
HCALL_BRANCH(plpar_hcall_norets_trace)
HVSC/* invoke the hypervisor */
 
-   lwz r0,8(r1)
-   mtcrf   0xff,r0
blr /* return r3 = status */
 
 #ifdef CONFIG_TRACEPOINTS
@@ -119,17 +115,12 @@ plpar_hcall_norets_trace:
HCALL_INST_PRECALL(R4)
HVSC
HCALL_INST_POSTCALL_NORETS
-   lwz r0,8(r1)
-   mtcrf   0xff,r0
blr
 #endif
 
 _GLOBAL_TOC(plpar_hcall)
HMT_MEDIUM
 
-   mfcrr0
-   stw r0,8(r1)
-
HCALL_BRANCH(plpar_hcall_trace)
 
std r4,STK_PARAM(R4)(r1) /* Save ret buffer */
@@ -149,9 +140,6 @@ _GLOBAL_TOC(plpar_hcall)
std r6, 16(r12)
std r7, 24(r12)
 
-   lwz r0,8(r1)
-   mtcrf   0xff,r0
-
blr /* return r3 = status */
 
 #ifdef CONFIG_TRACEPOINTS
@@ -178,9 +166,6 @@ plpar_hcall_trace:
 
HCALL_INST_POSTCALL(r12)
 
-   lwz r0,8(r1)
-   mtcrf   0xff,r0
-
blr
 #endif
 
@@ -193,9 +178,6 @@ plpar_hcall_trace:
 _GLOBAL(plpar_hcall_raw)
HMT_MEDIUM
 
-   mfcrr0
-   stw r0,8(r1)
-
std r4,STK_PARAM(R4)(r1) /* Save ret buffer */
 
mr  r4,r5
@@ -213,17 +195,11 @@ _GLOBAL(plpar_hcall_raw)
std r6, 16(r12)
std r7, 24(r12)
 
-   lwz r0,8(r1)
-   mtcrf   0xff,r0
-
blr /* return r3 = status */
 
 _GLOBAL_TOC(plpar_hcall9)
HMT_MEDIUM
 
-   mfcrr0
-   stw r0,8(r1)
-
HCALL_BRANCH(plpar_hcall9_trace)
 
std r4,STK_PARAM(R4)(r1) /* Save ret buffer */
@@ -252,9 +228,6 @@ _GLOBAL_TOC(plpar_hcall9)
std r11,56(r12)
std r0, 64(r12)
 
-   lwz r0,8(r1)
-   mtcrf   0xff,r0
-
blr /* return r3 = status */
 
 #ifdef CONFIG_TRACEPOINTS
@@ -290,9 +263,6 @@ plpar_hcall9_trace:
 
HCALL_INST_POSTCALL(r12)
 
-   lwz r0,8(r1)
-   mtcrf   0xff,r0
-
blr
 #endif
 
@@ -300,9 +270,6 @@ plpar_hcall9_trace:
 _GLOBAL(plpar_hcall9_raw)
HMT_MEDIUM
 
-   mfcrr0
-   stw r0,8(r1)
-
std r4,STK_PARAM(R4)(r1) /* Save ret buffer */
 
mr  r4,r5
@@ -329,7 +296,4 @@ _GLOBAL(plpar_hcall9_raw)
std r11,56(r12)
std r0, 64(r12)
 
-   lwz r0,8(r1)
-   mtcrf   0xff,r0
-
blr /* return r3 = status */
-- 
2.22.0



Re: [PATCH 2/2] powerpc/xive: Implement get_irqchip_state method for XIVE to fix shutdown race

2019-08-12 Thread Lijun Pan



> On Aug 12, 2019, at 12:07 AM, Paul Mackerras  wrote:
> 
> ---
> arch/powerpc/include/asm/xive.h   |  8 
> arch/powerpc/kvm/book3s_xive.c| 31 ++
> arch/powerpc/sysdev/xive/common.c | 87 ---
> 3 files changed, 103 insertions(+), 23 deletions(-)
> 
> diff --git a/arch/powerpc/include/asm/xive.h b/arch/powerpc/include/asm/xive.h
> index e4016985764e..efb0e597b272 100644
> --- a/arch/powerpc/include/asm/xive.h
> +++ b/arch/powerpc/include/asm/xive.h
> @@ -46,7 +46,15 @@ struct xive_irq_data {
> 
>   /* Setup/used by frontend */
>   int target;
> + /*
> +  * saved_p means that there is a queue entry for this interrupt
> +  * in some CPU's queue (not including guest vcpu queues), even
> +  * if P is not set in the source ESB.
> +  * stale_p means that there is no queue entry for this interrupt
> +  * in some CPU's queue, even if P is set in the source ESB.
> +  */
>   bool saved_p;
> + bool stale_p;
> };
> #define XIVE_IRQ_FLAG_STORE_EOI   0x01
> #define XIVE_IRQ_FLAG_LSI 0x02
> diff --git a/arch/powerpc/kvm/book3s_xive.c b/arch/powerpc/kvm/book3s_xive.c
> index 09f838aa3138..74eea009c095 100644
> --- a/arch/powerpc/kvm/book3s_xive.c
> +++ b/arch/powerpc/kvm/book3s_xive.c
> @@ -160,6 +160,9 @@ static irqreturn_t xive_esc_irq(int irq, void *data)
>*/
>   vcpu->arch.xive_esc_on = false;
> 
> + /* This orders xive_esc_on = false vs. subsequent stale_p = true */
> + smp_wmb();  /* goes with smp_mb() in cleanup_single_escalation */
> +
>   return IRQ_HANDLED;
> }
> 
> @@ -1113,6 +1116,31 @@ void kvmppc_xive_disable_vcpu_interrupts(struct 
> kvm_vcpu *vcpu)
>   vcpu->arch.xive_esc_raddr = 0;
> }
> 
> +/*
> + * In single escalation mode, the escalation interrupt is marked so
> + * that EOI doesn't re-enable it, but just sets the stale_p flag to
> + * indicate that the P bit has already been dealt with.  However, the
> + * assembly code that enters the guest sets PQ to 00 without clearing
> + * stale_p (because it has no easy way to address it).  Hence we have
> + * to adjust stale_p before shutting down the interrupt.
> + */
> +static void cleanup_single_escalation(struct kvm_vcpu *vcpu,
> +   struct kvmppc_xive_vcpu *xc, int irq)
> +{
> + struct irq_data *d = irq_get_irq_data(irq);
> + struct xive_irq_data *xd = irq_data_get_irq_handler_data(d);
> +
> + /*
> +  * This slightly odd sequence gives the right result
> +  * (i.e. stale_p set if xive_esc_on is false) even if
> +  * we race with xive_esc_irq() and xive_irq_eoi().
> +  */

Hi Paul,

I don’t quite understand the logic here.
Are you saying the code sequence is
vcpu->arch.xive_esc_on = false; (xive_esc_irq)
then
xd->stale_p = true; (cleanup_single_escaltion)

> + xd->stale_p = false;
> + smp_mb();   /* paired with smb_wmb in xive_esc_irq */
> + if (!vcpu->arch.xive_esc_on)
> + xd->stale_p = true;
> +}
> +
> void kvmppc_xive_cleanup_vcpu(struct kvm_vcpu *vcpu)
> {
>   struct kvmppc_xive_vcpu *xc = vcpu->arch.xive_vcpu;
> @@ -1137,6 +1165,9 @@ void kvmppc_xive_cleanup_vcpu(struct kvm_vcpu *vcpu)
>   /* Free escalations */
>   for (i = 0; i < KVMPPC_XIVE_Q_COUNT; i++) {
>   if (xc->esc_virq[i]) {
> + if (xc->xive->single_escalation)
> + cleanup_single_escalation(vcpu, xc,
> +   xc->esc_virq[i]);
>   free_irq(xc->esc_virq[i], vcpu);
>   irq_dispose_mapping(xc->esc_virq[i]);
>   kfree(xc->esc_virq_names[i]);
> diff --git a/arch/powerpc/sysdev/xive/common.c 
> b/arch/powerpc/sysdev/xive/common.c
> index 1cdb39575eae..be86fce1a84e 100644
> --- a/arch/powerpc/sysdev/xive/common.c
> +++ b/arch/powerpc/sysdev/xive/common.c
> @@ -135,7 +135,7 @@ static u32 xive_read_eq(struct xive_q *q, bool just_peek)
> static u32 xive_scan_interrupts(struct xive_cpu *xc, bool just_peek)
> {
>   u32 irq = 0;
> - u8 prio;
> + u8 prio = 0;
> 
>   /* Find highest pending priority */
>   while (xc->pending_prio != 0) {
> @@ -148,8 +148,19 @@ static u32 xive_scan_interrupts(struct xive_cpu *xc, 
> bool just_peek)
>   irq = xive_read_eq(>queue[prio], just_peek);
> 
>   /* Found something ? That's it */
> - if (irq)
> - break;
> + if (irq) {
> + if (just_peek || irq_to_desc(irq))
> + break;
> + /*
> +  * We should never get here; if we do then we must
> +  * have failed to synchronize the interrupt properly
> +  * when shutting it down.
> +  */
> + pr_crit("xive: got interrupt %d without descriptor, 
> dropping\n",
> +  

[PATCH v4] powerpc/defconfig: new way of writing defconfig

2015-06-12 Thread Lijun Pan
It is always a headache dealing with different defconfigs
though they only differ in a few places. Hence we are proposing a new
way of writing the defconfig:
1. Define a basic defconfig say mpc85xx_basic_defconfig
2. Spin off as much features as possible from the current mpc85xx_defconfig
and create a separate config file, say, smp.config, kvm_500.config
Every time we add a new feature, we don't need to change several
defconfigs, we just add a new *.config
And you could merge any fragments you want into .config with the
current kconfig in Kernel.

With the new rules added into arch/powerpc/Makefile,
you can make it like before, e.g.
make mpc85xx_smp_defconfig

In order to keep the final .config the same as before,
we must first merge all the fragments (without make) repeatedly,
and at last do make only once.

The make steps below will generate a different .config as above.
We should not take the following steps.
e.g.
make mpc85xx_basic_defconfig
make smp.config
make kvm_guest.config

Signed-off-by: Lijun Pan lijun@freescale.com
---
v4 changes:
 1. removed many fragments according to the review feedback in v3
 2. I cannot reuse the code in http://patchwork.ozlabs.org/patch/476345/ 
since I have multiple fragments to merge while the that patch only
has one fragment.

v3 changes:
 http://patchwork.ozlabs.org/patch/471126/

 arch/powerpc/Makefile  |  34 +++
 arch/powerpc/configs/altivec.config|   1 +
 arch/powerpc/configs/book3e-64.config  |   2 +
 arch/powerpc/configs/corenet32_misc.config |  35 +++
 arch/powerpc/configs/corenet32_smp_defconfig   | 185 ---
 arch/powerpc/configs/corenet64_misc.config |  16 ++
 ...net64_smp_defconfig = corenet_basic_defconfig} |  29 +--
 arch/powerpc/configs/dma.config|   2 +
 arch/powerpc/configs/kvm_guest.config  |   2 +
 arch/powerpc/configs/math_emulation.config |   2 +
 arch/powerpc/configs/mpc85xx.config|   1 +
 ...c85xx_smp_defconfig = mpc85xx_basic_defconfig} |   8 +-
 arch/powerpc/configs/mpc85xx_defconfig | 252 -
 arch/powerpc/configs/mpc85xx_misc.config   |  11 +
 arch/powerpc/configs/non-hardware.config   |   4 +
 arch/powerpc/configs/smp.config|   1 +
 16 files changed, 116 insertions(+), 469 deletions(-)
 create mode 100644 arch/powerpc/configs/altivec.config
 create mode 100644 arch/powerpc/configs/book3e-64.config
 create mode 100644 arch/powerpc/configs/corenet32_misc.config
 delete mode 100644 arch/powerpc/configs/corenet32_smp_defconfig
 create mode 100644 arch/powerpc/configs/corenet64_misc.config
 rename arch/powerpc/configs/{corenet64_smp_defconfig = 
corenet_basic_defconfig} (84%)
 create mode 100644 arch/powerpc/configs/dma.config
 create mode 100644 arch/powerpc/configs/kvm_guest.config
 create mode 100644 arch/powerpc/configs/math_emulation.config
 create mode 100644 arch/powerpc/configs/mpc85xx.config
 rename arch/powerpc/configs/{mpc85xx_smp_defconfig = mpc85xx_basic_defconfig} 
(98%)
 delete mode 100644 arch/powerpc/configs/mpc85xx_defconfig
 create mode 100644 arch/powerpc/configs/mpc85xx_misc.config
 create mode 100644 arch/powerpc/configs/non-hardware.config
 create mode 100644 arch/powerpc/configs/smp.config

diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index fc502e0..40b6a81 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -269,6 +269,40 @@ bootwrapper_install:
 %.dtb: scripts
$(Q)$(MAKE) ARCH=ppc64 $(build)=$(boot) $(patsubst %,$(boot)/%,$@)
 
+configfiles=$(wildcard $(srctree)/kernel/configs/$(1).config 
$(srctree)/arch/$(SRCARCH)/configs/$(1).config)
+
+define mergeconfig
+$(Q)$(CONFIG_SHELL) $(srctree)/scripts/kconfig/merge_config.sh -m -O 
$(objtree) $(srctree)/.config $(call configfiles,$(1))
+endef
+
+PHONY += mpc85xx_defconfig mpc85xx_smp_defconfig corenet32_smp_defconfig 
corenet64_smp_defconfig
+mpc85xx_defconfig:
+   $(Q)cp $(srctree)/arch/$(SRCARCH)/configs/mpc85xx_basic_defconfig 
$(srctree)/.config
+   $(call mergeconfig,mpc85xx_misc)
+   $(Q)$(MAKE) -f $(srctree)/Makefile olddefconfig
+
+mpc85xx_smp_defconfig:
+   $(Q)cp $(srctree)/arch/$(SRCARCH)/configs/mpc85xx_basic_defconfig 
$(srctree)/.config
+   $(call mergeconfig,smp)
+   $(call mergeconfig,kvm_guest)
+   $(Q)$(MAKE) -f $(srctree)/Makefile olddefconfig
+
+corenet32_smp_defconfig:
+   $(Q)cp $(srctree)/arch/$(SRCARCH)/configs/corenet_basic_defconfig 
$(srctree)/.config
+   $(call mergeconfig,mpc85xx)
+   $(call mergeconfig,corenet32_misc)
+   $(Q)$(MAKE) -f $(srctree)/Makefile olddefconfig
+
+corenet64_smp_defconfig:
+   $(Q)cp $(srctree)/arch/$(SRCARCH)/configs/corenet_basic_defconfig 
$(srctree)/.config
+   $(call mergeconfig,book3e-64)
+   $(call mergeconfig,altivec)
+   $(call mergeconfig,dma)
+   $(call mergeconfig,math_emulation

RE: [PATCH v3] powerpc/defconfig: new way of writing defconfig

2015-05-31 Thread Lijun Pan


 -Original Message-
 From: Wood Scott-B07421
 Sent: Wednesday, May 13, 2015 5:18 PM
 To: Pan Lijun-B44306
 Cc: linuxppc-...@ozlabs.org
 Subject: Re: [PATCH v3] powerpc/defconfig: new way of writing defconfig
 
 On Mon, 2015-05-11 at 23:39 -0500, Lijun Pan wrote:
  It is always a headache dealing with different defconfigs though they
  only differ in a few places. Hence we are proposing a new way of
  writing the defconfig:
  1. Define a basic defconfig say mpc85xx_basic_defconfig 2. Spin off as
  much features as possible from the current mpc85xx_defconfig
  and create a separate config file, say, smp.config, kvm_500.config
  Every time we add a new feature, we don't need to change several
  defconfigs, we just add a new *.config And you could merge any
  fragments you want into .config with the current kconfig in Kernel.
 
  Say you want to build mpc85xx_smp_defconfig, you do 7 steps:
  make mpc85xx_basic_defconfig
  make 32bit.config
  make smp.config
  make cpu8.config
  make kvm_e500.config
  make uart2.config
  make i2c.config
 
  With the new rules added into arch/powerpc/Makefile, you can do it in
  one step:
  make mpc85xx_smp_defconfig
 
 We currently do it in one step.  The 7 step version exists only in previous
 versions of this patch, and won't be in the git history, so such comments 
 should
 go beneath the --- line.

Sure, I will put them beneath --- line in the next patch.

 
  directory scottwood has my patch,
  directory scottwood does not have my patch
 
 You shouldn't be working off of my repository unless it has patches (that you
 need or that would conflict) that haven't yet been merged upstream.

I am working off an old commit. See the result from $git log
17a0f33 powerpc/defconfig: new way of writing defconfig
d41444d powerpc/corenet: enable CONFIG_I2C_MUX and CONFIG_I2C_MUX_PCA954x
7f9af0a powerpc/t2080qds: fix rtc interrupt
56302c5 powerpc/mpic: Remove WHOAMI readback after EOI
 

  [b44306@b44306-12 scottwood]$ ./scripts/diffconfig
  ../scottwood2/.config .config  EPAPR_PARAVIRT n - y  KVM_GUEST n - y
   PPC_QEMU_E500 n - y
  // these changes are expected since mpc85xx_smp_defconfig has enabled
 kvm_e500.config in freescale's internal git repo. 
 
 What does our internal git repo have to do with anything?

I will take off kvm_e500.config if upstream defconfig does have these.
I will add kvm_e500.config later.

 
  diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile index
  fc502e0..7c80298 100644
  --- a/arch/powerpc/Makefile
  +++ b/arch/powerpc/Makefile
  @@ -269,6 +269,52 @@ bootwrapper_install:
   %.dtb: scripts
  $(Q)$(MAKE) ARCH=ppc64 $(build)=$(boot)
 $(patsubst %,$(boot)/%,$@)
 
  +configfiles=$(wildcard $(srctree)/kernel/configs/$(1).config
  +$(srctree)/arch/$(SRCARCH)/configs/$(1).config)
  +
  +define mergeconfig
  +$(Q)$(CONFIG_SHELL) $(srctree)/scripts/kconfig/merge_config.sh -m -O
  +$(objtree)/arch/$(SRCARCH)/configs
  +$(objtree)/arch/$(SRCARCH)/configs/.config $(call configfiles,$(1))
  +endef
 
 Why not invoke make with the whatever.config target instead?

I first merge (no any make) all the config fragments into one, then make it.
This is a way to make sure the .config after this patch the same as .config 
before this patch.

 
  +
  +mpc85xx_defconfig:
  +   $(Q)cp $(srctree)/arch/$(SRCARCH)/configs/mpc85xx_basic_defconfig
  +$(srctree)/arch/$(SRCARCH)/configs/.config
 
 Don't modify $(srctree), ever.  Why not just depend on the
 mpc85xx_basic_defconfig target?
 
  +   $(call mergeconfig,32-bit)
  +   $(call mergeconfig,uart6)
  +   $(call mergeconfig,mpc85xx_misc)
  +   $(Q)mv $(objtree)/arch/$(SRCARCH)/configs/.config
 $(objtree)/arch/$(SRCARCH)/configs/mpc85xx_tmp_defconfig
  +   $(Q)$(MAKE) -f $(srctree)/Makefile mpc85xx_tmp_defconfig
  +
  +mpc85xx_smp_defconfig:
  +   $(Q)cp $(srctree)/arch/$(SRCARCH)/configs/mpc85xx_basic_defconfig
 $(srctree)/arch/$(SRCARCH)/configs/.config
  +   $(call mergeconfig,32-bit)
  +   $(call mergeconfig,smp)
  +   $(call mergeconfig,cpu8)
  +   $(call mergeconfig,kvm_e500)
  +   $(call mergeconfig,uart2)
  +   $(call mergeconfig,i2c)
  +   $(Q)mv $(objtree)/arch/$(SRCARCH)/configs/.config
 $(objtree)/arch/$(SRCARCH)/configs/mpc85xx_smp_tmp_defconfig
  +   $(Q)$(MAKE) -f $(srctree)/Makefile mpc85xx_smp_tmp_defconfig
 
 There shouldn't be any difference besides SMP for mpc85xx_defconfig
 versus mpc85xx_smp_defconfig.  I know someone previously asked you to
 ensure this didn't change the results, but I think this is a good opportunity 
 to
 get rid of gratuitous differences, as long as you show what the diff is 
 between
 old and new so we can verify that the changes are beneficial.
 

There are quite a lot difference between mcp85xx_defconfig and 
mpc85xx_smp_config.
Can you tell me which configs could be removed or neglected?

  +corenet32_smp_defconfig:
  +   $(Q)cp $(srctree)/arch/$(SRCARCH)/configs/corenet_defconfig
 $(srctree)/arch/$(SRCARCH)/configs/.config
  +   $(call mergeconfig,32-bit

[PATCH] powerpc/defconfig: new way of writing defconfig

2015-05-11 Thread Lijun Pan
It is always a headache dealing with different defconfigs
though they only differ in a few places. Hence we are proposing a new
way of writing the defconfig:
1. Define a basic defconfig say mpc85xx_basic_defconfig
2. Spin off as much features as possible from the current mpc85xx_defconfig
and create a separate config file, say, smp.config, kvm_500.config
Every time we add a new feature, we don't need to change several
defconfigs, we just add a new *.config
And you could merge any fragments you want into .config with the
current kconfig in Kernel.

Say you want to build mpc85xx_smp_defconfig, you do 7 steps:
make mpc85xx_basic_defconfig
make 32bit.config
make smp.config
make cpu8.config
make kvm_e500.config
make uart2.config
make i2c.config

With the new rules added into arch/powerpc/Makefile,
you can do it in one step:
make mpc85xx_smp_defconfig

The reason why I add new rules in arch/powerpc/Makefile is
because I don't want to break the build for existing defconfigs.

Signed-off-by: Lijun Pan lijun@freescale.com
---
v3 changes:
 1.call merge_config.sh -m several times to get a concatenated
 arch/powerpc/configs/*_tmp_defconfig before any real make.
 2. call make *_tmp_defconfig to make $(objtree)/.config identical
 before and after this patch.
 3. Here is a snap shot of comparison of the .config before and after
this patch. 

directory scottwood has my patch,
directory scottwood does not have my patch
I compare the .config from both directories.
They are the same for mpc85xx_defconfig, mpc85xx_smp_defconfig,
corenet32_smp_defconfig, and corenet64_smp_defconfig. 

* mpc85xx_defconfig *
[b44306@b44306-12 linux]$ ls
scottwood scottwood2 torvalds
[b44306@b44306-12 scottwood]$ make mpc85xx_defconfig
Using ./arch/powerpc/configs/.config as base
Merging ./arch/powerpc/configs/32-bit.config
#
# merged configuration written to ./arch/powerpc/configs/.config (needs make)
#
Using ./arch/powerpc/configs/.config as base
Merging ./arch/powerpc/configs/uart6.config
#
# merged configuration written to ./arch/powerpc/configs/.config (needs make)
#
Using ./arch/powerpc/configs/.config as base
Merging ./arch/powerpc/configs/mpc85xx_misc.config
#
# merged configuration written to ./arch/powerpc/configs/.config (needs make)
#
  HOSTCC  scripts/basic/fixdep
  HOSTCC  scripts/kconfig/conf.o
  SHIPPED scripts/kconfig/zconf.tab.c
  SHIPPED scripts/kconfig/zconf.lex.c
  SHIPPED scripts/kconfig/zconf.hash.c
  HOSTCC  scripts/kconfig/zconf.tab.o
  HOSTLD  scripts/kconfig/conf
#
# configuration written to .config
#

[b44306@b44306-12 scottwood2]$ make mpc85xx_defconfig
  HOSTCC  scripts/basic/fixdep
  HOSTCC  scripts/kconfig/conf.o
  SHIPPED scripts/kconfig/zconf.tab.c
  SHIPPED scripts/kconfig/zconf.lex.c
  SHIPPED scripts/kconfig/zconf.hash.c
  HOSTCC  scripts/kconfig/zconf.tab.o
  HOSTLD  scripts/kconfig/conf
#
# configuration written to .config

[b44306@b44306-12 scottwood]$ ./scripts/diffconfig ../scottwood2/.config .config
[b44306@b44306-12 scottwood]$

**mpc85xx_smp_defconfig*
[b44306@b44306-12 scottwood]$ make mpc85xx_smp_defconfig
Using ./arch/powerpc/configs/.config as base
Merging ./arch/powerpc/configs/32-bit.config
#
# merged configuration written to ./arch/powerpc/configs/.config (needs make)
#
Using ./arch/powerpc/configs/.config as base
Merging ./arch/powerpc/configs/smp.config
#
# merged configuration written to ./arch/powerpc/configs/.config (needs make)
#
Using ./arch/powerpc/configs/.config as base
Merging ./arch/powerpc/configs/cpu8.config
#
# merged configuration written to ./arch/powerpc/configs/.config (needs make)
#
Using ./arch/powerpc/configs/.config as base
Merging ./arch/powerpc/configs/kvm_e500.config
#
# merged configuration written to ./arch/powerpc/configs/.config (needs make)
#
Using ./arch/powerpc/configs/.config as base
Merging ./arch/powerpc/configs/uart2.config
#
# merged configuration written to ./arch/powerpc/configs/.config (needs make)
#
Using ./arch/powerpc/configs/.config as base
Merging ./arch/powerpc/configs/i2c.config
#
# merged configuration written to ./arch/powerpc/configs/.config (needs make)
#
#
# configuration written to .config

#
[b44306@b44306-12 scottwood2]$ make mpc85xx_smp_defconfig
#
# configuration written to .config
#
[b44306@b44306-12 scottwood2]$

[b44306@b44306-12 scottwood]$ ./scripts/diffconfig ../scottwood2/.config .config
 EPAPR_PARAVIRT n - y
 KVM_GUEST n - y
 PPC_QEMU_E500 n - y
// these changes are expected since mpc85xx_smp_defconfig has enabled 
kvm_e500.config in freescale's internal git repo. 



*corenet32_smp_defconfig
[b44306@b44306-12 scottwood]$ make corenet32_smp_defconfig
Using ./arch/powerpc/configs/.config as base
  
Merging ./arch/powerpc/configs/32-bit.config
#
# merged configuration written to ./arch/powerpc/configs/.config (needs make)
#
Using ./arch/powerpc/configs/.config as base
Merging ./arch/powerpc/configs/smp.config

[PATCH v3] powerpc/defconfig: new way of writing defconfig

2015-05-11 Thread Lijun Pan
It is always a headache dealing with different defconfigs
though they only differ in a few places. Hence we are proposing a new
way of writing the defconfig:
1. Define a basic defconfig say mpc85xx_basic_defconfig
2. Spin off as much features as possible from the current mpc85xx_defconfig
and create a separate config file, say, smp.config, kvm_500.config
Every time we add a new feature, we don't need to change several
defconfigs, we just add a new *.config
And you could merge any fragments you want into .config with the
current kconfig in Kernel.

Say you want to build mpc85xx_smp_defconfig, you do 7 steps:
make mpc85xx_basic_defconfig
make 32bit.config
make smp.config
make cpu8.config
make kvm_e500.config
make uart2.config
make i2c.config

With the new rules added into arch/powerpc/Makefile,
you can do it in one step:
make mpc85xx_smp_defconfig

The reason why I add new rules in arch/powerpc/Makefile is
because I don't want to break the build for existing defconfigs.

Signed-off-by: Lijun Pan lijun@freescale.com
---
v3 changes:
 1.call merge_config.sh -m several times to get a concatenated
 arch/powerpc/configs/*_tmp_defconfig before any real make.
 2. call make *_tmp_defconfig to make $(objtree)/.config identical
 before and after this patch.
 3. Here is a snap shot of comparison of the .config before and after
this patch. 

directory scottwood has my patch,
directory scottwood does not have my patch
I compare the .config from both directories.
They are the same for mpc85xx_defconfig, mpc85xx_smp_defconfig,
corenet32_smp_defconfig, and corenet64_smp_defconfig. 

* mpc85xx_defconfig *
[b44306@b44306-12 linux]$ ls
scottwood scottwood2 torvalds
[b44306@b44306-12 scottwood]$ make mpc85xx_defconfig
Using ./arch/powerpc/configs/.config as base
Merging ./arch/powerpc/configs/32-bit.config
#
# merged configuration written to ./arch/powerpc/configs/.config (needs make)
#
Using ./arch/powerpc/configs/.config as base
Merging ./arch/powerpc/configs/uart6.config
#
# merged configuration written to ./arch/powerpc/configs/.config (needs make)
#
Using ./arch/powerpc/configs/.config as base
Merging ./arch/powerpc/configs/mpc85xx_misc.config
#
# merged configuration written to ./arch/powerpc/configs/.config (needs make)
#
  HOSTCC  scripts/basic/fixdep
  HOSTCC  scripts/kconfig/conf.o
  SHIPPED scripts/kconfig/zconf.tab.c
  SHIPPED scripts/kconfig/zconf.lex.c
  SHIPPED scripts/kconfig/zconf.hash.c
  HOSTCC  scripts/kconfig/zconf.tab.o
  HOSTLD  scripts/kconfig/conf
#
# configuration written to .config
#

[b44306@b44306-12 scottwood2]$ make mpc85xx_defconfig
  HOSTCC  scripts/basic/fixdep
  HOSTCC  scripts/kconfig/conf.o
  SHIPPED scripts/kconfig/zconf.tab.c
  SHIPPED scripts/kconfig/zconf.lex.c
  SHIPPED scripts/kconfig/zconf.hash.c
  HOSTCC  scripts/kconfig/zconf.tab.o
  HOSTLD  scripts/kconfig/conf
#
# configuration written to .config

[b44306@b44306-12 scottwood]$ ./scripts/diffconfig ../scottwood2/.config .config
[b44306@b44306-12 scottwood]$

**mpc85xx_smp_defconfig*
[b44306@b44306-12 scottwood]$ make mpc85xx_smp_defconfig
Using ./arch/powerpc/configs/.config as base
Merging ./arch/powerpc/configs/32-bit.config
#
# merged configuration written to ./arch/powerpc/configs/.config (needs make)
#
Using ./arch/powerpc/configs/.config as base
Merging ./arch/powerpc/configs/smp.config
#
# merged configuration written to ./arch/powerpc/configs/.config (needs make)
#
Using ./arch/powerpc/configs/.config as base
Merging ./arch/powerpc/configs/cpu8.config
#
# merged configuration written to ./arch/powerpc/configs/.config (needs make)
#
Using ./arch/powerpc/configs/.config as base
Merging ./arch/powerpc/configs/kvm_e500.config
#
# merged configuration written to ./arch/powerpc/configs/.config (needs make)
#
Using ./arch/powerpc/configs/.config as base
Merging ./arch/powerpc/configs/uart2.config
#
# merged configuration written to ./arch/powerpc/configs/.config (needs make)
#
Using ./arch/powerpc/configs/.config as base
Merging ./arch/powerpc/configs/i2c.config
#
# merged configuration written to ./arch/powerpc/configs/.config (needs make)
#
#
# configuration written to .config

#
[b44306@b44306-12 scottwood2]$ make mpc85xx_smp_defconfig
#
# configuration written to .config
#
[b44306@b44306-12 scottwood2]$

[b44306@b44306-12 scottwood]$ ./scripts/diffconfig ../scottwood2/.config .config
 EPAPR_PARAVIRT n - y
 KVM_GUEST n - y
 PPC_QEMU_E500 n - y
// these changes are expected since mpc85xx_smp_defconfig has enabled 
kvm_e500.config in freescale's internal git repo. 



*corenet32_smp_defconfig
[b44306@b44306-12 scottwood]$ make corenet32_smp_defconfig
Using ./arch/powerpc/configs/.config as base
  
Merging ./arch/powerpc/configs/32-bit.config
#
# merged configuration written to ./arch/powerpc/configs/.config (needs make)
#
Using ./arch/powerpc/configs/.config as base
Merging ./arch/powerpc/configs/smp.config

[PATCH v2] powerpc/defconfig: new way of writing defconfig

2015-04-29 Thread Lijun Pan
It is always a headache dealing with different defconfigs
though they only differ in a few places. Hence we are proposing a new
way of writing the defconfig:
1. Define a basic defconfig say mpc85xx_basic_defconfig
2. Spin off as much features as possible from the current mpc85xx_defconfig
and create a separate config file, say, smp.config, kvm_500.config
Every time we add a new feature, we don't need to change several
defconfigs, we just add a new *.config
And you could merge any fragments you want into .config with the
current kconfig in Kernel.

Say you want to build mpc85xx_smp_defconfig, you do 4 steps:
make mpc85xx_basic_defconfig
make 32bit.config
make smp.config
make kvm_e500.config

With the new rules added into arch/powerpc/Makefile,
you can do it in one step:
make mpc85xx_smp_defconfig

The reason why I add new rules in arch/powerpc/Makefile is
because I don't want to break the build for existing defconfigs.

Signed-off-by: Lijun Pan lijun@freescale.com
---
v2 changes:
 rename kvm_guest.config to kvm_e500.config
 utilize the definition of mergeconfig in scripts/kconfig/Makefile
 .config before and after this patch differs, need to investigate more
 need suggestions on what other features to spin off mpc85xx corenet32/64
 
 arch/powerpc/Makefile  |  29 +++
 arch/powerpc/configs/32-bit.config |   1 +
 arch/powerpc/configs/64-bit.config |   3 +
 arch/powerpc/configs/corenet64_smp_defconfig   | 176 ---
 .../{corenet32_smp_defconfig = corenet_defconfig} |   3 -
 arch/powerpc/configs/kvm_e500.config   |   2 +
 .../{mpc85xx_defconfig = mpc85xx_basic_defconfig} |   1 -
 arch/powerpc/configs/mpc85xx_smp_defconfig | 244 -
 arch/powerpc/configs/smp.config|   1 +
 9 files changed, 36 insertions(+), 424 deletions(-)
 create mode 100644 arch/powerpc/configs/32-bit.config
 create mode 100644 arch/powerpc/configs/64-bit.config
 delete mode 100644 arch/powerpc/configs/corenet64_smp_defconfig
 rename arch/powerpc/configs/{corenet32_smp_defconfig = corenet_defconfig} 
(98%)
 create mode 100644 arch/powerpc/configs/kvm_e500.config
 rename arch/powerpc/configs/{mpc85xx_defconfig = mpc85xx_basic_defconfig} 
(99%)
 delete mode 100644 arch/powerpc/configs/mpc85xx_smp_defconfig
 create mode 100644 arch/powerpc/configs/smp.config

diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index fc502e0..89a7627 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -269,6 +269,35 @@ bootwrapper_install:
 %.dtb: scripts
$(Q)$(MAKE) ARCH=ppc64 $(build)=$(boot) $(patsubst %,$(boot)/%,$@)
 
+configfiles=$(wildcard $(srctree)/kernel/configs/$(1).config 
$(srctree)/arch/$(SRCARCH)/configs/$(1).config)
+
+define mergeconfig
+$(if $(wildcard $(objtree)/.config),, $(error You need an existing .config for 
this target))
+$(if $(call configfiles,$(1)),, $(error No configuration exists for this 
target on this architecture))
+$(Q)$(CONFIG_SHELL) $(srctree)/scripts/kconfig/merge_config.sh -m -O 
$(objtree) $(objtree)/.config $(call configfiles,$(1))
+endef
+
+mpc85xx_defconfig: mpc85xx_basic_defconfig
+   $(call mergeconfig,32-bit)
+   $(Q)yes  | $(MAKE) -f $(srctree)/Makefile oldconfig
+
+mpc85xx_smp_defconfig: mpc85xx_basic_defconfig
+   $(call mergeconfig,32-bit)
+   $(call mergeconfig,smp)
+   $(call mergeconfig,kvm_e500)
+   $(Q)yes  | $(MAKE) -f $(srctree)/Makefile oldconfig
+
+corenet32_smp_defconfig: corenet_defconfig
+   $(call mergeconfig,32-bit)
+   $(call mergeconfig,smp)
+   $(Q)yes  | $(MAKE) -f $(srctree)/Makefile oldconfig
+
+corenet64_smp_defconfig: corenet_defconfig
+   $(call mergeconfig,64-bit)
+   $(call mergeconfig,smp)
+   $(Q)yes  | $(MAKE) -f $(srctree)/Makefile oldconfig
+
+
 define archhelp
   @echo '* zImage  - Build default images selected by kernel config'
   @echo '  zImage.*- Compressed kernel image 
(arch/$(ARCH)/boot/zImage.*)'
diff --git a/arch/powerpc/configs/32-bit.config 
b/arch/powerpc/configs/32-bit.config
new file mode 100644
index 000..3b8b43b
--- /dev/null
+++ b/arch/powerpc/configs/32-bit.config
@@ -0,0 +1 @@
+CONFIG_PPC_85xx=y
diff --git a/arch/powerpc/configs/64-bit.config 
b/arch/powerpc/configs/64-bit.config
new file mode 100644
index 000..b53af55
--- /dev/null
+++ b/arch/powerpc/configs/64-bit.config
@@ -0,0 +1,3 @@
+CONFIG_PPC64=y
+CONFIG_PPC_BOOK3E_64=y
+CONFIG_ALTIVEC=y
diff --git a/arch/powerpc/configs/corenet64_smp_defconfig 
b/arch/powerpc/configs/corenet64_smp_defconfig
deleted file mode 100644
index 33cd1df..000
--- a/arch/powerpc/configs/corenet64_smp_defconfig
+++ /dev/null
@@ -1,176 +0,0 @@
-CONFIG_PPC64=y
-CONFIG_PPC_BOOK3E_64=y
-CONFIG_ALTIVEC=y
-CONFIG_SMP=y
-CONFIG_NR_CPUS=24
-CONFIG_SYSVIPC=y
-CONFIG_FHANDLE=y
-CONFIG_IRQ_DOMAIN_DEBUG=y
-CONFIG_NO_HZ=y
-CONFIG_HIGH_RES_TIMERS=y
-CONFIG_BSD_PROCESS_ACCT=y
-CONFIG_IKCONFIG=y

RE: new way of writing defconfigs for freescale's powerpc platforms

2015-04-17 Thread Lijun Pan


 -Original Message-
 From: Michael Ellerman [mailto:m...@ellerman.id.au]
 Sent: Friday, April 17, 2015 1:19 AM
 To: Wood Scott-B07421
 Cc: Pan Lijun-B44306; linuxppc-...@ozlabs.org; Schmitt Richard-B43082
 Subject: Re: new way of writing defconfigs for freescale's powerpc platforms
 
 On Thu, 2015-04-16 at 23:13 -0500, Scott Wood wrote:
  On Fri, 2015-04-17 at 10:54 +1000, Michael Ellerman wrote:
   On Thu, 2015-04-09 at 21:52 +, Lijun Pan wrote:
Hi Maintainers,
   
We have a proposal for writing the defconfigs for freescale's powperpc
 platforms in a new way.
Can you take a look and provide some feedback?
   
You know currently we have mpc85xx_defconfig, corenet32_defconfig,
 bsc913x_defconfig, *fman*_defconfig, etc.
We are going to extract some common parts from the existing defconfigs,
 and name it, say, fsl_basic_defconfig.
Then, we could create some defconfigs targeting specific features or
 specific platforms.
Say, features specific: kvm_defconfig, fman_defconfig, etc.
Platforms specific: p1_defconfig, p2_defcongfig, p4_defconfig,
t1_defconfig, t2_defconfig, t2_defconfig, b4_defconfig, etc When
we want to make a kernel image for p1 platform, Using the following
 steps:
   
make ./scripts/kconfig/merge_config.sh
arch/powerpc/configs/fsl_basic_config p1_defconfig make
   
What do you think of this new approach?
  
   I don't like that the user has to manually run merge_config.sh.
  
   How does a user even know that it's an option?
  
   It also breaks scripts that auto build the kernel, which expect to be 
   able to
 do:
  
 $ make foo_defconfig
 $ make
  
   Scripts like mine for example :)
  
 http://kisskb.ellerman.id.au/kisskb/head/8734/
  
   What I'd be happy with is something that does merge_config under the
   covers. So a user still runs 'make fsl_plat_foo_defconfig', but
   under the covers it does a merge config.
  
   kvmconfig and tinyconfig are implemented that way already, so with a
   bit more work hopefully you can do that for arch configs also.
 
  kvmconfig and tinyconfig are still separate user-visible steps to be
  applied after running a base defconfig.
 
 Not as of recently:
 
 
 https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/scripts/kc
 onfig/Makefile?id=63a91033d52e64a22e571fe84924c0b7f21c280d
 

Above patch is very generic.
With this patch, we don't even need to modify arch/powerpc/Makefile.
We can just add fragments (like smp.config, kvm_guest.config, etc) under
arch/powerpc/configs/ or
add platform independent config under kernel/configs/

example might be:
make mpc85xx_defconfig
make smp.config
make kvm_guest.config

 
 Which pretty much does what you describe below I think.
 
  For breaking a platform defconfig into components, we could do
  something like this in arch/powerpc/Makefile:
 
  # Can't call mergeconfig directly as it isn't defined at this point
  define domerge
 @$(MAKE) -f $(srctree)/scripts/kconfig/Makefile $(1).config
  endef
 
  corenet64_smp_defconfig: corenet64_basic_defconfig
  $(call domerge,smp)
  $(call domerge,altivec)
  $(call domerge,corenet_drivers)
  $(call domerge,embedded_misc) # filesystems etc
 
  And this in scripts/kconfig/Makefile:
 
  %.config:
 $(call mergeconfig,$*)
 
  One issue with this is that we'd lose the ability to use savedefconfig
  (at least without manual manipulation of the results) to maintain the
  defconfigs/fragments.
 
 That's probably OK, it's only maintainers who need to do that.
 
 cheers
 

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

[PATCH] powerpc/defconfig: new way of writing defconfig

2015-04-17 Thread Lijun Pan
It is always a headache dealing with different defconfigs
though they only differ in few places. Hence we are proposing a new
way of writing defconfig:
1. Define a basic defconfig say mpc85xx_basic_defconfig
2. Spin off as much features as possible from mpc85xx_defconfig
and create a separate config file, say, kvm_guest.config
Every time we add a new feature, we don't need to change several
defconfigs, we just add a new *.config
And you could merge any fragments you want into .config with the
current kconfig in Kernel.

Say you want to build mpc85xx_smp_defconfig, you do 3 steps
make mpc85xx_basic_defconfig
make smp.config
make kvm_guest.config

or just
make mpc85xx_smp_defconfig

Signed-off-by: Lijun Pan lijun@freescale.com
---
 arch/powerpc/Makefile  |  17 ++
 ...t32_smp_defconfig = corenet32_basic_defconfig} |   0
 ...t64_smp_defconfig = corenet64_basic_defconfig} |   0
 arch/powerpc/configs/kvm_guest.config  |   2 +
 .../{mpc85xx_defconfig = mpc85xx_basic_defconfig} |   0
 arch/powerpc/configs/mpc85xx_smp_defconfig | 244 -
 arch/powerpc/configs/smp.config|   1 +
 7 files changed, 20 insertions(+), 244 deletions(-)
 rename arch/powerpc/configs/{corenet32_smp_defconfig = 
corenet32_basic_defconfig} (100%)
 rename arch/powerpc/configs/{corenet64_smp_defconfig = 
corenet64_basic_defconfig} (100%)
 create mode 100644 arch/powerpc/configs/kvm_guest.config
 rename arch/powerpc/configs/{mpc85xx_defconfig = mpc85xx_basic_defconfig} 
(100%)
 delete mode 100644 arch/powerpc/configs/mpc85xx_smp_defconfig
 create mode 100644 arch/powerpc/configs/smp.config

diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index fc502e0..590b441 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -269,6 +269,23 @@ bootwrapper_install:
 %.dtb: scripts
$(Q)$(MAKE) ARCH=ppc64 $(build)=$(boot) $(patsubst %,$(boot)/%,$@)
 
+define domerge
+   $(Q)$(CONFIG_SHELL) $(srctree)/scripts/kconfig/merge_config.sh 
$(srctree)/.config $(srctree)/arch/powerpc/configs/$(1).config
+endef
+
+mpc85xx_defconfig: mpc85xx_basic_defconfig
+   @:
+
+mpc85xx_smp_defconfig: mpc85xx_basic_defconfig
+   $(call domerge,smp)
+   $(call domerge,kvm_guest)
+
+corenet32_smp_defconfig: corenet32_basic_defconfig
+   $(call domerge,smp)
+
+corenet64_smp_defconfig: corenet64_basic_defconfig
+   $(call domerge,smp)
+
 define archhelp
   @echo '* zImage  - Build default images selected by kernel config'
   @echo '  zImage.*- Compressed kernel image 
(arch/$(ARCH)/boot/zImage.*)'
diff --git a/arch/powerpc/configs/corenet32_smp_defconfig 
b/arch/powerpc/configs/corenet32_basic_defconfig
similarity index 100%
rename from arch/powerpc/configs/corenet32_smp_defconfig
rename to arch/powerpc/configs/corenet32_basic_defconfig
diff --git a/arch/powerpc/configs/corenet64_smp_defconfig 
b/arch/powerpc/configs/corenet64_basic_defconfig
similarity index 100%
rename from arch/powerpc/configs/corenet64_smp_defconfig
rename to arch/powerpc/configs/corenet64_basic_defconfig
diff --git a/arch/powerpc/configs/kvm_guest.config 
b/arch/powerpc/configs/kvm_guest.config
new file mode 100644
index 000..615b0a0
--- /dev/null
+++ b/arch/powerpc/configs/kvm_guest.config
@@ -0,0 +1,2 @@
+CONFIG_KVM_GUEST=y
+CONFIG_PPC_QEMU_E500=y
diff --git a/arch/powerpc/configs/mpc85xx_defconfig 
b/arch/powerpc/configs/mpc85xx_basic_defconfig
similarity index 100%
rename from arch/powerpc/configs/mpc85xx_defconfig
rename to arch/powerpc/configs/mpc85xx_basic_defconfig
diff --git a/arch/powerpc/configs/mpc85xx_smp_defconfig 
b/arch/powerpc/configs/mpc85xx_smp_defconfig
deleted file mode 100644
index b6c7111..000
--- a/arch/powerpc/configs/mpc85xx_smp_defconfig
+++ /dev/null
@@ -1,244 +0,0 @@
-CONFIG_PPC_85xx=y
-CONFIG_PHYS_64BIT=y
-CONFIG_SMP=y
-CONFIG_NR_CPUS=8
-CONFIG_SYSVIPC=y
-CONFIG_POSIX_MQUEUE=y
-CONFIG_AUDIT=y
-CONFIG_IRQ_DOMAIN_DEBUG=y
-CONFIG_NO_HZ=y
-CONFIG_HIGH_RES_TIMERS=y
-CONFIG_BSD_PROCESS_ACCT=y
-CONFIG_IKCONFIG=y
-CONFIG_IKCONFIG_PROC=y
-CONFIG_LOG_BUF_SHIFT=14
-CONFIG_BLK_DEV_INITRD=y
-CONFIG_EXPERT=y
-CONFIG_KALLSYMS_ALL=y
-CONFIG_MODULES=y
-CONFIG_MODULE_UNLOAD=y
-CONFIG_MODULE_FORCE_UNLOAD=y
-CONFIG_MODVERSIONS=y
-# CONFIG_BLK_DEV_BSG is not set
-CONFIG_PARTITION_ADVANCED=y
-CONFIG_MAC_PARTITION=y
-CONFIG_C293_PCIE=y
-CONFIG_MPC8540_ADS=y
-CONFIG_MPC8560_ADS=y
-CONFIG_MPC85xx_CDS=y
-CONFIG_MPC85xx_MDS=y
-CONFIG_MPC8536_DS=y
-CONFIG_MPC85xx_DS=y
-CONFIG_MPC85xx_RDB=y
-CONFIG_P1010_RDB=y
-CONFIG_P1022_DS=y
-CONFIG_P1022_RDK=y
-CONFIG_P1023_RDB=y
-CONFIG_SOCRATES=y
-CONFIG_KSI8560=y
-CONFIG_XES_MPC85xx=y
-CONFIG_STX_GP3=y
-CONFIG_TQM8540=y
-CONFIG_TQM8541=y
-CONFIG_TQM8548=y
-CONFIG_TQM8555=y
-CONFIG_TQM8560=y
-CONFIG_SBC8548=y
-CONFIG_QUICC_ENGINE=y
-CONFIG_QE_GPIO=y
-CONFIG_HIGHMEM=y
-CONFIG_BINFMT_MISC=m
-CONFIG_MATH_EMULATION=y
-CONFIG_FORCE_MAX_ZONEORDER=12
-CONFIG_PCI=y
-CONFIG_PCI_MSI=y
-CONFIG_RAPIDIO=y

RE: new way of writing defconfigs for freescale's powerpc platforms

2015-04-17 Thread Lijun Pan


 -Original Message-
 From: Wood Scott-B07421
 Sent: Friday, April 17, 2015 1:53 PM
 To: Pan Lijun-B44306
 Cc: Michael Ellerman; linuxppc-...@ozlabs.org; Schmitt Richard-B43082
 Subject: Re: new way of writing defconfigs for freescale's powerpc platforms
 
 On Fri, 2015-04-17 at 13:50 -0500, Pan Lijun-B44306 wrote:
 
 
   -Original Message-
   From: Michael Ellerman [mailto:m...@ellerman.id.au]
   Sent: Friday, April 17, 2015 1:19 AM
   To: Wood Scott-B07421
   Cc: Pan Lijun-B44306; linuxppc-...@ozlabs.org; Schmitt
   Richard-B43082
   Subject: Re: new way of writing defconfigs for freescale's powerpc
   platforms
  
   On Thu, 2015-04-16 at 23:13 -0500, Scott Wood wrote:
On Fri, 2015-04-17 at 10:54 +1000, Michael Ellerman wrote:
 On Thu, 2015-04-09 at 21:52 +, Lijun Pan wrote:
  Hi Maintainers,
 
  We have a proposal for writing the defconfigs for freescale's
  powperpc
   platforms in a new way.
  Can you take a look and provide some feedback?
 
  You know currently we have mpc85xx_defconfig,
  corenet32_defconfig,
   bsc913x_defconfig, *fman*_defconfig, etc.
  We are going to extract some common parts from the existing
  defconfigs,
   and name it, say, fsl_basic_defconfig.
  Then, we could create some defconfigs targeting specific
  features or
   specific platforms.
  Say, features specific: kvm_defconfig, fman_defconfig, etc.
  Platforms specific: p1_defconfig, p2_defcongfig, p4_defconfig,
  t1_defconfig, t2_defconfig, t2_defconfig, b4_defconfig, etc
  When we want to make a kernel image for p1 platform, Using the
  following
   steps:
 
  make ./scripts/kconfig/merge_config.sh
  arch/powerpc/configs/fsl_basic_config p1_defconfig make
 
  What do you think of this new approach?

 I don't like that the user has to manually run merge_config.sh.

 How does a user even know that it's an option?

 It also breaks scripts that auto build the kernel, which expect
 to be able to
   do:

   $ make foo_defconfig
   $ make

 Scripts like mine for example :)

   http://kisskb.ellerman.id.au/kisskb/head/8734/

 What I'd be happy with is something that does merge_config under
 the covers. So a user still runs 'make fsl_plat_foo_defconfig',
 but under the covers it does a merge config.

 kvmconfig and tinyconfig are implemented that way already, so
 with a bit more work hopefully you can do that for arch configs also.
   
kvmconfig and tinyconfig are still separate user-visible steps to
be applied after running a base defconfig.
  
   Not as of recently:
  
  
   https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/comm
   it/scripts/kc
   onfig/Makefile?id=63a91033d52e64a22e571fe84924c0b7f21c280d
  
 
  Above patch is very generic.
  With this patch, we don't even need to modify arch/powerpc/Makefile.
  We can just add fragments (like smp.config, kvm_guest.config, etc)
  under arch/powerpc/configs/ or add platform independent config under
  kernel/configs/
 
  example might be:
  make mpc85xx_defconfig
  make smp.config
  make kvm_guest.config
 
 The point is that the user should not have to do that.  They can if they want,
 but there should still be traditional named configs, which would just work
 differently under the hood.
 
 -Scott
 

Have just sent out a patch considering the previous discussion.
http://patchwork.ozlabs.org/patch/462249/
[PATCH] powerpc/defconfig: new way of writing defconfig

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

RE: new way of writing defconfigs for freescale's powerpc platforms

2015-04-16 Thread Lijun Pan


 -Original Message-
 From: Wood Scott-B07421
 Sent: Thursday, April 09, 2015 5:31 PM
 To: Pan Lijun-B44306
 Cc: linuxppc-...@ozlabs.org; Schmitt Richard-B43082
 Subject: Re: new way of writing defconfigs for freescale's powerpc platforms
 
 On Thu, 2015-04-09 at 16:52 -0500, Pan Lijun-B44306 wrote:
  Hi Maintainers,
 
  We have a proposal for writing the defconfigs for freescale's powperpc
 platforms in a new way.
  Can you take a look and provide some feedback?
 
  You know currently we have mpc85xx_defconfig, corenet32_defconfig,
 bsc913x_defconfig, *fman*_defconfig, etc.
  We are going to extract some common parts from the existing defconfigs,
 and name it, say, fsl_basic_defconfig.
  Then, we could create some defconfigs targeting specific features or 
  specific
 platforms.
  Say, features specific: kvm_defconfig, fman_defconfig, etc.
  Platforms specific: p1_defconfig, p2_defcongfig, p4_defconfig,
  t1_defconfig, t2_defconfig, t2_defconfig, b4_defconfig, etc When we
  want to make a kernel image for p1 platform, Using the following steps:
 
  make ./scripts/kconfig/merge_config.sh
  arch/powerpc/configs/fsl_basic_config p1_defconfig make
 
  What do you think of this new approach?
  Will you accept this approach?
 
 I'm OK with a merge_config approach.
 
 I'm not OK with having separate builds for p1/p2/p4/t1/t2/b4.

If we don't have separate build for p1/p2/p4/t1/t2/b4, in what way do we
build for these SoC with merge_config approach? Do you have any suggestions? 

 
 -Scott
 

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

[PATCH 2/4] powerpc/85xx: miscellaneous changes on mpc85xx_smp_defconfig

2015-04-02 Thread Lijun Pan
Merge Freescale's Internal mpc85xx_smp_defconfig with upstream's.
Run savedefconfig to get the minimal change.

Signed-off-by: Lijun Pan lijun@freescale.com
---
 arch/powerpc/configs/mpc85xx_smp_defconfig | 10 --
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/arch/powerpc/configs/mpc85xx_smp_defconfig 
b/arch/powerpc/configs/mpc85xx_smp_defconfig
index b6c7111..2f67799 100644
--- a/arch/powerpc/configs/mpc85xx_smp_defconfig
+++ b/arch/powerpc/configs/mpc85xx_smp_defconfig
@@ -34,6 +34,7 @@ CONFIG_P1010_RDB=y
 CONFIG_P1022_DS=y
 CONFIG_P1022_RDK=y
 CONFIG_P1023_RDB=y
+CONFIG_TWR_P102x=y
 CONFIG_SOCRATES=y
 CONFIG_KSI8560=y
 CONFIG_XES_MPC85xx=y
@@ -44,6 +45,8 @@ CONFIG_TQM8548=y
 CONFIG_TQM8555=y
 CONFIG_TQM8560=y
 CONFIG_SBC8548=y
+CONFIG_PPC_QEMU_E500=y
+CONFIG_KVM_GUEST=y
 CONFIG_QUICC_ENGINE=y
 CONFIG_QE_GPIO=y
 CONFIG_HIGHMEM=y
@@ -91,13 +94,11 @@ CONFIG_MTD_PHYSMAP_OF=y
 CONFIG_MTD_NAND=y
 CONFIG_MTD_NAND_FSL_ELBC=y
 CONFIG_MTD_NAND_FSL_IFC=y
-CONFIG_MTD_SPI_NOR=y
 CONFIG_MTD_UBI=y
 CONFIG_BLK_DEV_LOOP=y
 CONFIG_BLK_DEV_NBD=y
 CONFIG_BLK_DEV_RAM=y
 CONFIG_BLK_DEV_RAM_SIZE=131072
-CONFIG_EEPROM_AT24=y
 CONFIG_EEPROM_LEGACY=y
 CONFIG_BLK_DEV_SD=y
 CONFIG_CHR_DEV_ST=y
@@ -183,13 +184,9 @@ CONFIG_USB_STORAGE=y
 CONFIG_MMC=y
 CONFIG_MMC_SDHCI=y
 CONFIG_MMC_SDHCI_PLTFM=y
-CONFIG_MMC_SDHCI_OF_ESDHC=y
 CONFIG_EDAC=y
 CONFIG_EDAC_MM_EDAC=y
 CONFIG_RTC_CLASS=y
-CONFIG_RTC_DRV_DS1307=y
-CONFIG_RTC_DRV_DS1374=y
-CONFIG_RTC_DRV_DS3232=y
 CONFIG_RTC_DRV_CMOS=y
 CONFIG_DMADEVICES=y
 CONFIG_FSL_DMA=y
@@ -235,6 +232,7 @@ CONFIG_FONT_8x8=y
 CONFIG_FONT_8x16=y
 CONFIG_DEBUG_INFO=y
 CONFIG_DEBUG_FS=y
+CONFIG_MAGIC_SYSRQ=y
 CONFIG_DETECT_HUNG_TASK=y
 CONFIG_CRYPTO_PCBC=m
 CONFIG_CRYPTO_SHA256=y
-- 
1.9.3

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

[PATCH 1/4] powerpc/85xx: miscellaneous changes on mpc85xx_defconfig

2015-04-02 Thread Lijun Pan
Merge Freescale's Internal mpc85xx_defconfig with upstream's.
Run savedefconfig to get the minimal change.

Signed-off-by: Lijun Pan lijun@freescale.com
---
 arch/powerpc/configs/mpc85xx_defconfig | 28 +++-
 1 file changed, 7 insertions(+), 21 deletions(-)

diff --git a/arch/powerpc/configs/mpc85xx_defconfig 
b/arch/powerpc/configs/mpc85xx_defconfig
index 6ecf7bd..0a04104 100644
--- a/arch/powerpc/configs/mpc85xx_defconfig
+++ b/arch/powerpc/configs/mpc85xx_defconfig
@@ -15,7 +15,6 @@ CONFIG_EXPERT=y
 CONFIG_KALLSYMS_ALL=y
 CONFIG_MODULES=y
 CONFIG_MODULE_UNLOAD=y
-CONFIG_MODULE_FORCE_UNLOAD=y
 CONFIG_MODVERSIONS=y
 # CONFIG_BLK_DEV_BSG is not set
 CONFIG_PARTITION_ADVANCED=y
@@ -42,7 +41,8 @@ CONFIG_TQM8548=y
 CONFIG_TQM8555=y
 CONFIG_TQM8560=y
 CONFIG_SBC8548=y
-CONFIG_MVME2500=y
+CONFIG_PPC_QEMU_E500=y
+CONFIG_KVM_GUEST=y
 CONFIG_QUICC_ENGINE=y
 CONFIG_QE_GPIO=y
 CONFIG_HIGHMEM=y
@@ -50,8 +50,6 @@ CONFIG_BINFMT_MISC=m
 CONFIG_MATH_EMULATION=y
 CONFIG_FORCE_MAX_ZONEORDER=12
 CONFIG_PCI=y
-CONFIG_PCIEPORTBUS=y
-# CONFIG_PCIEASPM is not set
 CONFIG_PCI_MSI=y
 CONFIG_RAPIDIO=y
 CONFIG_NET=y
@@ -88,21 +86,17 @@ CONFIG_FTL=y
 CONFIG_MTD_CFI=y
 CONFIG_MTD_CFI_INTELEXT=y
 CONFIG_MTD_CFI_AMDSTD=y
-CONFIG_MTD_PHYSMAP=y
 CONFIG_MTD_PHYSMAP_OF=y
-CONFIG_MTD_PLATRAM=y
-CONFIG_MTD_M25P80=y
 CONFIG_MTD_NAND=y
 CONFIG_MTD_NAND_FSL_ELBC=y
 CONFIG_MTD_NAND_FSL_IFC=y
-CONFIG_MTD_SPI_NOR=y
 CONFIG_MTD_UBI=y
 CONFIG_BLK_DEV_LOOP=y
 CONFIG_BLK_DEV_NBD=y
 CONFIG_BLK_DEV_RAM=y
 CONFIG_BLK_DEV_RAM_SIZE=131072
-CONFIG_EEPROM_AT24=y
-CONFIG_EEPROM_LEGACY=y
+CONFIG_IDE=y
+CONFIG_BLK_DEV_VIA82CXXX=y
 CONFIG_BLK_DEV_SD=y
 CONFIG_CHR_DEV_ST=y
 CONFIG_BLK_DEV_SR=y
@@ -127,7 +121,6 @@ CONFIG_MARVELL_PHY=y
 CONFIG_DAVICOM_PHY=y
 CONFIG_CICADA_PHY=y
 CONFIG_VITESSE_PHY=y
-CONFIG_BROADCOM_PHY=y
 CONFIG_FIXED_PHY=y
 CONFIG_INPUT_FF_MEMLESS=m
 # CONFIG_INPUT_MOUSEDEV is not set
@@ -136,8 +129,8 @@ CONFIG_INPUT_FF_MEMLESS=m
 CONFIG_SERIO_LIBPS2=y
 CONFIG_SERIAL_8250=y
 CONFIG_SERIAL_8250_CONSOLE=y
-CONFIG_SERIAL_8250_NR_UARTS=6
-CONFIG_SERIAL_8250_RUNTIME_UARTS=6
+CONFIG_SERIAL_8250_NR_UARTS=2
+CONFIG_SERIAL_8250_RUNTIME_UARTS=2
 CONFIG_SERIAL_8250_MANY_PORTS=y
 CONFIG_SERIAL_8250_DETECT_IRQ=y
 CONFIG_SERIAL_8250_RSA=y
@@ -190,14 +183,9 @@ CONFIG_USB_STORAGE=y
 CONFIG_MMC=y
 CONFIG_MMC_SDHCI=y
 CONFIG_MMC_SDHCI_PLTFM=y
-CONFIG_MMC_SDHCI_OF_ESDHC=y
 CONFIG_EDAC=y
 CONFIG_EDAC_MM_EDAC=y
-CONFIG_EDAC_MPC85XX=y
 CONFIG_RTC_CLASS=y
-CONFIG_RTC_DRV_DS1307=y
-CONFIG_RTC_DRV_DS1374=y
-CONFIG_RTC_DRV_DS3232=y
 CONFIG_RTC_DRV_CMOS=y
 CONFIG_DMADEVICES=y
 CONFIG_FSL_DMA=y
@@ -218,9 +206,6 @@ CONFIG_ADFS_FS=m
 CONFIG_AFFS_FS=m
 CONFIG_HFS_FS=m
 CONFIG_HFSPLUS_FS=m
-CONFIG_BEFS_FS=m
-CONFIG_BFS_FS=m
-CONFIG_EFS_FS=m
 CONFIG_JFFS2_FS=y
 CONFIG_JFFS2_FS_DEBUG=1
 CONFIG_UBIFS_FS=y
@@ -243,6 +228,7 @@ CONFIG_FONT_8x8=y
 CONFIG_FONT_8x16=y
 CONFIG_DEBUG_INFO=y
 CONFIG_DEBUG_FS=y
+CONFIG_MAGIC_SYSRQ=y
 CONFIG_DETECT_HUNG_TASK=y
 CONFIG_CRYPTO_PCBC=m
 CONFIG_CRYPTO_SHA256=y
-- 
1.9.3

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

[PATCH 3/4] powerpc/corenet: miscellaneous changes on corenet32_smp_defconfig

2015-04-02 Thread Lijun Pan
Merge Freescale's Internal corenet32_smp_defconfig with upstream's.
Run savedefconfig to get the minimal change.

Signed-off-by: Lijun Pan lijun@freescale.com
---
 arch/powerpc/configs/corenet32_smp_defconfig | 14 +-
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/arch/powerpc/configs/corenet32_smp_defconfig 
b/arch/powerpc/configs/corenet32_smp_defconfig
index 3765993..1c2c607 100644
--- a/arch/powerpc/configs/corenet32_smp_defconfig
+++ b/arch/powerpc/configs/corenet32_smp_defconfig
@@ -22,6 +22,7 @@ CONFIG_MODVERSIONS=y
 # CONFIG_BLK_DEV_BSG is not set
 CONFIG_PARTITION_ADVANCED=y
 CONFIG_MAC_PARTITION=y
+CONFIG_PPC_QEMU_E500=y
 CONFIG_CORENET_GENERIC=y
 CONFIG_HIGHMEM=y
 # CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
@@ -62,6 +63,7 @@ CONFIG_INET_IPCOMP=y
 # CONFIG_INET_LRO is not set
 CONFIG_IPV6=y
 CONFIG_IP_SCTP=m
+CONFIG_VLAN_8021Q=y
 CONFIG_UEVENT_HELPER_PATH=/sbin/hotplug
 CONFIG_DEVTMPFS=y
 CONFIG_DEVTMPFS_MOUNT=y
@@ -69,13 +71,11 @@ CONFIG_MTD=y
 CONFIG_MTD_CMDLINE_PARTS=y
 CONFIG_MTD_BLOCK=y
 CONFIG_MTD_CFI=y
-CONFIG_MTD_CFI_INTELEXT=y
 CONFIG_MTD_CFI_AMDSTD=y
 CONFIG_MTD_PHYSMAP_OF=y
 CONFIG_MTD_NAND=y
 CONFIG_MTD_NAND_FSL_ELBC=y
 CONFIG_MTD_NAND_FSL_IFC=y
-CONFIG_MTD_SPI_NOR=y
 CONFIG_BLK_DEV_LOOP=y
 CONFIG_BLK_DEV_RAM=y
 CONFIG_BLK_DEV_RAM_SIZE=131072
@@ -116,8 +116,6 @@ CONFIG_NVRAM=y
 CONFIG_I2C=y
 CONFIG_I2C_CHARDEV=y
 CONFIG_I2C_MPC=y
-CONFIG_I2C_MUX=y
-CONFIG_I2C_MUX_PCA954x=y
 CONFIG_SPI=y
 CONFIG_SPI_GPIO=y
 CONFIG_SPI_FSL_SPI=y
@@ -135,19 +133,19 @@ CONFIG_USB_OHCI_HCD_PPC_OF_LE=y
 CONFIG_USB_STORAGE=y
 CONFIG_MMC=y
 CONFIG_MMC_SDHCI=y
+CONFIG_MMC_SDHCI_PLTFM=y
 CONFIG_EDAC=y
 CONFIG_EDAC_MM_EDAC=y
 CONFIG_EDAC_MPC85XX=y
 CONFIG_RTC_CLASS=y
 CONFIG_RTC_DRV_DS1307=y
-CONFIG_RTC_DRV_DS1374=y
 CONFIG_RTC_DRV_DS3232=y
+CONFIG_RTC_DRV_CMOS=y
 CONFIG_UIO=y
 CONFIG_VIRT_DRIVERS=y
 CONFIG_FSL_HV_MANAGER=y
 CONFIG_STAGING=y
-CONFIG_FSL_CORENET_CF=y
-CONFIG_CLK_QORIQ=y
+CONFIG_FSL_PAMU=y
 CONFIG_EXT2_FS=y
 CONFIG_EXT3_FS=y
 # CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set
@@ -167,8 +165,6 @@ CONFIG_NFS_FS=y
 CONFIG_NFS_V4=y
 CONFIG_ROOT_NFS=y
 CONFIG_NFSD=m
-CONFIG_NLS_CODEPAGE_437=y
-CONFIG_NLS_CODEPAGE_850=y
 CONFIG_NLS_ISO8859_1=y
 CONFIG_NLS_UTF8=m
 CONFIG_DEBUG_INFO=y
-- 
1.9.3

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

[PATCH 4/4] powerpc/corenet: miscellaneous changes on corenet64_smp_defconfig

2015-04-02 Thread Lijun Pan
Merge Freescale's Internal corenet64_smp_defconfig with upstream's.
Run savedefconfig to get the minimal change.

Signed-off-by: Lijun Pan lijun@freescale.com
---
 arch/powerpc/configs/corenet64_smp_defconfig | 42 
 1 file changed, 24 insertions(+), 18 deletions(-)

diff --git a/arch/powerpc/configs/corenet64_smp_defconfig 
b/arch/powerpc/configs/corenet64_smp_defconfig
index 33cd1df..f423271 100644
--- a/arch/powerpc/configs/corenet64_smp_defconfig
+++ b/arch/powerpc/configs/corenet64_smp_defconfig
@@ -4,7 +4,7 @@ CONFIG_ALTIVEC=y
 CONFIG_SMP=y
 CONFIG_NR_CPUS=24
 CONFIG_SYSVIPC=y
-CONFIG_FHANDLE=y
+CONFIG_POSIX_MQUEUE=y
 CONFIG_IRQ_DOMAIN_DEBUG=y
 CONFIG_NO_HZ=y
 CONFIG_HIGH_RES_TIMERS=y
@@ -12,13 +12,12 @@ CONFIG_BSD_PROCESS_ACCT=y
 CONFIG_IKCONFIG=y
 CONFIG_IKCONFIG_PROC=y
 CONFIG_LOG_BUF_SHIFT=14
-CONFIG_CGROUPS=y
-CONFIG_CPUSETS=y
-CONFIG_CGROUP_CPUACCT=y
-CONFIG_CGROUP_SCHED=y
 CONFIG_BLK_DEV_INITRD=y
-CONFIG_EXPERT=y
 CONFIG_KALLSYMS_ALL=y
+CONFIG_EMBEDDED=y
+CONFIG_SLAB=y
+CONFIG_PROFILING=y
+CONFIG_OPROFILE=y
 CONFIG_MODULES=y
 CONFIG_MODULE_UNLOAD=y
 CONFIG_MODULE_FORCE_UNLOAD=y
@@ -26,6 +25,7 @@ CONFIG_MODVERSIONS=y
 # CONFIG_BLK_DEV_BSG is not set
 CONFIG_PARTITION_ADVANCED=y
 CONFIG_MAC_PARTITION=y
+CONFIG_PPC_QEMU_E500=y
 CONFIG_CORENET_GENERIC=y
 # CONFIG_PPC_OF_BOOT_TRAMPOLINE is not set
 CONFIG_BINFMT_MISC=m
@@ -33,13 +33,14 @@ CONFIG_MATH_EMULATION=y
 CONFIG_MATH_EMULATION_HW_UNIMPLEMENTED=y
 CONFIG_PCIEPORTBUS=y
 CONFIG_PCI_MSI=y
-CONFIG_RAPIDIO=y
-CONFIG_FSL_RIO=y
 CONFIG_NET=y
 CONFIG_PACKET=y
 CONFIG_UNIX=y
 CONFIG_XFRM_USER=y
+CONFIG_XFRM_SUB_POLICY=y
+CONFIG_XFRM_STATISTICS=y
 CONFIG_NET_KEY=y
+CONFIG_NET_KEY_MIGRATE=y
 CONFIG_INET=y
 CONFIG_IP_MULTICAST=y
 CONFIG_IP_ADVANCED_ROUTER=y
@@ -54,11 +55,14 @@ CONFIG_NET_IPIP=y
 CONFIG_IP_MROUTE=y
 CONFIG_IP_PIMSM_V1=y
 CONFIG_IP_PIMSM_V2=y
+CONFIG_INET_AH=y
 CONFIG_INET_ESP=y
+CONFIG_INET_IPCOMP=y
 # CONFIG_INET_XFRM_MODE_BEET is not set
 # CONFIG_INET_LRO is not set
 CONFIG_IPV6=y
 CONFIG_IP_SCTP=m
+CONFIG_VLAN_8021Q=y
 CONFIG_UEVENT_HELPER_PATH=/sbin/hotplug
 CONFIG_DEVTMPFS=y
 CONFIG_DEVTMPFS_MOUNT=y
@@ -73,19 +77,23 @@ CONFIG_MTD_PHYSMAP_OF=y
 CONFIG_MTD_NAND=y
 CONFIG_MTD_NAND_FSL_ELBC=y
 CONFIG_MTD_NAND_FSL_IFC=y
-CONFIG_MTD_SPI_NOR=y
 CONFIG_MTD_UBI=y
 CONFIG_BLK_DEV_LOOP=y
 CONFIG_BLK_DEV_RAM=y
 CONFIG_BLK_DEV_RAM_SIZE=131072
 CONFIG_EEPROM_LEGACY=y
 CONFIG_BLK_DEV_SD=y
+CONFIG_CHR_DEV_ST=y
 CONFIG_BLK_DEV_SR=y
-CONFIG_BLK_DEV_SR_VENDOR=y
 CONFIG_CHR_DEV_SG=y
+CONFIG_SCSI_LOGGING=y
+CONFIG_SCSI_SPI_ATTRS=y
 CONFIG_ATA=y
 CONFIG_SATA_FSL=y
 CONFIG_SATA_SIL24=y
+CONFIG_MD=y
+CONFIG_BLK_DEV_MD=y
+CONFIG_MD_RAID456=y
 CONFIG_NETDEVICES=y
 CONFIG_DUMMY=y
 CONFIG_FSL_PQ_MDIO=y
@@ -109,8 +117,6 @@ CONFIG_SERIAL_8250_RSA=y
 CONFIG_I2C=y
 CONFIG_I2C_CHARDEV=y
 CONFIG_I2C_MPC=y
-CONFIG_I2C_MUX=y
-CONFIG_I2C_MUX_PCA954x=y
 CONFIG_SPI=y
 CONFIG_SPI_GPIO=y
 CONFIG_SPI_FSL_SPI=y
@@ -125,18 +131,19 @@ CONFIG_USB_EHCI_FSL=y
 CONFIG_USB_STORAGE=y
 CONFIG_MMC=y
 CONFIG_MMC_SDHCI=y
+CONFIG_MMC_SDHCI_PLTFM=y
 CONFIG_EDAC=y
 CONFIG_EDAC_MM_EDAC=y
 CONFIG_RTC_CLASS=y
 CONFIG_RTC_DRV_DS1307=y
-CONFIG_RTC_DRV_DS1374=y
 CONFIG_RTC_DRV_DS3232=y
+CONFIG_RTC_DRV_CMOS=y
 CONFIG_DMADEVICES=y
-CONFIG_FSL_DMA=y
+CONFIG_ASYNC_TX_DMA=y
+CONFIG_UIO=y
 CONFIG_VIRT_DRIVERS=y
 CONFIG_FSL_HV_MANAGER=y
-CONFIG_CLK_QORIQ=y
-CONFIG_FSL_CORENET_CF=y
+CONFIG_STAGING=y
 CONFIG_EXT2_FS=y
 CONFIG_EXT3_FS=y
 CONFIG_ISO9660_FS=m
@@ -152,12 +159,11 @@ CONFIG_HUGETLBFS=y
 CONFIG_JFFS2_FS=y
 CONFIG_JFFS2_FS_DEBUG=1
 CONFIG_UBIFS_FS=y
+CONFIG_CRAMFS=y
 CONFIG_NFS_FS=y
 CONFIG_NFS_V4=y
 CONFIG_ROOT_NFS=y
 CONFIG_NFSD=m
-CONFIG_NLS_CODEPAGE_437=y
-CONFIG_NLS_CODEPAGE_850=y
 CONFIG_NLS_ISO8859_1=y
 CONFIG_NLS_UTF8=m
 CONFIG_CRC_T10DIF=y
-- 
1.9.3

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

[PATCH v2] powerpc/mpc85xx: Remove P1023 RDS support

2014-05-05 Thread Lijun Pan
P1023RDS is no longer supported/manufactured by Freescale while P1023RDB is.

Signed-off-by: Lijun Pan lijun@freescale.com
---
 arch/powerpc/boot/dts/p1023rds.dts | 219 -
 arch/powerpc/configs/mpc85xx_defconfig |   1 -
 arch/powerpc/configs/mpc85xx_smp_defconfig |   1 -
 arch/powerpc/platforms/85xx/Kconfig|   6 +-
 arch/powerpc/platforms/85xx/Makefile   |   2 +-
 .../platforms/85xx/{p1023_rds.c = p1023_rdb.c}|  36 +---
 6 files changed, 10 insertions(+), 255 deletions(-)
 delete mode 100644 arch/powerpc/boot/dts/p1023rds.dts
 rename arch/powerpc/platforms/85xx/{p1023_rds.c = p1023_rdb.c} (75%)

diff --git a/arch/powerpc/boot/dts/p1023rds.dts 
b/arch/powerpc/boot/dts/p1023rds.dts
deleted file mode 100644
index beb6cb1..000
--- a/arch/powerpc/boot/dts/p1023rds.dts
+++ /dev/null
@@ -1,219 +0,0 @@
-/*
- * P1023 RDS Device Tree Source
- *
- * Copyright 2010-2011 Freescale Semiconductor Inc.
- *
- * Author: Roy Zang tie-fei.z...@freescale.com
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * * Neither the name of Freescale Semiconductor nor the
- *   names of its contributors may be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- *
- * ALTERNATIVELY, this software may be distributed under the terms of the
- * GNU General Public License (GPL) as published by the Free Software
- * Foundation, either version 2 of that License or (at your option) any
- * later version.
- *
- * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 
THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/include/ fsl/p1023si-pre.dtsi
-
-/ {
-   model = fsl,P1023;
-   compatible = fsl,P1023RDS;
-   #address-cells = 2;
-   #size-cells = 2;
-   interrupt-parent = mpic;
-
-   memory {
-   device_type = memory;
-   };
-
-   soc: soc@ff60 {
-   ranges = 0x0 0x0 0xff60 0x20;
-
-   i2c@3000 {
-   rtc@68 {
-   compatible = dallas,ds1374;
-   reg = 0x68;
-   };
-   };
-
-   spi@7000 {
-   fsl_dataflash@0 {
-   #address-cells = 1;
-   #size-cells = 1;
-   compatible = atmel,at45db081d;
-   reg = 0;
-   spi-max-frequency = 4000; /* input clock 
*/
-   partition@u-boot {
-   /* 512KB for u-boot Bootloader Image */
-   label = u-boot-spi;
-   reg = 0x 0x0008;
-   read-only;
-   };
-   partition@dtb {
-   /* 512KB for DTB Image */
-   label = dtb-spi;
-   reg = 0x0008 0x0008;
-   read-only;
-   };
-   };
-   };
-
-   usb@22000 {
-   dr_mode = host;
-   phy_type = ulpi;
-   };
-   };
-
-   lbc: localbus@ff605000 {
-   reg = 0 0xff605000 0 0x1000;
-
-   /* NOR Flash, BCSR */
-   ranges = 0x0 0x0 0x0 0xee00 0x0200
- 0x1 0x0 0x0 0xe000 0x8000;
-
-   nor@0,0 {
-   #address-cells = 1;
-   #size-cells = 1;
-   compatible = cfi-flash

RE: [PATCH v2] powerpc/mpc85xx: Remove P1023 RDS support

2014-05-05 Thread Lijun Pan


 -Original Message-
 From: Wood Scott-B07421
 Sent: Monday, May 05, 2014 2:05 PM
 To: Pan Lijun-B44306
 Cc: linuxppc-...@ozlabs.org; Medve Emilian-EMMEDVE1
 Subject: Re: [PATCH v2] powerpc/mpc85xx: Remove P1023 RDS support
 
 On Mon, 2014-05-05 at 13:23 -0500, Lijun Pan wrote:
  P1023RDS is no longer supported/manufactured by Freescale while
 P1023RDB is.
 
  Signed-off-by: Lijun Pan lijun@freescale.com
  ---
   arch/powerpc/boot/dts/p1023rds.dts | 219 -
 
   arch/powerpc/configs/mpc85xx_defconfig |   1 -
   arch/powerpc/configs/mpc85xx_smp_defconfig |   1 -
   arch/powerpc/platforms/85xx/Kconfig|   6 +-
   arch/powerpc/platforms/85xx/Makefile   |   2 +-
   .../platforms/85xx/{p1023_rds.c = p1023_rdb.c}|  36 +---
   6 files changed, 10 insertions(+), 255 deletions(-)
   delete mode 100644 arch/powerpc/boot/dts/p1023rds.dts
   rename arch/powerpc/platforms/85xx/{p1023_rds.c = p1023_rdb.c} (75%)
 
 What changed from v1?

Please wrap changelogs at no more than 75 columns.


 If you want this patch merged, please respond to the comments on v1.
 
 -Scott
 

___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

[PATCH] powerpc/mpc85xx: Remove P1023 RDS support

2014-04-18 Thread Lijun Pan
P1023RDS is no longer supported by Freescale while P1023RDB is still supported.

Signed-off-by: Lijun Pan lijun@freescale.com
---
 arch/powerpc/boot/dts/p1023rds.dts | 219 -
 arch/powerpc/configs/mpc85xx_defconfig |   1 -
 arch/powerpc/configs/mpc85xx_smp_defconfig |   1 -
 arch/powerpc/platforms/85xx/Kconfig|   6 +-
 arch/powerpc/platforms/85xx/Makefile   |   2 +-
 .../platforms/85xx/{p1023_rds.c = p1023_rdb.c}|  36 +---
 6 files changed, 10 insertions(+), 255 deletions(-)
 delete mode 100644 arch/powerpc/boot/dts/p1023rds.dts
 rename arch/powerpc/platforms/85xx/{p1023_rds.c = p1023_rdb.c} (75%)

diff --git a/arch/powerpc/boot/dts/p1023rds.dts 
b/arch/powerpc/boot/dts/p1023rds.dts
deleted file mode 100644
index beb6cb1..000
--- a/arch/powerpc/boot/dts/p1023rds.dts
+++ /dev/null
@@ -1,219 +0,0 @@
-/*
- * P1023 RDS Device Tree Source
- *
- * Copyright 2010-2011 Freescale Semiconductor Inc.
- *
- * Author: Roy Zang tie-fei.z...@freescale.com
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright
- *   notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- *   notice, this list of conditions and the following disclaimer in the
- *   documentation and/or other materials provided with the distribution.
- * * Neither the name of Freescale Semiconductor nor the
- *   names of its contributors may be used to endorse or promote products
- *   derived from this software without specific prior written permission.
- *
- *
- * ALTERNATIVELY, this software may be distributed under the terms of the
- * GNU General Public License (GPL) as published by the Free Software
- * Foundation, either version 2 of that License or (at your option) any
- * later version.
- *
- * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 
THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-/include/ fsl/p1023si-pre.dtsi
-
-/ {
-   model = fsl,P1023;
-   compatible = fsl,P1023RDS;
-   #address-cells = 2;
-   #size-cells = 2;
-   interrupt-parent = mpic;
-
-   memory {
-   device_type = memory;
-   };
-
-   soc: soc@ff60 {
-   ranges = 0x0 0x0 0xff60 0x20;
-
-   i2c@3000 {
-   rtc@68 {
-   compatible = dallas,ds1374;
-   reg = 0x68;
-   };
-   };
-
-   spi@7000 {
-   fsl_dataflash@0 {
-   #address-cells = 1;
-   #size-cells = 1;
-   compatible = atmel,at45db081d;
-   reg = 0;
-   spi-max-frequency = 4000; /* input clock 
*/
-   partition@u-boot {
-   /* 512KB for u-boot Bootloader Image */
-   label = u-boot-spi;
-   reg = 0x 0x0008;
-   read-only;
-   };
-   partition@dtb {
-   /* 512KB for DTB Image */
-   label = dtb-spi;
-   reg = 0x0008 0x0008;
-   read-only;
-   };
-   };
-   };
-
-   usb@22000 {
-   dr_mode = host;
-   phy_type = ulpi;
-   };
-   };
-
-   lbc: localbus@ff605000 {
-   reg = 0 0xff605000 0 0x1000;
-
-   /* NOR Flash, BCSR */
-   ranges = 0x0 0x0 0x0 0xee00 0x0200
- 0x1 0x0 0x0 0xe000 0x8000;
-
-   nor@0,0 {
-   #address-cells = 1;
-   #size-cells = 1;
-   compatible = cfi-flash

[PATCH v4] powerpc/85xx: Merge 85xx/p1023_defconfig into mpc85xx_smp_defconfig and mpc85xx_defconfig

2013-11-15 Thread Lijun Pan
mpc85xx_smp_defconfig and mpc85xx_defconfig already have CONFIG_P1023RDS=y.
Merge CONFIG_P1023RDB=y and other relevant configurations into 
mpc85xx_smp_defconfig and mpc85_defconfig.

Signed-off-by: Lijun Pan lijun@freescale.com
---
 v4 only add CONFIG_P1023_RDB=y CONFIG_EEPROM_AT24=y CONFIG_RTC_DRV_DS1307=y to 
 mpc85xx_defconfig and mpc85xx_smp_defconfig

 arch/powerpc/configs/85xx/p1023_defconfig  |  188 
 arch/powerpc/configs/mpc85xx_defconfig |3 +
 arch/powerpc/configs/mpc85xx_smp_defconfig |3 +
 3 files changed, 6 insertions(+), 188 deletions(-)
 delete mode 100644 arch/powerpc/configs/85xx/p1023_defconfig

diff --git a/arch/powerpc/configs/85xx/p1023_defconfig 
b/arch/powerpc/configs/85xx/p1023_defconfig
deleted file mode 100644
index b06d37d..000
--- a/arch/powerpc/configs/85xx/p1023_defconfig
+++ /dev/null
@@ -1,188 +0,0 @@
-CONFIG_PPC_85xx=y
-CONFIG_SMP=y
-CONFIG_NR_CPUS=2
-CONFIG_SYSVIPC=y
-CONFIG_POSIX_MQUEUE=y
-CONFIG_BSD_PROCESS_ACCT=y
-CONFIG_AUDIT=y
-CONFIG_NO_HZ=y
-CONFIG_HIGH_RES_TIMERS=y
-CONFIG_RCU_FANOUT=32
-CONFIG_IKCONFIG=y
-CONFIG_IKCONFIG_PROC=y
-CONFIG_LOG_BUF_SHIFT=14
-CONFIG_BLK_DEV_INITRD=y
-CONFIG_KALLSYMS_ALL=y
-CONFIG_EMBEDDED=y
-CONFIG_MODULES=y
-CONFIG_MODULE_UNLOAD=y
-CONFIG_MODULE_FORCE_UNLOAD=y
-CONFIG_MODVERSIONS=y
-# CONFIG_BLK_DEV_BSG is not set
-CONFIG_PARTITION_ADVANCED=y
-CONFIG_MAC_PARTITION=y
-CONFIG_PHYSICAL_START=0x
-CONFIG_P1023_RDB=y
-CONFIG_P1023_RDS=y
-CONFIG_QUICC_ENGINE=y
-CONFIG_QE_GPIO=y
-CONFIG_CPM2=y
-CONFIG_HIGHMEM=y
-# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
-CONFIG_BINFMT_MISC=m
-CONFIG_MATH_EMULATION=y
-CONFIG_SWIOTLB=y
-CONFIG_PCI=y
-CONFIG_PCIEPORTBUS=y
-# CONFIG_PCIEAER is not set
-# CONFIG_PCIEASPM is not set
-CONFIG_PCI_MSI=y
-CONFIG_NET=y
-CONFIG_PACKET=y
-CONFIG_UNIX=y
-CONFIG_XFRM_USER=y
-CONFIG_NET_KEY=y
-CONFIG_INET=y
-CONFIG_IP_MULTICAST=y
-CONFIG_IP_ADVANCED_ROUTER=y
-CONFIG_IP_MULTIPLE_TABLES=y
-CONFIG_IP_ROUTE_MULTIPATH=y
-CONFIG_IP_ROUTE_VERBOSE=y
-CONFIG_IP_PNP=y
-CONFIG_IP_PNP_DHCP=y
-CONFIG_IP_PNP_BOOTP=y
-CONFIG_IP_PNP_RARP=y
-CONFIG_NET_IPIP=y
-CONFIG_IP_MROUTE=y
-CONFIG_IP_PIMSM_V1=y
-CONFIG_IP_PIMSM_V2=y
-CONFIG_ARPD=y
-CONFIG_INET_ESP=y
-# CONFIG_INET_XFRM_MODE_BEET is not set
-# CONFIG_INET_LRO is not set
-CONFIG_IPV6=y
-CONFIG_IP_SCTP=m
-CONFIG_UEVENT_HELPER_PATH=/sbin/hotplug
-CONFIG_DEVTMPFS=y
-CONFIG_DEVTMPFS_MOUNT=y
-CONFIG_MTD=y
-CONFIG_MTD_CMDLINE_PARTS=y
-CONFIG_MTD_CHAR=y
-CONFIG_MTD_BLOCK=y
-CONFIG_MTD_CFI=y
-CONFIG_MTD_CFI_AMDSTD=y
-CONFIG_MTD_PHYSMAP_OF=y
-CONFIG_MTD_NAND=y
-CONFIG_MTD_NAND_FSL_ELBC=y
-CONFIG_PROC_DEVICETREE=y
-CONFIG_BLK_DEV_LOOP=y
-CONFIG_BLK_DEV_RAM=y
-CONFIG_BLK_DEV_RAM_SIZE=131072
-CONFIG_EEPROM_AT24=y
-CONFIG_EEPROM_LEGACY=y
-CONFIG_BLK_DEV_SD=y
-CONFIG_CHR_DEV_ST=y
-CONFIG_BLK_DEV_SR=y
-CONFIG_CHR_DEV_SG=y
-CONFIG_SCSI_MULTI_LUN=y
-CONFIG_SCSI_LOGGING=y
-CONFIG_ATA=y
-CONFIG_SATA_FSL=y
-CONFIG_SATA_SIL24=y
-CONFIG_NETDEVICES=y
-CONFIG_DUMMY=y
-CONFIG_FS_ENET=y
-CONFIG_FSL_PQ_MDIO=y
-CONFIG_E1000E=y
-CONFIG_PHYLIB=y
-CONFIG_AT803X_PHY=y
-CONFIG_MARVELL_PHY=y
-CONFIG_DAVICOM_PHY=y
-CONFIG_CICADA_PHY=y
-CONFIG_VITESSE_PHY=y
-CONFIG_FIXED_PHY=y
-CONFIG_INPUT_FF_MEMLESS=m
-# CONFIG_INPUT_MOUSEDEV is not set
-# CONFIG_INPUT_KEYBOARD is not set
-# CONFIG_INPUT_MOUSE is not set
-CONFIG_SERIO_LIBPS2=y
-CONFIG_SERIAL_8250=y
-CONFIG_SERIAL_8250_CONSOLE=y
-CONFIG_SERIAL_8250_NR_UARTS=2
-CONFIG_SERIAL_8250_RUNTIME_UARTS=2
-CONFIG_SERIAL_8250_EXTENDED=y
-CONFIG_SERIAL_8250_MANY_PORTS=y
-CONFIG_SERIAL_8250_SHARE_IRQ=y
-CONFIG_SERIAL_8250_DETECT_IRQ=y
-CONFIG_SERIAL_8250_RSA=y
-CONFIG_HW_RANDOM=y
-CONFIG_NVRAM=y
-CONFIG_I2C=y
-CONFIG_I2C_CHARDEV=y
-CONFIG_I2C_CPM=m
-CONFIG_I2C_MPC=y
-CONFIG_GPIO_MPC8XXX=y
-# CONFIG_HWMON is not set
-CONFIG_VIDEO_OUTPUT_CONTROL=y
-CONFIG_SOUND=y
-CONFIG_SND=y
-CONFIG_SND_MIXER_OSS=y
-CONFIG_SND_PCM_OSS=y
-# CONFIG_SND_SUPPORT_OLD_API is not set
-CONFIG_USB=y
-CONFIG_USB_DEVICEFS=y
-CONFIG_USB_MON=y
-CONFIG_USB_EHCI_HCD=y
-CONFIG_USB_EHCI_FSL=y
-CONFIG_USB_STORAGE=y
-CONFIG_EDAC=y
-CONFIG_EDAC_MM_EDAC=y
-CONFIG_RTC_CLASS=y
-CONFIG_RTC_DRV_DS1307=y
-CONFIG_RTC_DRV_CMOS=y
-CONFIG_DMADEVICES=y
-CONFIG_FSL_DMA=y
-# CONFIG_NET_DMA is not set
-CONFIG_STAGING=y
-CONFIG_EXT2_FS=y
-CONFIG_EXT3_FS=y
-# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set
-CONFIG_ISO9660_FS=m
-CONFIG_JOLIET=y
-CONFIG_ZISOFS=y
-CONFIG_UDF_FS=m
-CONFIG_MSDOS_FS=m
-CONFIG_VFAT_FS=y
-CONFIG_NTFS_FS=y
-CONFIG_PROC_KCORE=y
-CONFIG_TMPFS=y
-CONFIG_ADFS_FS=m
-CONFIG_AFFS_FS=m
-CONFIG_HFS_FS=m
-CONFIG_HFSPLUS_FS=m
-CONFIG_BEFS_FS=m
-CONFIG_BFS_FS=m
-CONFIG_EFS_FS=m
-CONFIG_CRAMFS=y
-CONFIG_VXFS_FS=m
-CONFIG_HPFS_FS=m
-CONFIG_QNX4FS_FS=m
-CONFIG_SYSV_FS=m
-CONFIG_UFS_FS=m
-CONFIG_NFS_FS=y
-CONFIG_NFS_V4=y
-CONFIG_ROOT_NFS=y
-CONFIG_NFSD=y
-CONFIG_CRC_T10DIF=y
-CONFIG_FRAME_WARN=8092
-CONFIG_DEBUG_FS=y
-CONFIG_DETECT_HUNG_TASK=y
-# CONFIG_DEBUG_BUGVERBOSE is not set
-CONFIG_DEBUG_INFO=y
-CONFIG_STRICT_DEVMEM=y
-CONFIG_CRYPTO_PCBC=m
-CONFIG_CRYPTO_SHA256=y

[PATCH v3] powerpc/85xx: Merge 85xx/p1023_defconfig into mpc85xx_smp_defconfig and mpc85xx_defconfig

2013-11-13 Thread Lijun Pan
mpc85xx_smp_defconfig and mpc85xx_defconfig already have CONFIG_P1023RDS=y.
Merge CONFIG_P1023RDB=y and other relevant configurations into 
mpc85xx_smp_defconfig and mpc85_defconfig.

Signed-off-by: Lijun Pan lijun@freescale.com
---
 arch/powerpc/configs/85xx/p1023_defconfig  |  188 
 arch/powerpc/configs/mpc85xx_defconfig |3 +
 arch/powerpc/configs/mpc85xx_smp_defconfig |3 +
 3 files changed, 6 insertions(+), 188 deletions(-)
 delete mode 100644 arch/powerpc/configs/85xx/p1023_defconfig

diff --git a/arch/powerpc/configs/85xx/p1023_defconfig 
b/arch/powerpc/configs/85xx/p1023_defconfig
deleted file mode 100644
index b06d37d..000
--- a/arch/powerpc/configs/85xx/p1023_defconfig
+++ /dev/null
@@ -1,188 +0,0 @@
-CONFIG_PPC_85xx=y
-CONFIG_SMP=y
-CONFIG_NR_CPUS=2
-CONFIG_SYSVIPC=y
-CONFIG_POSIX_MQUEUE=y
-CONFIG_BSD_PROCESS_ACCT=y
-CONFIG_AUDIT=y
-CONFIG_NO_HZ=y
-CONFIG_HIGH_RES_TIMERS=y
-CONFIG_RCU_FANOUT=32
-CONFIG_IKCONFIG=y
-CONFIG_IKCONFIG_PROC=y
-CONFIG_LOG_BUF_SHIFT=14
-CONFIG_BLK_DEV_INITRD=y
-CONFIG_KALLSYMS_ALL=y
-CONFIG_EMBEDDED=y
-CONFIG_MODULES=y
-CONFIG_MODULE_UNLOAD=y
-CONFIG_MODULE_FORCE_UNLOAD=y
-CONFIG_MODVERSIONS=y
-# CONFIG_BLK_DEV_BSG is not set
-CONFIG_PARTITION_ADVANCED=y
-CONFIG_MAC_PARTITION=y
-CONFIG_PHYSICAL_START=0x
-CONFIG_P1023_RDB=y
-CONFIG_P1023_RDS=y
-CONFIG_QUICC_ENGINE=y
-CONFIG_QE_GPIO=y
-CONFIG_CPM2=y
-CONFIG_HIGHMEM=y
-# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
-CONFIG_BINFMT_MISC=m
-CONFIG_MATH_EMULATION=y
-CONFIG_SWIOTLB=y
-CONFIG_PCI=y
-CONFIG_PCIEPORTBUS=y
-# CONFIG_PCIEAER is not set
-# CONFIG_PCIEASPM is not set
-CONFIG_PCI_MSI=y
-CONFIG_NET=y
-CONFIG_PACKET=y
-CONFIG_UNIX=y
-CONFIG_XFRM_USER=y
-CONFIG_NET_KEY=y
-CONFIG_INET=y
-CONFIG_IP_MULTICAST=y
-CONFIG_IP_ADVANCED_ROUTER=y
-CONFIG_IP_MULTIPLE_TABLES=y
-CONFIG_IP_ROUTE_MULTIPATH=y
-CONFIG_IP_ROUTE_VERBOSE=y
-CONFIG_IP_PNP=y
-CONFIG_IP_PNP_DHCP=y
-CONFIG_IP_PNP_BOOTP=y
-CONFIG_IP_PNP_RARP=y
-CONFIG_NET_IPIP=y
-CONFIG_IP_MROUTE=y
-CONFIG_IP_PIMSM_V1=y
-CONFIG_IP_PIMSM_V2=y
-CONFIG_ARPD=y
-CONFIG_INET_ESP=y
-# CONFIG_INET_XFRM_MODE_BEET is not set
-# CONFIG_INET_LRO is not set
-CONFIG_IPV6=y
-CONFIG_IP_SCTP=m
-CONFIG_UEVENT_HELPER_PATH=/sbin/hotplug
-CONFIG_DEVTMPFS=y
-CONFIG_DEVTMPFS_MOUNT=y
-CONFIG_MTD=y
-CONFIG_MTD_CMDLINE_PARTS=y
-CONFIG_MTD_CHAR=y
-CONFIG_MTD_BLOCK=y
-CONFIG_MTD_CFI=y
-CONFIG_MTD_CFI_AMDSTD=y
-CONFIG_MTD_PHYSMAP_OF=y
-CONFIG_MTD_NAND=y
-CONFIG_MTD_NAND_FSL_ELBC=y
-CONFIG_PROC_DEVICETREE=y
-CONFIG_BLK_DEV_LOOP=y
-CONFIG_BLK_DEV_RAM=y
-CONFIG_BLK_DEV_RAM_SIZE=131072
-CONFIG_EEPROM_AT24=y
-CONFIG_EEPROM_LEGACY=y
-CONFIG_BLK_DEV_SD=y
-CONFIG_CHR_DEV_ST=y
-CONFIG_BLK_DEV_SR=y
-CONFIG_CHR_DEV_SG=y
-CONFIG_SCSI_MULTI_LUN=y
-CONFIG_SCSI_LOGGING=y
-CONFIG_ATA=y
-CONFIG_SATA_FSL=y
-CONFIG_SATA_SIL24=y
-CONFIG_NETDEVICES=y
-CONFIG_DUMMY=y
-CONFIG_FS_ENET=y
-CONFIG_FSL_PQ_MDIO=y
-CONFIG_E1000E=y
-CONFIG_PHYLIB=y
-CONFIG_AT803X_PHY=y
-CONFIG_MARVELL_PHY=y
-CONFIG_DAVICOM_PHY=y
-CONFIG_CICADA_PHY=y
-CONFIG_VITESSE_PHY=y
-CONFIG_FIXED_PHY=y
-CONFIG_INPUT_FF_MEMLESS=m
-# CONFIG_INPUT_MOUSEDEV is not set
-# CONFIG_INPUT_KEYBOARD is not set
-# CONFIG_INPUT_MOUSE is not set
-CONFIG_SERIO_LIBPS2=y
-CONFIG_SERIAL_8250=y
-CONFIG_SERIAL_8250_CONSOLE=y
-CONFIG_SERIAL_8250_NR_UARTS=2
-CONFIG_SERIAL_8250_RUNTIME_UARTS=2
-CONFIG_SERIAL_8250_EXTENDED=y
-CONFIG_SERIAL_8250_MANY_PORTS=y
-CONFIG_SERIAL_8250_SHARE_IRQ=y
-CONFIG_SERIAL_8250_DETECT_IRQ=y
-CONFIG_SERIAL_8250_RSA=y
-CONFIG_HW_RANDOM=y
-CONFIG_NVRAM=y
-CONFIG_I2C=y
-CONFIG_I2C_CHARDEV=y
-CONFIG_I2C_CPM=m
-CONFIG_I2C_MPC=y
-CONFIG_GPIO_MPC8XXX=y
-# CONFIG_HWMON is not set
-CONFIG_VIDEO_OUTPUT_CONTROL=y
-CONFIG_SOUND=y
-CONFIG_SND=y
-CONFIG_SND_MIXER_OSS=y
-CONFIG_SND_PCM_OSS=y
-# CONFIG_SND_SUPPORT_OLD_API is not set
-CONFIG_USB=y
-CONFIG_USB_DEVICEFS=y
-CONFIG_USB_MON=y
-CONFIG_USB_EHCI_HCD=y
-CONFIG_USB_EHCI_FSL=y
-CONFIG_USB_STORAGE=y
-CONFIG_EDAC=y
-CONFIG_EDAC_MM_EDAC=y
-CONFIG_RTC_CLASS=y
-CONFIG_RTC_DRV_DS1307=y
-CONFIG_RTC_DRV_CMOS=y
-CONFIG_DMADEVICES=y
-CONFIG_FSL_DMA=y
-# CONFIG_NET_DMA is not set
-CONFIG_STAGING=y
-CONFIG_EXT2_FS=y
-CONFIG_EXT3_FS=y
-# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set
-CONFIG_ISO9660_FS=m
-CONFIG_JOLIET=y
-CONFIG_ZISOFS=y
-CONFIG_UDF_FS=m
-CONFIG_MSDOS_FS=m
-CONFIG_VFAT_FS=y
-CONFIG_NTFS_FS=y
-CONFIG_PROC_KCORE=y
-CONFIG_TMPFS=y
-CONFIG_ADFS_FS=m
-CONFIG_AFFS_FS=m
-CONFIG_HFS_FS=m
-CONFIG_HFSPLUS_FS=m
-CONFIG_BEFS_FS=m
-CONFIG_BFS_FS=m
-CONFIG_EFS_FS=m
-CONFIG_CRAMFS=y
-CONFIG_VXFS_FS=m
-CONFIG_HPFS_FS=m
-CONFIG_QNX4FS_FS=m
-CONFIG_SYSV_FS=m
-CONFIG_UFS_FS=m
-CONFIG_NFS_FS=y
-CONFIG_NFS_V4=y
-CONFIG_ROOT_NFS=y
-CONFIG_NFSD=y
-CONFIG_CRC_T10DIF=y
-CONFIG_FRAME_WARN=8092
-CONFIG_DEBUG_FS=y
-CONFIG_DETECT_HUNG_TASK=y
-# CONFIG_DEBUG_BUGVERBOSE is not set
-CONFIG_DEBUG_INFO=y
-CONFIG_STRICT_DEVMEM=y
-CONFIG_CRYPTO_PCBC=m
-CONFIG_CRYPTO_SHA256=y
-CONFIG_CRYPTO_SHA512=y
-CONFIG_CRYPTO_AES=y
-# CONFIG_CRYPTO_ANSI_CPRNG is not set
-CONFIG_CRYPTO_DEV_FSL_CAAM=y
diff --git

[PATCH V2] powerpc/85xx: Merge 85xx/p1023_defconfig into mpc85xx_smp_defconfig and mpc85xx_defconfig

2013-11-11 Thread Lijun Pan
mpc85xx_smp_defconfig and mpc85xx_defconfig already have CONFIG_P1023RDS=y.
Merge CONFIG_P1023RDB=y and other relevant configurations into 
mpc85xx_smp_defconfig and mpc85_defconfig.

Signed-off-by: Lijun Pan lijun@freescale.com
---
 arch/powerpc/configs/85xx/p1023_defconfig  |  188 
 arch/powerpc/configs/mpc85xx_defconfig |   18 +++
 arch/powerpc/configs/mpc85xx_smp_defconfig |   17 +++
 3 files changed, 35 insertions(+), 188 deletions(-)
 delete mode 100644 arch/powerpc/configs/85xx/p1023_defconfig

diff --git a/arch/powerpc/configs/85xx/p1023_defconfig 
b/arch/powerpc/configs/85xx/p1023_defconfig
deleted file mode 100644
index b06d37d..000
--- a/arch/powerpc/configs/85xx/p1023_defconfig
+++ /dev/null
@@ -1,188 +0,0 @@
-CONFIG_PPC_85xx=y
-CONFIG_SMP=y
-CONFIG_NR_CPUS=2
-CONFIG_SYSVIPC=y
-CONFIG_POSIX_MQUEUE=y
-CONFIG_BSD_PROCESS_ACCT=y
-CONFIG_AUDIT=y
-CONFIG_NO_HZ=y
-CONFIG_HIGH_RES_TIMERS=y
-CONFIG_RCU_FANOUT=32
-CONFIG_IKCONFIG=y
-CONFIG_IKCONFIG_PROC=y
-CONFIG_LOG_BUF_SHIFT=14
-CONFIG_BLK_DEV_INITRD=y
-CONFIG_KALLSYMS_ALL=y
-CONFIG_EMBEDDED=y
-CONFIG_MODULES=y
-CONFIG_MODULE_UNLOAD=y
-CONFIG_MODULE_FORCE_UNLOAD=y
-CONFIG_MODVERSIONS=y
-# CONFIG_BLK_DEV_BSG is not set
-CONFIG_PARTITION_ADVANCED=y
-CONFIG_MAC_PARTITION=y
-CONFIG_PHYSICAL_START=0x
-CONFIG_P1023_RDB=y
-CONFIG_P1023_RDS=y
-CONFIG_QUICC_ENGINE=y
-CONFIG_QE_GPIO=y
-CONFIG_CPM2=y
-CONFIG_HIGHMEM=y
-# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
-CONFIG_BINFMT_MISC=m
-CONFIG_MATH_EMULATION=y
-CONFIG_SWIOTLB=y
-CONFIG_PCI=y
-CONFIG_PCIEPORTBUS=y
-# CONFIG_PCIEAER is not set
-# CONFIG_PCIEASPM is not set
-CONFIG_PCI_MSI=y
-CONFIG_NET=y
-CONFIG_PACKET=y
-CONFIG_UNIX=y
-CONFIG_XFRM_USER=y
-CONFIG_NET_KEY=y
-CONFIG_INET=y
-CONFIG_IP_MULTICAST=y
-CONFIG_IP_ADVANCED_ROUTER=y
-CONFIG_IP_MULTIPLE_TABLES=y
-CONFIG_IP_ROUTE_MULTIPATH=y
-CONFIG_IP_ROUTE_VERBOSE=y
-CONFIG_IP_PNP=y
-CONFIG_IP_PNP_DHCP=y
-CONFIG_IP_PNP_BOOTP=y
-CONFIG_IP_PNP_RARP=y
-CONFIG_NET_IPIP=y
-CONFIG_IP_MROUTE=y
-CONFIG_IP_PIMSM_V1=y
-CONFIG_IP_PIMSM_V2=y
-CONFIG_ARPD=y
-CONFIG_INET_ESP=y
-# CONFIG_INET_XFRM_MODE_BEET is not set
-# CONFIG_INET_LRO is not set
-CONFIG_IPV6=y
-CONFIG_IP_SCTP=m
-CONFIG_UEVENT_HELPER_PATH=/sbin/hotplug
-CONFIG_DEVTMPFS=y
-CONFIG_DEVTMPFS_MOUNT=y
-CONFIG_MTD=y
-CONFIG_MTD_CMDLINE_PARTS=y
-CONFIG_MTD_CHAR=y
-CONFIG_MTD_BLOCK=y
-CONFIG_MTD_CFI=y
-CONFIG_MTD_CFI_AMDSTD=y
-CONFIG_MTD_PHYSMAP_OF=y
-CONFIG_MTD_NAND=y
-CONFIG_MTD_NAND_FSL_ELBC=y
-CONFIG_PROC_DEVICETREE=y
-CONFIG_BLK_DEV_LOOP=y
-CONFIG_BLK_DEV_RAM=y
-CONFIG_BLK_DEV_RAM_SIZE=131072
-CONFIG_EEPROM_AT24=y
-CONFIG_EEPROM_LEGACY=y
-CONFIG_BLK_DEV_SD=y
-CONFIG_CHR_DEV_ST=y
-CONFIG_BLK_DEV_SR=y
-CONFIG_CHR_DEV_SG=y
-CONFIG_SCSI_MULTI_LUN=y
-CONFIG_SCSI_LOGGING=y
-CONFIG_ATA=y
-CONFIG_SATA_FSL=y
-CONFIG_SATA_SIL24=y
-CONFIG_NETDEVICES=y
-CONFIG_DUMMY=y
-CONFIG_FS_ENET=y
-CONFIG_FSL_PQ_MDIO=y
-CONFIG_E1000E=y
-CONFIG_PHYLIB=y
-CONFIG_AT803X_PHY=y
-CONFIG_MARVELL_PHY=y
-CONFIG_DAVICOM_PHY=y
-CONFIG_CICADA_PHY=y
-CONFIG_VITESSE_PHY=y
-CONFIG_FIXED_PHY=y
-CONFIG_INPUT_FF_MEMLESS=m
-# CONFIG_INPUT_MOUSEDEV is not set
-# CONFIG_INPUT_KEYBOARD is not set
-# CONFIG_INPUT_MOUSE is not set
-CONFIG_SERIO_LIBPS2=y
-CONFIG_SERIAL_8250=y
-CONFIG_SERIAL_8250_CONSOLE=y
-CONFIG_SERIAL_8250_NR_UARTS=2
-CONFIG_SERIAL_8250_RUNTIME_UARTS=2
-CONFIG_SERIAL_8250_EXTENDED=y
-CONFIG_SERIAL_8250_MANY_PORTS=y
-CONFIG_SERIAL_8250_SHARE_IRQ=y
-CONFIG_SERIAL_8250_DETECT_IRQ=y
-CONFIG_SERIAL_8250_RSA=y
-CONFIG_HW_RANDOM=y
-CONFIG_NVRAM=y
-CONFIG_I2C=y
-CONFIG_I2C_CHARDEV=y
-CONFIG_I2C_CPM=m
-CONFIG_I2C_MPC=y
-CONFIG_GPIO_MPC8XXX=y
-# CONFIG_HWMON is not set
-CONFIG_VIDEO_OUTPUT_CONTROL=y
-CONFIG_SOUND=y
-CONFIG_SND=y
-CONFIG_SND_MIXER_OSS=y
-CONFIG_SND_PCM_OSS=y
-# CONFIG_SND_SUPPORT_OLD_API is not set
-CONFIG_USB=y
-CONFIG_USB_DEVICEFS=y
-CONFIG_USB_MON=y
-CONFIG_USB_EHCI_HCD=y
-CONFIG_USB_EHCI_FSL=y
-CONFIG_USB_STORAGE=y
-CONFIG_EDAC=y
-CONFIG_EDAC_MM_EDAC=y
-CONFIG_RTC_CLASS=y
-CONFIG_RTC_DRV_DS1307=y
-CONFIG_RTC_DRV_CMOS=y
-CONFIG_DMADEVICES=y
-CONFIG_FSL_DMA=y
-# CONFIG_NET_DMA is not set
-CONFIG_STAGING=y
-CONFIG_EXT2_FS=y
-CONFIG_EXT3_FS=y
-# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set
-CONFIG_ISO9660_FS=m
-CONFIG_JOLIET=y
-CONFIG_ZISOFS=y
-CONFIG_UDF_FS=m
-CONFIG_MSDOS_FS=m
-CONFIG_VFAT_FS=y
-CONFIG_NTFS_FS=y
-CONFIG_PROC_KCORE=y
-CONFIG_TMPFS=y
-CONFIG_ADFS_FS=m
-CONFIG_AFFS_FS=m
-CONFIG_HFS_FS=m
-CONFIG_HFSPLUS_FS=m
-CONFIG_BEFS_FS=m
-CONFIG_BFS_FS=m
-CONFIG_EFS_FS=m
-CONFIG_CRAMFS=y
-CONFIG_VXFS_FS=m
-CONFIG_HPFS_FS=m
-CONFIG_QNX4FS_FS=m
-CONFIG_SYSV_FS=m
-CONFIG_UFS_FS=m
-CONFIG_NFS_FS=y
-CONFIG_NFS_V4=y
-CONFIG_ROOT_NFS=y
-CONFIG_NFSD=y
-CONFIG_CRC_T10DIF=y
-CONFIG_FRAME_WARN=8092
-CONFIG_DEBUG_FS=y
-CONFIG_DETECT_HUNG_TASK=y
-# CONFIG_DEBUG_BUGVERBOSE is not set
-CONFIG_DEBUG_INFO=y
-CONFIG_STRICT_DEVMEM=y
-CONFIG_CRYPTO_PCBC=m
-CONFIG_CRYPTO_SHA256=y
-CONFIG_CRYPTO_SHA512=y
-CONFIG_CRYPTO_AES=y
-# CONFIG_CRYPTO_ANSI_CPRNG is not set
-CONFIG_CRYPTO_DEV_FSL_CAAM=y
diff

[PATCH] powerpc/85xx: Merge 85xx/p1023_defconfig into mpc85xx_smp_defconfig and mpc85xx_defconfig

2013-11-08 Thread Lijun Pan
mpc85xx_smp_defconfig and mpc85xx_defconfig already have CONFIG_P1023RDS=y.
Merge CONFIG_P1023RDB=y and other relevant configurations into 
mpc85xx_smp_defconfig and mpc85_defconfig.

Signed-off-by: Lijun Pan lijun@freescale.com
---
 arch/powerpc/configs/85xx/p1023_defconfig  |  188 
 arch/powerpc/configs/mpc85xx_defconfig |   23 
 arch/powerpc/configs/mpc85xx_smp_defconfig |   20 +++
 3 files changed, 43 insertions(+), 188 deletions(-)
 delete mode 100644 arch/powerpc/configs/85xx/p1023_defconfig

diff --git a/arch/powerpc/configs/85xx/p1023_defconfig 
b/arch/powerpc/configs/85xx/p1023_defconfig
deleted file mode 100644
index b06d37d..000
--- a/arch/powerpc/configs/85xx/p1023_defconfig
+++ /dev/null
@@ -1,188 +0,0 @@
-CONFIG_PPC_85xx=y
-CONFIG_SMP=y
-CONFIG_NR_CPUS=2
-CONFIG_SYSVIPC=y
-CONFIG_POSIX_MQUEUE=y
-CONFIG_BSD_PROCESS_ACCT=y
-CONFIG_AUDIT=y
-CONFIG_NO_HZ=y
-CONFIG_HIGH_RES_TIMERS=y
-CONFIG_RCU_FANOUT=32
-CONFIG_IKCONFIG=y
-CONFIG_IKCONFIG_PROC=y
-CONFIG_LOG_BUF_SHIFT=14
-CONFIG_BLK_DEV_INITRD=y
-CONFIG_KALLSYMS_ALL=y
-CONFIG_EMBEDDED=y
-CONFIG_MODULES=y
-CONFIG_MODULE_UNLOAD=y
-CONFIG_MODULE_FORCE_UNLOAD=y
-CONFIG_MODVERSIONS=y
-# CONFIG_BLK_DEV_BSG is not set
-CONFIG_PARTITION_ADVANCED=y
-CONFIG_MAC_PARTITION=y
-CONFIG_PHYSICAL_START=0x
-CONFIG_P1023_RDB=y
-CONFIG_P1023_RDS=y
-CONFIG_QUICC_ENGINE=y
-CONFIG_QE_GPIO=y
-CONFIG_CPM2=y
-CONFIG_HIGHMEM=y
-# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
-CONFIG_BINFMT_MISC=m
-CONFIG_MATH_EMULATION=y
-CONFIG_SWIOTLB=y
-CONFIG_PCI=y
-CONFIG_PCIEPORTBUS=y
-# CONFIG_PCIEAER is not set
-# CONFIG_PCIEASPM is not set
-CONFIG_PCI_MSI=y
-CONFIG_NET=y
-CONFIG_PACKET=y
-CONFIG_UNIX=y
-CONFIG_XFRM_USER=y
-CONFIG_NET_KEY=y
-CONFIG_INET=y
-CONFIG_IP_MULTICAST=y
-CONFIG_IP_ADVANCED_ROUTER=y
-CONFIG_IP_MULTIPLE_TABLES=y
-CONFIG_IP_ROUTE_MULTIPATH=y
-CONFIG_IP_ROUTE_VERBOSE=y
-CONFIG_IP_PNP=y
-CONFIG_IP_PNP_DHCP=y
-CONFIG_IP_PNP_BOOTP=y
-CONFIG_IP_PNP_RARP=y
-CONFIG_NET_IPIP=y
-CONFIG_IP_MROUTE=y
-CONFIG_IP_PIMSM_V1=y
-CONFIG_IP_PIMSM_V2=y
-CONFIG_ARPD=y
-CONFIG_INET_ESP=y
-# CONFIG_INET_XFRM_MODE_BEET is not set
-# CONFIG_INET_LRO is not set
-CONFIG_IPV6=y
-CONFIG_IP_SCTP=m
-CONFIG_UEVENT_HELPER_PATH=/sbin/hotplug
-CONFIG_DEVTMPFS=y
-CONFIG_DEVTMPFS_MOUNT=y
-CONFIG_MTD=y
-CONFIG_MTD_CMDLINE_PARTS=y
-CONFIG_MTD_CHAR=y
-CONFIG_MTD_BLOCK=y
-CONFIG_MTD_CFI=y
-CONFIG_MTD_CFI_AMDSTD=y
-CONFIG_MTD_PHYSMAP_OF=y
-CONFIG_MTD_NAND=y
-CONFIG_MTD_NAND_FSL_ELBC=y
-CONFIG_PROC_DEVICETREE=y
-CONFIG_BLK_DEV_LOOP=y
-CONFIG_BLK_DEV_RAM=y
-CONFIG_BLK_DEV_RAM_SIZE=131072
-CONFIG_EEPROM_AT24=y
-CONFIG_EEPROM_LEGACY=y
-CONFIG_BLK_DEV_SD=y
-CONFIG_CHR_DEV_ST=y
-CONFIG_BLK_DEV_SR=y
-CONFIG_CHR_DEV_SG=y
-CONFIG_SCSI_MULTI_LUN=y
-CONFIG_SCSI_LOGGING=y
-CONFIG_ATA=y
-CONFIG_SATA_FSL=y
-CONFIG_SATA_SIL24=y
-CONFIG_NETDEVICES=y
-CONFIG_DUMMY=y
-CONFIG_FS_ENET=y
-CONFIG_FSL_PQ_MDIO=y
-CONFIG_E1000E=y
-CONFIG_PHYLIB=y
-CONFIG_AT803X_PHY=y
-CONFIG_MARVELL_PHY=y
-CONFIG_DAVICOM_PHY=y
-CONFIG_CICADA_PHY=y
-CONFIG_VITESSE_PHY=y
-CONFIG_FIXED_PHY=y
-CONFIG_INPUT_FF_MEMLESS=m
-# CONFIG_INPUT_MOUSEDEV is not set
-# CONFIG_INPUT_KEYBOARD is not set
-# CONFIG_INPUT_MOUSE is not set
-CONFIG_SERIO_LIBPS2=y
-CONFIG_SERIAL_8250=y
-CONFIG_SERIAL_8250_CONSOLE=y
-CONFIG_SERIAL_8250_NR_UARTS=2
-CONFIG_SERIAL_8250_RUNTIME_UARTS=2
-CONFIG_SERIAL_8250_EXTENDED=y
-CONFIG_SERIAL_8250_MANY_PORTS=y
-CONFIG_SERIAL_8250_SHARE_IRQ=y
-CONFIG_SERIAL_8250_DETECT_IRQ=y
-CONFIG_SERIAL_8250_RSA=y
-CONFIG_HW_RANDOM=y
-CONFIG_NVRAM=y
-CONFIG_I2C=y
-CONFIG_I2C_CHARDEV=y
-CONFIG_I2C_CPM=m
-CONFIG_I2C_MPC=y
-CONFIG_GPIO_MPC8XXX=y
-# CONFIG_HWMON is not set
-CONFIG_VIDEO_OUTPUT_CONTROL=y
-CONFIG_SOUND=y
-CONFIG_SND=y
-CONFIG_SND_MIXER_OSS=y
-CONFIG_SND_PCM_OSS=y
-# CONFIG_SND_SUPPORT_OLD_API is not set
-CONFIG_USB=y
-CONFIG_USB_DEVICEFS=y
-CONFIG_USB_MON=y
-CONFIG_USB_EHCI_HCD=y
-CONFIG_USB_EHCI_FSL=y
-CONFIG_USB_STORAGE=y
-CONFIG_EDAC=y
-CONFIG_EDAC_MM_EDAC=y
-CONFIG_RTC_CLASS=y
-CONFIG_RTC_DRV_DS1307=y
-CONFIG_RTC_DRV_CMOS=y
-CONFIG_DMADEVICES=y
-CONFIG_FSL_DMA=y
-# CONFIG_NET_DMA is not set
-CONFIG_STAGING=y
-CONFIG_EXT2_FS=y
-CONFIG_EXT3_FS=y
-# CONFIG_EXT3_DEFAULTS_TO_ORDERED is not set
-CONFIG_ISO9660_FS=m
-CONFIG_JOLIET=y
-CONFIG_ZISOFS=y
-CONFIG_UDF_FS=m
-CONFIG_MSDOS_FS=m
-CONFIG_VFAT_FS=y
-CONFIG_NTFS_FS=y
-CONFIG_PROC_KCORE=y
-CONFIG_TMPFS=y
-CONFIG_ADFS_FS=m
-CONFIG_AFFS_FS=m
-CONFIG_HFS_FS=m
-CONFIG_HFSPLUS_FS=m
-CONFIG_BEFS_FS=m
-CONFIG_BFS_FS=m
-CONFIG_EFS_FS=m
-CONFIG_CRAMFS=y
-CONFIG_VXFS_FS=m
-CONFIG_HPFS_FS=m
-CONFIG_QNX4FS_FS=m
-CONFIG_SYSV_FS=m
-CONFIG_UFS_FS=m
-CONFIG_NFS_FS=y
-CONFIG_NFS_V4=y
-CONFIG_ROOT_NFS=y
-CONFIG_NFSD=y
-CONFIG_CRC_T10DIF=y
-CONFIG_FRAME_WARN=8092
-CONFIG_DEBUG_FS=y
-CONFIG_DETECT_HUNG_TASK=y
-# CONFIG_DEBUG_BUGVERBOSE is not set
-CONFIG_DEBUG_INFO=y
-CONFIG_STRICT_DEVMEM=y
-CONFIG_CRYPTO_PCBC=m
-CONFIG_CRYPTO_SHA256=y
-CONFIG_CRYPTO_SHA512=y
-CONFIG_CRYPTO_AES=y
-# CONFIG_CRYPTO_ANSI_CPRNG is not set
-CONFIG_CRYPTO_DEV_FSL_CAAM=y
diff

[PATCH 2/2] powerpc/e500v2: Include Power ISA properties

2013-10-24 Thread Lijun Pan
bsc9131 device tree does not have these properties.

Signed-off-by: Lijun Pan lijun@freescale.com
---
 arch/powerpc/boot/dts/fsl/bsc9131si-pre.dtsi |3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/powerpc/boot/dts/fsl/bsc9131si-pre.dtsi 
b/arch/powerpc/boot/dts/fsl/bsc9131si-pre.dtsi
index 743e4ae..f6ec4a6 100644
--- a/arch/powerpc/boot/dts/fsl/bsc9131si-pre.dtsi
+++ b/arch/powerpc/boot/dts/fsl/bsc9131si-pre.dtsi
@@ -33,6 +33,9 @@
  */
 
 /dts-v1/;
+
+/include/ e500v2_power_isa.dtsi
+
 / {
compatible = fsl,BSC9131;
#address-cells = 2;
-- 
1.7.9.7


___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH 1/2] powerpc/e6500: Include Power ISA properties

2013-10-24 Thread Lijun Pan
b4420 and b4860 device trees do not have these properties.

Signed-off-by: Lijun Pan lijun@freescale.com
---
 arch/powerpc/boot/dts/fsl/b4420si-pre.dtsi |2 ++
 arch/powerpc/boot/dts/fsl/b4860si-pre.dtsi |2 ++
 2 files changed, 4 insertions(+)

diff --git a/arch/powerpc/boot/dts/fsl/b4420si-pre.dtsi 
b/arch/powerpc/boot/dts/fsl/b4420si-pre.dtsi
index 7b4426e..cbaecf1 100644
--- a/arch/powerpc/boot/dts/fsl/b4420si-pre.dtsi
+++ b/arch/powerpc/boot/dts/fsl/b4420si-pre.dtsi
@@ -34,6 +34,8 @@
 
 /dts-v1/;
 
+/include/ e6500_power_isa.dtsi:
+
 / {
compatible = fsl,B4420;
#address-cells = 2;
diff --git a/arch/powerpc/boot/dts/fsl/b4860si-pre.dtsi 
b/arch/powerpc/boot/dts/fsl/b4860si-pre.dtsi
index 5263fa4..9bc26b1 100644
--- a/arch/powerpc/boot/dts/fsl/b4860si-pre.dtsi
+++ b/arch/powerpc/boot/dts/fsl/b4860si-pre.dtsi
@@ -34,6 +34,8 @@
 
 /dts-v1/;
 
+/include/ e6500_power_isa.dtsi
+
 / {
compatible = fsl,B4860;
#address-cells = 2;
-- 
1.7.9.7


___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH 1/2 v2] powerpc/e6500: Include Power ISA properties

2013-10-24 Thread Lijun Pan
b4420 and b4860 device trees do not have these properties.

Signed-off-by: Lijun Pan lijun@freescale.com
---
v2: fixed a typo

 arch/powerpc/boot/dts/fsl/b4420si-pre.dtsi |2 ++
 arch/powerpc/boot/dts/fsl/b4860si-pre.dtsi |2 ++
 2 files changed, 4 insertions(+)

diff --git a/arch/powerpc/boot/dts/fsl/b4420si-pre.dtsi 
b/arch/powerpc/boot/dts/fsl/b4420si-pre.dtsi
index 7b4426e..c6e451a 100644
--- a/arch/powerpc/boot/dts/fsl/b4420si-pre.dtsi
+++ b/arch/powerpc/boot/dts/fsl/b4420si-pre.dtsi
@@ -34,6 +34,8 @@
 
 /dts-v1/;
 
+/include/ e6500_power_isa.dtsi
+
 / {
compatible = fsl,B4420;
#address-cells = 2;
diff --git a/arch/powerpc/boot/dts/fsl/b4860si-pre.dtsi 
b/arch/powerpc/boot/dts/fsl/b4860si-pre.dtsi
index 5263fa4..9bc26b1 100644
--- a/arch/powerpc/boot/dts/fsl/b4860si-pre.dtsi
+++ b/arch/powerpc/boot/dts/fsl/b4860si-pre.dtsi
@@ -34,6 +34,8 @@
 
 /dts-v1/;
 
+/include/ e6500_power_isa.dtsi
+
 / {
compatible = fsl,B4860;
#address-cells = 2;
-- 
1.7.9.7


___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH 1/4] powerpc/perf: correct typos in counter enumeration

2013-06-05 Thread Lijun Pan
Signed-off-by: Lijun Pan lijun@freescale.com
---
 arch/powerpc/include/asm/reg_fsl_emb.h |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/include/asm/reg_fsl_emb.h 
b/arch/powerpc/include/asm/reg_fsl_emb.h
index 77bb71c..1cf8ab0 100644
--- a/arch/powerpc/include/asm/reg_fsl_emb.h
+++ b/arch/powerpc/include/asm/reg_fsl_emb.h
@@ -17,8 +17,8 @@
 /* Freescale Book E Performance Monitor APU Registers */
 #define PMRN_PMC0  0x010   /* Performance Monitor Counter 0 */
 #define PMRN_PMC1  0x011   /* Performance Monitor Counter 1 */
-#define PMRN_PMC2  0x012   /* Performance Monitor Counter 1 */
-#define PMRN_PMC3  0x013   /* Performance Monitor Counter 1 */
+#define PMRN_PMC2  0x012   /* Performance Monitor Counter 2 */
+#define PMRN_PMC3  0x013   /* Performance Monitor Counter 3 */
 #define PMRN_PMLCA00x090   /* PM Local Control A0 */
 #define PMRN_PMLCA10x091   /* PM Local Control A1 */
 #define PMRN_PMLCA20x092   /* PM Local Control A2 */
@@ -55,8 +55,8 @@
 
 #define PMRN_UPMC0 0x000   /* User Performance Monitor Counter 0 */
 #define PMRN_UPMC1 0x001   /* User Performance Monitor Counter 1 */
-#define PMRN_UPMC2 0x002   /* User Performance Monitor Counter 1 */
-#define PMRN_UPMC3 0x003   /* User Performance Monitor Counter 1 */
+#define PMRN_UPMC2 0x002   /* User Performance Monitor Counter 2 */
+#define PMRN_UPMC3 0x003   /* User Performance Monitor Counter 3 */
 #define PMRN_UPMLCA0   0x080   /* User PM Local Control A0 */
 #define PMRN_UPMLCA1   0x081   /* User PM Local Control A1 */
 #define PMRN_UPMLCA2   0x082   /* User PM Local Control A2 */
-- 
1.7.9.7


___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH 4/4] powerpc/perf: Add e6500 PMU driver

2013-06-05 Thread Lijun Pan
e6500 core performance monitors has the following features:
- 6 performance monitor counters
- 512 events supported
- no threshold events

e6500 PMU has more specific events (Data L1 cache misses, Instruction L1
cache misses, etc ) than e500 PMU (which only had Data L1 cache reloads,
etc). Where available, the more specific events have been used which will
produce slightly different results than e500 PMU equivalents.

Based on work done by Priyanka Jain

Signed-off-by: Lijun Pan lijun@freescale.com
Signed-off-by: Priyanka Jain priyanka.j...@freescale.com
Signed-off-by: Poonam Aggrwal poonam.aggr...@freescale.com
---
 arch/powerpc/include/asm/reg_fsl_emb.h |4 +-
 arch/powerpc/perf/Makefile |2 +-
 arch/powerpc/perf/e6500-pmu.c  |  120 
 3 files changed, 124 insertions(+), 2 deletions(-)
 create mode 100644 arch/powerpc/perf/e6500-pmu.c

diff --git a/arch/powerpc/include/asm/reg_fsl_emb.h 
b/arch/powerpc/include/asm/reg_fsl_emb.h
index c51d52e..0e3ddf5 100644
--- a/arch/powerpc/include/asm/reg_fsl_emb.h
+++ b/arch/powerpc/include/asm/reg_fsl_emb.h
@@ -34,8 +34,10 @@
 #define PMLCA_FCM1 0x1000  /* Freeze when PMM==1 */
 #define PMLCA_FCM0 0x0800  /* Freeze when PMM==0 */
 #define PMLCA_CE   0x0400  /* Condition Enable */
+#define PMLCA_FGCS10x0002  /* Freeze in guest state */
+#define PMLCA_FGCS00x0001  /* Freeze in hypervisor state */
 
-#define PMLCA_EVENT_MASK 0x00ff/* Event field */
+#define PMLCA_EVENT_MASK 0x01ff/* Event field */
 #define PMLCA_EVENT_SHIFT  16
 
 #define PMRN_PMLCB00x110   /* PM Local Control B0 */
diff --git a/arch/powerpc/perf/Makefile b/arch/powerpc/perf/Makefile
index af3fac2..06dd8d5 100644
--- a/arch/powerpc/perf/Makefile
+++ b/arch/powerpc/perf/Makefile
@@ -8,7 +8,7 @@ obj64-$(CONFIG_PPC_PERF_CTRS)   += power4-pmu.o ppc970-pmu.o 
power5-pmu.o \
 obj32-$(CONFIG_PPC_PERF_CTRS)  += mpc7450-pmu.o
 
 obj-$(CONFIG_FSL_EMB_PERF_EVENT) += core-fsl-emb.o
-obj-$(CONFIG_FSL_EMB_PERF_EVENT_E500) += e500-pmu.o
+obj-$(CONFIG_FSL_EMB_PERF_EVENT_E500) += e500-pmu.o e6500-pmu.o
 
 obj-$(CONFIG_PPC64)+= $(obj64-y)
 obj-$(CONFIG_PPC32)+= $(obj32-y)
diff --git a/arch/powerpc/perf/e6500-pmu.c b/arch/powerpc/perf/e6500-pmu.c
new file mode 100644
index 000..e38ed1f
--- /dev/null
+++ b/arch/powerpc/perf/e6500-pmu.c
@@ -0,0 +1,120 @@
+/*
+ * Performance counter support for e6500 family processors.
+ *
+ * Based on e500-pmu.c
+ * Copyright 2013 Freescale Semiconductor, Inc.
+ * Copyright 2008-2009 Paul Mackerras, IBM Corporation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ */
+
+#include linux/string.h
+#include linux/perf_event.h
+#include asm/reg.h
+#include asm/cputable.h
+
+/*
+ * Map of generic hardware event types to hardware events
+ * Zero if unsupported
+ */
+static int e6500_generic_events[] = {
+   [PERF_COUNT_HW_CPU_CYCLES] = 1,
+   [PERF_COUNT_HW_INSTRUCTIONS] = 2,
+   [PERF_COUNT_HW_CACHE_MISSES] = 221,
+   [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = 12,
+   [PERF_COUNT_HW_BRANCH_MISSES] = 15,
+};
+
+#define C(x)   PERF_COUNT_HW_CACHE_##x
+
+/*
+ * Table of generalized cache-related events.
+ * 0 means not supported, -1 means nonsensical, other values
+ * are event codes.
+ */
+static int e6500_cache_events[C(MAX)][C(OP_MAX)][C(RESULT_MAX)] = {
+   [C(L1D)] = {
+   /*RESULT_ACCESS RESULT_MISS */
+   [C(OP_READ)] = {27, 222 },
+   [C(OP_WRITE)] = {   28, 223 },
+   [C(OP_PREFETCH)] = {29, 0   },
+   },
+   [C(L1I)] = {
+   /*RESULT_ACCESS RESULT_MISS */
+   [C(OP_READ)] = {2,  254 },
+   [C(OP_WRITE)] = {   -1, -1  },
+   [C(OP_PREFETCH)] = {37, 0   },
+   },
+   /*
+* Assuming LL means L2, it's not a good match for this model.
+* It does not have separate read/write events (but it does have
+* separate instruction/data events).
+*/
+   [C(LL)] = {
+   /*RESULT_ACCESS RESULT_MISS */
+   [C(OP_READ)] = {0,  0   },
+   [C(OP_WRITE)] = {   0,  0   },
+   [C(OP_PREFETCH)] = {0,  0   },
+   },
+   /*
+* There are data/instruction MMU misses, but that's a miss on
+* the chip's internal level-one TLB which is probably not
+* what the user wants.  Instead, unified level-two TLB misses
+* are reported here

[PATCH 2/4] powerpc/perf: increase the perf HW events to 6

2013-06-05 Thread Lijun Pan
From: Catalin Udma catalin.u...@freescale.com

This change is required after the e6500 perf support has been added.
There are 6 counters in e6500 core instead of 4 in e500 core and
the MAX_HWEVENTS counter should be changed accordingly from 4 to 6.
Added also runtime check for counters overflow.

Signed-off-by: Catalin Udma catalin.u...@freescale.com
Signed-off-by: Lijun Pan lijun@freescale.com
---
 arch/powerpc/include/asm/perf_event_fsl_emb.h |2 +-
 arch/powerpc/perf/core-fsl-emb.c  |6 ++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/include/asm/perf_event_fsl_emb.h 
b/arch/powerpc/include/asm/perf_event_fsl_emb.h
index 718a9fa..a581654 100644
--- a/arch/powerpc/include/asm/perf_event_fsl_emb.h
+++ b/arch/powerpc/include/asm/perf_event_fsl_emb.h
@@ -13,7 +13,7 @@
 #include linux/types.h
 #include asm/hw_irq.h
 
-#define MAX_HWEVENTS 4
+#define MAX_HWEVENTS 6
 
 /* event flags */
 #define FSL_EMB_EVENT_VALID  1
diff --git a/arch/powerpc/perf/core-fsl-emb.c b/arch/powerpc/perf/core-fsl-emb.c
index 106c533..0b13f74 100644
--- a/arch/powerpc/perf/core-fsl-emb.c
+++ b/arch/powerpc/perf/core-fsl-emb.c
@@ -462,6 +462,12 @@ static int fsl_emb_pmu_event_init(struct perf_event *event)
int num_restricted;
int i;
 
+   if (ppmu-n_counter  MAX_HWEVENTS) {
+   WARN(1, No. of perf counters (%d) is higher than max array 
size(%d)\n,
+   ppmu-n_counter, MAX_HWEVENTS);
+   ppmu-n_counter = MAX_HWEVENTS;
+   }
+
switch (event-attr.type) {
case PERF_TYPE_HARDWARE:
ev = event-attr.config;
-- 
1.7.9.7


___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH 3/4] powerpc/perf: add 2 additional performance monitor counters for e6500 core

2013-06-05 Thread Lijun Pan
There are 6 counters in e6500 core instead of 4 in e500 core.

Signed-off-by: Lijun Pan lijun@freescale.com
---
 arch/powerpc/include/asm/reg_fsl_emb.h   |   12 
 arch/powerpc/kernel/cputable.c   |2 +-
 arch/powerpc/oprofile/op_model_fsl_emb.c |   30 ++
 arch/powerpc/perf/core-fsl-emb.c |   24 
 4 files changed, 67 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/include/asm/reg_fsl_emb.h 
b/arch/powerpc/include/asm/reg_fsl_emb.h
index 1cf8ab0..c51d52e 100644
--- a/arch/powerpc/include/asm/reg_fsl_emb.h
+++ b/arch/powerpc/include/asm/reg_fsl_emb.h
@@ -19,10 +19,14 @@
 #define PMRN_PMC1  0x011   /* Performance Monitor Counter 1 */
 #define PMRN_PMC2  0x012   /* Performance Monitor Counter 2 */
 #define PMRN_PMC3  0x013   /* Performance Monitor Counter 3 */
+#define PMRN_PMC4  0x014   /* Performance Monitor Counter 4 */
+#define PMRN_PMC5  0x015   /* Performance Monitor Counter 5 */
 #define PMRN_PMLCA00x090   /* PM Local Control A0 */
 #define PMRN_PMLCA10x091   /* PM Local Control A1 */
 #define PMRN_PMLCA20x092   /* PM Local Control A2 */
 #define PMRN_PMLCA30x093   /* PM Local Control A3 */
+#define PMRN_PMLCA40x094   /* PM Local Control A4 */
+#define PMRN_PMLCA50x095   /* PM Local Control A5 */
 
 #define PMLCA_FC   0x8000  /* Freeze Counter */
 #define PMLCA_FCS  0x4000  /* Freeze in Supervisor */
@@ -38,6 +42,8 @@
 #define PMRN_PMLCB10x111   /* PM Local Control B1 */
 #define PMRN_PMLCB20x112   /* PM Local Control B2 */
 #define PMRN_PMLCB30x113   /* PM Local Control B3 */
+#define PMRN_PMLCB40x114   /* PM Local Control B4 */
+#define PMRN_PMLCB50x115   /* PM Local Control B5 */
 
 #define PMLCB_THRESHMUL_MASK   0x0700  /* Threshold Multiple Field */
 #define PMLCB_THRESHMUL_SHIFT  8
@@ -57,14 +63,20 @@
 #define PMRN_UPMC1 0x001   /* User Performance Monitor Counter 1 */
 #define PMRN_UPMC2 0x002   /* User Performance Monitor Counter 2 */
 #define PMRN_UPMC3 0x003   /* User Performance Monitor Counter 3 */
+#define PMRN_UPMC4 0x004   /* User Performance Monitor Counter 4 */
+#define PMRN_UPMC5 0x005   /* User Performance Monitor Counter 5 */
 #define PMRN_UPMLCA0   0x080   /* User PM Local Control A0 */
 #define PMRN_UPMLCA1   0x081   /* User PM Local Control A1 */
 #define PMRN_UPMLCA2   0x082   /* User PM Local Control A2 */
 #define PMRN_UPMLCA3   0x083   /* User PM Local Control A3 */
+#define PMRN_UPMLCA4   0x084   /* User PM Local Control A4 */
+#define PMRN_UPMLCA5   0x085   /* User PM Local Control A5 */
 #define PMRN_UPMLCB0   0x100   /* User PM Local Control B0 */
 #define PMRN_UPMLCB1   0x101   /* User PM Local Control B1 */
 #define PMRN_UPMLCB2   0x102   /* User PM Local Control B2 */
 #define PMRN_UPMLCB3   0x103   /* User PM Local Control B3 */
+#define PMRN_UPMLCB4   0x104   /* User PM Local Control B4 */
+#define PMRN_UPMLCB5   0x105   /* User PM Local Control B5 */
 #define PMRN_UPMGC00x180   /* User PM Global Control 0 */
 
 
diff --git a/arch/powerpc/kernel/cputable.c b/arch/powerpc/kernel/cputable.c
index cc39139..2d4eee2 100644
--- a/arch/powerpc/kernel/cputable.c
+++ b/arch/powerpc/kernel/cputable.c
@@ -2073,7 +2073,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
MMU_FTR_USE_TLBILX,
.icache_bsize   = 64,
.dcache_bsize   = 64,
-   .num_pmcs   = 4,
+   .num_pmcs   = 6,
.oprofile_cpu_type  = ppc/e6500,
.oprofile_type  = PPC_OPROFILE_FSL_EMB,
.cpu_setup  = __setup_cpu_e6500,
diff --git a/arch/powerpc/oprofile/op_model_fsl_emb.c 
b/arch/powerpc/oprofile/op_model_fsl_emb.c
index ccc1daa..2a82d3e 100644
--- a/arch/powerpc/oprofile/op_model_fsl_emb.c
+++ b/arch/powerpc/oprofile/op_model_fsl_emb.c
@@ -46,6 +46,12 @@ static inline u32 get_pmlca(int ctr)
case 3:
pmlca = mfpmr(PMRN_PMLCA3);
break;
+   case 4:
+   pmlca = mfpmr(PMRN_PMLCA4);
+   break;
+   case 5:
+   pmlca = mfpmr(PMRN_PMLCA5);
+   break;
default:
panic(Bad ctr number\n);
}
@@ -68,6 +74,12 @@ static inline void set_pmlca(int ctr, u32 pmlca)
case 3:
mtpmr(PMRN_PMLCA3, pmlca);
break;
+   case 4:
+   mtpmr(PMRN_PMLCA4, pmlca);
+   break;
+   case 5:
+   mtpmr(PMRN_PMLCA5, pmlca);
+   break;
default:
panic(Bad ctr number\n);
}
@@ -84,6 +96,10 @@ static inline unsigned int ctr_read(unsigned int i

[PATCH 4/4] powerpc/perf: Add e6500 PMU driver

2013-06-05 Thread Lijun Pan
e6500 core performance monitors has the following features:
- 6 performance monitor counters
- 512 events supported
- no threshold events

e6500 PMU has more specific events (Data L1 cache misses, Instruction L1
cache misses, etc ) than e500 PMU (which only had Data L1 cache reloads,
etc). Where available, the more specific events have been used which will
produce slightly different results than e500 PMU equivalents.

Author: Priyanka Jain

Signed-off-by: Priyanka Jain priyanka.j...@freescale.com
Signed-off-by: Lijun Pan lijun@freescale.com
---
 arch/powerpc/include/asm/reg_fsl_emb.h |4 +-
 arch/powerpc/perf/Makefile |2 +-
 arch/powerpc/perf/e6500-pmu.c  |  121 
 3 files changed, 125 insertions(+), 2 deletions(-)
 create mode 100644 arch/powerpc/perf/e6500-pmu.c

diff --git a/arch/powerpc/include/asm/reg_fsl_emb.h 
b/arch/powerpc/include/asm/reg_fsl_emb.h
index c51d52e..0e3ddf5 100644
--- a/arch/powerpc/include/asm/reg_fsl_emb.h
+++ b/arch/powerpc/include/asm/reg_fsl_emb.h
@@ -34,8 +34,10 @@
 #define PMLCA_FCM1 0x1000  /* Freeze when PMM==1 */
 #define PMLCA_FCM0 0x0800  /* Freeze when PMM==0 */
 #define PMLCA_CE   0x0400  /* Condition Enable */
+#define PMLCA_FGCS10x0002  /* Freeze in guest state */
+#define PMLCA_FGCS00x0001  /* Freeze in hypervisor state */
 
-#define PMLCA_EVENT_MASK 0x00ff/* Event field */
+#define PMLCA_EVENT_MASK 0x01ff/* Event field */
 #define PMLCA_EVENT_SHIFT  16
 
 #define PMRN_PMLCB00x110   /* PM Local Control B0 */
diff --git a/arch/powerpc/perf/Makefile b/arch/powerpc/perf/Makefile
index af3fac2..06dd8d5 100644
--- a/arch/powerpc/perf/Makefile
+++ b/arch/powerpc/perf/Makefile
@@ -8,7 +8,7 @@ obj64-$(CONFIG_PPC_PERF_CTRS)   += power4-pmu.o ppc970-pmu.o 
power5-pmu.o \
 obj32-$(CONFIG_PPC_PERF_CTRS)  += mpc7450-pmu.o
 
 obj-$(CONFIG_FSL_EMB_PERF_EVENT) += core-fsl-emb.o
-obj-$(CONFIG_FSL_EMB_PERF_EVENT_E500) += e500-pmu.o
+obj-$(CONFIG_FSL_EMB_PERF_EVENT_E500) += e500-pmu.o e6500-pmu.o
 
 obj-$(CONFIG_PPC64)+= $(obj64-y)
 obj-$(CONFIG_PPC32)+= $(obj32-y)
diff --git a/arch/powerpc/perf/e6500-pmu.c b/arch/powerpc/perf/e6500-pmu.c
new file mode 100644
index 000..3d877aa
--- /dev/null
+++ b/arch/powerpc/perf/e6500-pmu.c
@@ -0,0 +1,121 @@
+/*
+ * Performance counter support for e6500 family processors.
+ *
+ * Author: Priyanka Jain, priyanka.j...@freescale.com
+ * Based on e500-pmu.c
+ * Copyright 2013 Freescale Semiconductor, Inc.
+ * Copyright 2008-2009 Paul Mackerras, IBM Corporation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ */
+
+#include linux/string.h
+#include linux/perf_event.h
+#include asm/reg.h
+#include asm/cputable.h
+
+/*
+ * Map of generic hardware event types to hardware events
+ * Zero if unsupported
+ */
+static int e6500_generic_events[] = {
+   [PERF_COUNT_HW_CPU_CYCLES] = 1,
+   [PERF_COUNT_HW_INSTRUCTIONS] = 2,
+   [PERF_COUNT_HW_CACHE_MISSES] = 221,
+   [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = 12,
+   [PERF_COUNT_HW_BRANCH_MISSES] = 15,
+};
+
+#define C(x)   PERF_COUNT_HW_CACHE_##x
+
+/*
+ * Table of generalized cache-related events.
+ * 0 means not supported, -1 means nonsensical, other values
+ * are event codes.
+ */
+static int e6500_cache_events[C(MAX)][C(OP_MAX)][C(RESULT_MAX)] = {
+   [C(L1D)] = {
+   /*RESULT_ACCESS RESULT_MISS */
+   [C(OP_READ)] = {27, 222 },
+   [C(OP_WRITE)] = {   28, 223 },
+   [C(OP_PREFETCH)] = {29, 0   },
+   },
+   [C(L1I)] = {
+   /*RESULT_ACCESS RESULT_MISS */
+   [C(OP_READ)] = {2,  254 },
+   [C(OP_WRITE)] = {   -1, -1  },
+   [C(OP_PREFETCH)] = {37, 0   },
+   },
+   /*
+* Assuming LL means L2, it's not a good match for this model.
+* It does not have separate read/write events (but it does have
+* separate instruction/data events).
+*/
+   [C(LL)] = {
+   /*RESULT_ACCESS RESULT_MISS */
+   [C(OP_READ)] = {0,  0   },
+   [C(OP_WRITE)] = {   0,  0   },
+   [C(OP_PREFETCH)] = {0,  0   },
+   },
+   /*
+* There are data/instruction MMU misses, but that's a miss on
+* the chip's internal level-one TLB which is probably not
+* what the user wants.  Instead, unified level-two TLB misses
+* are reported here

[PATCH 2/4] powerpc/perf: increase the perf HW events to 6

2013-06-05 Thread Lijun Pan
From: Catalin Udma catalin.u...@freescale.com

This change is required after the e6500 perf support has been added.
There are 6 counters in e6500 core instead of 4 in e500 core and
the MAX_HWEVENTS counter should be changed accordingly from 4 to 6.
Added also runtime check for counters overflow.

Signed-off-by: Catalin Udma catalin.u...@freescale.com
Signed-off-by: Lijun Pan lijun@freescale.com
---
 arch/powerpc/include/asm/perf_event_fsl_emb.h |2 +-
 arch/powerpc/perf/core-fsl-emb.c  |6 ++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/include/asm/perf_event_fsl_emb.h 
b/arch/powerpc/include/asm/perf_event_fsl_emb.h
index 718a9fa..a581654 100644
--- a/arch/powerpc/include/asm/perf_event_fsl_emb.h
+++ b/arch/powerpc/include/asm/perf_event_fsl_emb.h
@@ -13,7 +13,7 @@
 #include linux/types.h
 #include asm/hw_irq.h
 
-#define MAX_HWEVENTS 4
+#define MAX_HWEVENTS 6
 
 /* event flags */
 #define FSL_EMB_EVENT_VALID  1
diff --git a/arch/powerpc/perf/core-fsl-emb.c b/arch/powerpc/perf/core-fsl-emb.c
index 106c533..0b13f74 100644
--- a/arch/powerpc/perf/core-fsl-emb.c
+++ b/arch/powerpc/perf/core-fsl-emb.c
@@ -462,6 +462,12 @@ static int fsl_emb_pmu_event_init(struct perf_event *event)
int num_restricted;
int i;
 
+   if (ppmu-n_counter  MAX_HWEVENTS) {
+   WARN(1, No. of perf counters (%d) is higher than max array 
size(%d)\n,
+   ppmu-n_counter, MAX_HWEVENTS);
+   ppmu-n_counter = MAX_HWEVENTS;
+   }
+
switch (event-attr.type) {
case PERF_TYPE_HARDWARE:
ev = event-attr.config;
-- 
1.7.9.7


___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH 3/4] powerpc/perf: add 2 additional performance monitor counters for e6500 core

2013-06-05 Thread Lijun Pan
There are 6 counters in e6500 core instead of 4 in e500 core.

Signed-off-by: Lijun Pan lijun@freescale.com
---
 arch/powerpc/include/asm/reg_fsl_emb.h   |   12 
 arch/powerpc/kernel/cputable.c   |2 +-
 arch/powerpc/oprofile/op_model_fsl_emb.c |   30 ++
 arch/powerpc/perf/core-fsl-emb.c |   24 
 4 files changed, 67 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/include/asm/reg_fsl_emb.h 
b/arch/powerpc/include/asm/reg_fsl_emb.h
index 1cf8ab0..c51d52e 100644
--- a/arch/powerpc/include/asm/reg_fsl_emb.h
+++ b/arch/powerpc/include/asm/reg_fsl_emb.h
@@ -19,10 +19,14 @@
 #define PMRN_PMC1  0x011   /* Performance Monitor Counter 1 */
 #define PMRN_PMC2  0x012   /* Performance Monitor Counter 2 */
 #define PMRN_PMC3  0x013   /* Performance Monitor Counter 3 */
+#define PMRN_PMC4  0x014   /* Performance Monitor Counter 4 */
+#define PMRN_PMC5  0x015   /* Performance Monitor Counter 5 */
 #define PMRN_PMLCA00x090   /* PM Local Control A0 */
 #define PMRN_PMLCA10x091   /* PM Local Control A1 */
 #define PMRN_PMLCA20x092   /* PM Local Control A2 */
 #define PMRN_PMLCA30x093   /* PM Local Control A3 */
+#define PMRN_PMLCA40x094   /* PM Local Control A4 */
+#define PMRN_PMLCA50x095   /* PM Local Control A5 */
 
 #define PMLCA_FC   0x8000  /* Freeze Counter */
 #define PMLCA_FCS  0x4000  /* Freeze in Supervisor */
@@ -38,6 +42,8 @@
 #define PMRN_PMLCB10x111   /* PM Local Control B1 */
 #define PMRN_PMLCB20x112   /* PM Local Control B2 */
 #define PMRN_PMLCB30x113   /* PM Local Control B3 */
+#define PMRN_PMLCB40x114   /* PM Local Control B4 */
+#define PMRN_PMLCB50x115   /* PM Local Control B5 */
 
 #define PMLCB_THRESHMUL_MASK   0x0700  /* Threshold Multiple Field */
 #define PMLCB_THRESHMUL_SHIFT  8
@@ -57,14 +63,20 @@
 #define PMRN_UPMC1 0x001   /* User Performance Monitor Counter 1 */
 #define PMRN_UPMC2 0x002   /* User Performance Monitor Counter 2 */
 #define PMRN_UPMC3 0x003   /* User Performance Monitor Counter 3 */
+#define PMRN_UPMC4 0x004   /* User Performance Monitor Counter 4 */
+#define PMRN_UPMC5 0x005   /* User Performance Monitor Counter 5 */
 #define PMRN_UPMLCA0   0x080   /* User PM Local Control A0 */
 #define PMRN_UPMLCA1   0x081   /* User PM Local Control A1 */
 #define PMRN_UPMLCA2   0x082   /* User PM Local Control A2 */
 #define PMRN_UPMLCA3   0x083   /* User PM Local Control A3 */
+#define PMRN_UPMLCA4   0x084   /* User PM Local Control A4 */
+#define PMRN_UPMLCA5   0x085   /* User PM Local Control A5 */
 #define PMRN_UPMLCB0   0x100   /* User PM Local Control B0 */
 #define PMRN_UPMLCB1   0x101   /* User PM Local Control B1 */
 #define PMRN_UPMLCB2   0x102   /* User PM Local Control B2 */
 #define PMRN_UPMLCB3   0x103   /* User PM Local Control B3 */
+#define PMRN_UPMLCB4   0x104   /* User PM Local Control B4 */
+#define PMRN_UPMLCB5   0x105   /* User PM Local Control B5 */
 #define PMRN_UPMGC00x180   /* User PM Global Control 0 */
 
 
diff --git a/arch/powerpc/kernel/cputable.c b/arch/powerpc/kernel/cputable.c
index cc39139..2d4eee2 100644
--- a/arch/powerpc/kernel/cputable.c
+++ b/arch/powerpc/kernel/cputable.c
@@ -2073,7 +2073,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
MMU_FTR_USE_TLBILX,
.icache_bsize   = 64,
.dcache_bsize   = 64,
-   .num_pmcs   = 4,
+   .num_pmcs   = 6,
.oprofile_cpu_type  = ppc/e6500,
.oprofile_type  = PPC_OPROFILE_FSL_EMB,
.cpu_setup  = __setup_cpu_e6500,
diff --git a/arch/powerpc/oprofile/op_model_fsl_emb.c 
b/arch/powerpc/oprofile/op_model_fsl_emb.c
index ccc1daa..2a82d3e 100644
--- a/arch/powerpc/oprofile/op_model_fsl_emb.c
+++ b/arch/powerpc/oprofile/op_model_fsl_emb.c
@@ -46,6 +46,12 @@ static inline u32 get_pmlca(int ctr)
case 3:
pmlca = mfpmr(PMRN_PMLCA3);
break;
+   case 4:
+   pmlca = mfpmr(PMRN_PMLCA4);
+   break;
+   case 5:
+   pmlca = mfpmr(PMRN_PMLCA5);
+   break;
default:
panic(Bad ctr number\n);
}
@@ -68,6 +74,12 @@ static inline void set_pmlca(int ctr, u32 pmlca)
case 3:
mtpmr(PMRN_PMLCA3, pmlca);
break;
+   case 4:
+   mtpmr(PMRN_PMLCA4, pmlca);
+   break;
+   case 5:
+   mtpmr(PMRN_PMLCA5, pmlca);
+   break;
default:
panic(Bad ctr number\n);
}
@@ -84,6 +96,10 @@ static inline unsigned int ctr_read(unsigned int i

[PATCH 1/4] powerpc/perf: correct typos in counter enumeration

2013-06-05 Thread Lijun Pan
Signed-off-by: Lijun Pan lijun@freescale.com
---
 arch/powerpc/include/asm/reg_fsl_emb.h |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/include/asm/reg_fsl_emb.h 
b/arch/powerpc/include/asm/reg_fsl_emb.h
index 77bb71c..1cf8ab0 100644
--- a/arch/powerpc/include/asm/reg_fsl_emb.h
+++ b/arch/powerpc/include/asm/reg_fsl_emb.h
@@ -17,8 +17,8 @@
 /* Freescale Book E Performance Monitor APU Registers */
 #define PMRN_PMC0  0x010   /* Performance Monitor Counter 0 */
 #define PMRN_PMC1  0x011   /* Performance Monitor Counter 1 */
-#define PMRN_PMC2  0x012   /* Performance Monitor Counter 1 */
-#define PMRN_PMC3  0x013   /* Performance Monitor Counter 1 */
+#define PMRN_PMC2  0x012   /* Performance Monitor Counter 2 */
+#define PMRN_PMC3  0x013   /* Performance Monitor Counter 3 */
 #define PMRN_PMLCA00x090   /* PM Local Control A0 */
 #define PMRN_PMLCA10x091   /* PM Local Control A1 */
 #define PMRN_PMLCA20x092   /* PM Local Control A2 */
@@ -55,8 +55,8 @@
 
 #define PMRN_UPMC0 0x000   /* User Performance Monitor Counter 0 */
 #define PMRN_UPMC1 0x001   /* User Performance Monitor Counter 1 */
-#define PMRN_UPMC2 0x002   /* User Performance Monitor Counter 1 */
-#define PMRN_UPMC3 0x003   /* User Performance Monitor Counter 1 */
+#define PMRN_UPMC2 0x002   /* User Performance Monitor Counter 2 */
+#define PMRN_UPMC3 0x003   /* User Performance Monitor Counter 3 */
 #define PMRN_UPMLCA0   0x080   /* User PM Local Control A0 */
 #define PMRN_UPMLCA1   0x081   /* User PM Local Control A1 */
 #define PMRN_UPMLCA2   0x082   /* User PM Local Control A2 */
-- 
1.7.9.7


___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH 1/4] powerpc/perf: correct typos in counter enumeration

2013-06-05 Thread Lijun Pan
Signed-off-by: Lijun Pan lijun@freescale.com
---
 arch/powerpc/include/asm/reg_fsl_emb.h |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/include/asm/reg_fsl_emb.h 
b/arch/powerpc/include/asm/reg_fsl_emb.h
index 77bb71c..1cf8ab0 100644
--- a/arch/powerpc/include/asm/reg_fsl_emb.h
+++ b/arch/powerpc/include/asm/reg_fsl_emb.h
@@ -17,8 +17,8 @@
 /* Freescale Book E Performance Monitor APU Registers */
 #define PMRN_PMC0  0x010   /* Performance Monitor Counter 0 */
 #define PMRN_PMC1  0x011   /* Performance Monitor Counter 1 */
-#define PMRN_PMC2  0x012   /* Performance Monitor Counter 1 */
-#define PMRN_PMC3  0x013   /* Performance Monitor Counter 1 */
+#define PMRN_PMC2  0x012   /* Performance Monitor Counter 2 */
+#define PMRN_PMC3  0x013   /* Performance Monitor Counter 3 */
 #define PMRN_PMLCA00x090   /* PM Local Control A0 */
 #define PMRN_PMLCA10x091   /* PM Local Control A1 */
 #define PMRN_PMLCA20x092   /* PM Local Control A2 */
@@ -55,8 +55,8 @@
 
 #define PMRN_UPMC0 0x000   /* User Performance Monitor Counter 0 */
 #define PMRN_UPMC1 0x001   /* User Performance Monitor Counter 1 */
-#define PMRN_UPMC2 0x002   /* User Performance Monitor Counter 1 */
-#define PMRN_UPMC3 0x003   /* User Performance Monitor Counter 1 */
+#define PMRN_UPMC2 0x002   /* User Performance Monitor Counter 2 */
+#define PMRN_UPMC3 0x003   /* User Performance Monitor Counter 3 */
 #define PMRN_UPMLCA0   0x080   /* User PM Local Control A0 */
 #define PMRN_UPMLCA1   0x081   /* User PM Local Control A1 */
 #define PMRN_UPMLCA2   0x082   /* User PM Local Control A2 */
-- 
1.7.9.7


___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH 3/4] powerpc/perf: add 2 additional performance monitor counters for e6500 core

2013-06-05 Thread Lijun Pan
There are 6 counters in e6500 core instead of 4 in e500 core.

Signed-off-by: Lijun Pan lijun@freescale.com
---
 arch/powerpc/include/asm/reg_fsl_emb.h   |   12 
 arch/powerpc/kernel/cputable.c   |2 +-
 arch/powerpc/oprofile/op_model_fsl_emb.c |   30 ++
 arch/powerpc/perf/core-fsl-emb.c |   24 
 4 files changed, 67 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/include/asm/reg_fsl_emb.h 
b/arch/powerpc/include/asm/reg_fsl_emb.h
index 1cf8ab0..c51d52e 100644
--- a/arch/powerpc/include/asm/reg_fsl_emb.h
+++ b/arch/powerpc/include/asm/reg_fsl_emb.h
@@ -19,10 +19,14 @@
 #define PMRN_PMC1  0x011   /* Performance Monitor Counter 1 */
 #define PMRN_PMC2  0x012   /* Performance Monitor Counter 2 */
 #define PMRN_PMC3  0x013   /* Performance Monitor Counter 3 */
+#define PMRN_PMC4  0x014   /* Performance Monitor Counter 4 */
+#define PMRN_PMC5  0x015   /* Performance Monitor Counter 5 */
 #define PMRN_PMLCA00x090   /* PM Local Control A0 */
 #define PMRN_PMLCA10x091   /* PM Local Control A1 */
 #define PMRN_PMLCA20x092   /* PM Local Control A2 */
 #define PMRN_PMLCA30x093   /* PM Local Control A3 */
+#define PMRN_PMLCA40x094   /* PM Local Control A4 */
+#define PMRN_PMLCA50x095   /* PM Local Control A5 */
 
 #define PMLCA_FC   0x8000  /* Freeze Counter */
 #define PMLCA_FCS  0x4000  /* Freeze in Supervisor */
@@ -38,6 +42,8 @@
 #define PMRN_PMLCB10x111   /* PM Local Control B1 */
 #define PMRN_PMLCB20x112   /* PM Local Control B2 */
 #define PMRN_PMLCB30x113   /* PM Local Control B3 */
+#define PMRN_PMLCB40x114   /* PM Local Control B4 */
+#define PMRN_PMLCB50x115   /* PM Local Control B5 */
 
 #define PMLCB_THRESHMUL_MASK   0x0700  /* Threshold Multiple Field */
 #define PMLCB_THRESHMUL_SHIFT  8
@@ -57,14 +63,20 @@
 #define PMRN_UPMC1 0x001   /* User Performance Monitor Counter 1 */
 #define PMRN_UPMC2 0x002   /* User Performance Monitor Counter 2 */
 #define PMRN_UPMC3 0x003   /* User Performance Monitor Counter 3 */
+#define PMRN_UPMC4 0x004   /* User Performance Monitor Counter 4 */
+#define PMRN_UPMC5 0x005   /* User Performance Monitor Counter 5 */
 #define PMRN_UPMLCA0   0x080   /* User PM Local Control A0 */
 #define PMRN_UPMLCA1   0x081   /* User PM Local Control A1 */
 #define PMRN_UPMLCA2   0x082   /* User PM Local Control A2 */
 #define PMRN_UPMLCA3   0x083   /* User PM Local Control A3 */
+#define PMRN_UPMLCA4   0x084   /* User PM Local Control A4 */
+#define PMRN_UPMLCA5   0x085   /* User PM Local Control A5 */
 #define PMRN_UPMLCB0   0x100   /* User PM Local Control B0 */
 #define PMRN_UPMLCB1   0x101   /* User PM Local Control B1 */
 #define PMRN_UPMLCB2   0x102   /* User PM Local Control B2 */
 #define PMRN_UPMLCB3   0x103   /* User PM Local Control B3 */
+#define PMRN_UPMLCB4   0x104   /* User PM Local Control B4 */
+#define PMRN_UPMLCB5   0x105   /* User PM Local Control B5 */
 #define PMRN_UPMGC00x180   /* User PM Global Control 0 */
 
 
diff --git a/arch/powerpc/kernel/cputable.c b/arch/powerpc/kernel/cputable.c
index cc39139..2d4eee2 100644
--- a/arch/powerpc/kernel/cputable.c
+++ b/arch/powerpc/kernel/cputable.c
@@ -2073,7 +2073,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
MMU_FTR_USE_TLBILX,
.icache_bsize   = 64,
.dcache_bsize   = 64,
-   .num_pmcs   = 4,
+   .num_pmcs   = 6,
.oprofile_cpu_type  = ppc/e6500,
.oprofile_type  = PPC_OPROFILE_FSL_EMB,
.cpu_setup  = __setup_cpu_e6500,
diff --git a/arch/powerpc/oprofile/op_model_fsl_emb.c 
b/arch/powerpc/oprofile/op_model_fsl_emb.c
index ccc1daa..2a82d3e 100644
--- a/arch/powerpc/oprofile/op_model_fsl_emb.c
+++ b/arch/powerpc/oprofile/op_model_fsl_emb.c
@@ -46,6 +46,12 @@ static inline u32 get_pmlca(int ctr)
case 3:
pmlca = mfpmr(PMRN_PMLCA3);
break;
+   case 4:
+   pmlca = mfpmr(PMRN_PMLCA4);
+   break;
+   case 5:
+   pmlca = mfpmr(PMRN_PMLCA5);
+   break;
default:
panic(Bad ctr number\n);
}
@@ -68,6 +74,12 @@ static inline void set_pmlca(int ctr, u32 pmlca)
case 3:
mtpmr(PMRN_PMLCA3, pmlca);
break;
+   case 4:
+   mtpmr(PMRN_PMLCA4, pmlca);
+   break;
+   case 5:
+   mtpmr(PMRN_PMLCA5, pmlca);
+   break;
default:
panic(Bad ctr number\n);
}
@@ -84,6 +96,10 @@ static inline unsigned int ctr_read(unsigned int i

[PATCH 4/4] powerpc/perf: Add e6500 PMU driver

2013-06-05 Thread Lijun Pan
From: 'Priyanka Jain priyanka.j...@freescale.com

e6500 core performance monitors has the following features:
- 6 performance monitor counters
- 512 events supported
- no threshold events

e6500 PMU has more specific events (Data L1 cache misses, Instruction L1
cache misses, etc ) than e500 PMU (which only had Data L1 cache reloads,
etc). Where available, the more specific events have been used which will
produce slightly different results than e500 PMU equivalents.

Signed-off-by: Priyanka Jain priyanka.j...@freescale.com
Signed-off-by: Lijun Pan lijun@freescale.com
---
 arch/powerpc/include/asm/reg_fsl_emb.h |4 +-
 arch/powerpc/perf/Makefile |2 +-
 arch/powerpc/perf/e6500-pmu.c  |  121 
 3 files changed, 125 insertions(+), 2 deletions(-)
 create mode 100644 arch/powerpc/perf/e6500-pmu.c

diff --git a/arch/powerpc/include/asm/reg_fsl_emb.h 
b/arch/powerpc/include/asm/reg_fsl_emb.h
index c51d52e..0e3ddf5 100644
--- a/arch/powerpc/include/asm/reg_fsl_emb.h
+++ b/arch/powerpc/include/asm/reg_fsl_emb.h
@@ -34,8 +34,10 @@
 #define PMLCA_FCM1 0x1000  /* Freeze when PMM==1 */
 #define PMLCA_FCM0 0x0800  /* Freeze when PMM==0 */
 #define PMLCA_CE   0x0400  /* Condition Enable */
+#define PMLCA_FGCS10x0002  /* Freeze in guest state */
+#define PMLCA_FGCS00x0001  /* Freeze in hypervisor state */
 
-#define PMLCA_EVENT_MASK 0x00ff/* Event field */
+#define PMLCA_EVENT_MASK 0x01ff/* Event field */
 #define PMLCA_EVENT_SHIFT  16
 
 #define PMRN_PMLCB00x110   /* PM Local Control B0 */
diff --git a/arch/powerpc/perf/Makefile b/arch/powerpc/perf/Makefile
index af3fac2..06dd8d5 100644
--- a/arch/powerpc/perf/Makefile
+++ b/arch/powerpc/perf/Makefile
@@ -8,7 +8,7 @@ obj64-$(CONFIG_PPC_PERF_CTRS)   += power4-pmu.o ppc970-pmu.o 
power5-pmu.o \
 obj32-$(CONFIG_PPC_PERF_CTRS)  += mpc7450-pmu.o
 
 obj-$(CONFIG_FSL_EMB_PERF_EVENT) += core-fsl-emb.o
-obj-$(CONFIG_FSL_EMB_PERF_EVENT_E500) += e500-pmu.o
+obj-$(CONFIG_FSL_EMB_PERF_EVENT_E500) += e500-pmu.o e6500-pmu.o
 
 obj-$(CONFIG_PPC64)+= $(obj64-y)
 obj-$(CONFIG_PPC32)+= $(obj32-y)
diff --git a/arch/powerpc/perf/e6500-pmu.c b/arch/powerpc/perf/e6500-pmu.c
new file mode 100644
index 000..3d877aa
--- /dev/null
+++ b/arch/powerpc/perf/e6500-pmu.c
@@ -0,0 +1,121 @@
+/*
+ * Performance counter support for e6500 family processors.
+ *
+ * Author: Priyanka Jain, priyanka.j...@freescale.com
+ * Based on e500-pmu.c
+ * Copyright 2013 Freescale Semiconductor, Inc.
+ * Copyright 2008-2009 Paul Mackerras, IBM Corporation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ */
+
+#include linux/string.h
+#include linux/perf_event.h
+#include asm/reg.h
+#include asm/cputable.h
+
+/*
+ * Map of generic hardware event types to hardware events
+ * Zero if unsupported
+ */
+static int e6500_generic_events[] = {
+   [PERF_COUNT_HW_CPU_CYCLES] = 1,
+   [PERF_COUNT_HW_INSTRUCTIONS] = 2,
+   [PERF_COUNT_HW_CACHE_MISSES] = 221,
+   [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = 12,
+   [PERF_COUNT_HW_BRANCH_MISSES] = 15,
+};
+
+#define C(x)   PERF_COUNT_HW_CACHE_##x
+
+/*
+ * Table of generalized cache-related events.
+ * 0 means not supported, -1 means nonsensical, other values
+ * are event codes.
+ */
+static int e6500_cache_events[C(MAX)][C(OP_MAX)][C(RESULT_MAX)] = {
+   [C(L1D)] = {
+   /*RESULT_ACCESS RESULT_MISS */
+   [C(OP_READ)] = {27, 222 },
+   [C(OP_WRITE)] = {   28, 223 },
+   [C(OP_PREFETCH)] = {29, 0   },
+   },
+   [C(L1I)] = {
+   /*RESULT_ACCESS RESULT_MISS */
+   [C(OP_READ)] = {2,  254 },
+   [C(OP_WRITE)] = {   -1, -1  },
+   [C(OP_PREFETCH)] = {37, 0   },
+   },
+   /*
+* Assuming LL means L2, it's not a good match for this model.
+* It does not have separate read/write events (but it does have
+* separate instruction/data events).
+*/
+   [C(LL)] = {
+   /*RESULT_ACCESS RESULT_MISS */
+   [C(OP_READ)] = {0,  0   },
+   [C(OP_WRITE)] = {   0,  0   },
+   [C(OP_PREFETCH)] = {0,  0   },
+   },
+   /*
+* There are data/instruction MMU misses, but that's a miss on
+* the chip's internal level-one TLB which is probably not
+* what the user wants.  Instead, unified level-two TLB misses

[PATCH 2/4] powerpc/perf: increase the perf HW events to 6

2013-06-05 Thread Lijun Pan
From: Catalin Udma catalin.u...@freescale.com

This change is required after the e6500 perf support has been added.
There are 6 counters in e6500 core instead of 4 in e500 core and
the MAX_HWEVENTS counter should be changed accordingly from 4 to 6.
Added also runtime check for counters overflow.

Signed-off-by: Catalin Udma catalin.u...@freescale.com
Signed-off-by: Lijun Pan lijun@freescale.com
---
 arch/powerpc/include/asm/perf_event_fsl_emb.h |2 +-
 arch/powerpc/perf/core-fsl-emb.c  |6 ++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/include/asm/perf_event_fsl_emb.h 
b/arch/powerpc/include/asm/perf_event_fsl_emb.h
index 718a9fa..a581654 100644
--- a/arch/powerpc/include/asm/perf_event_fsl_emb.h
+++ b/arch/powerpc/include/asm/perf_event_fsl_emb.h
@@ -13,7 +13,7 @@
 #include linux/types.h
 #include asm/hw_irq.h
 
-#define MAX_HWEVENTS 4
+#define MAX_HWEVENTS 6
 
 /* event flags */
 #define FSL_EMB_EVENT_VALID  1
diff --git a/arch/powerpc/perf/core-fsl-emb.c b/arch/powerpc/perf/core-fsl-emb.c
index 106c533..0b13f74 100644
--- a/arch/powerpc/perf/core-fsl-emb.c
+++ b/arch/powerpc/perf/core-fsl-emb.c
@@ -462,6 +462,12 @@ static int fsl_emb_pmu_event_init(struct perf_event *event)
int num_restricted;
int i;
 
+   if (ppmu-n_counter  MAX_HWEVENTS) {
+   WARN(1, No. of perf counters (%d) is higher than max array 
size(%d)\n,
+   ppmu-n_counter, MAX_HWEVENTS);
+   ppmu-n_counter = MAX_HWEVENTS;
+   }
+
switch (event-attr.type) {
case PERF_TYPE_HARDWARE:
ev = event-attr.config;
-- 
1.7.9.7


___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH 1/3] powerpc/perf: correct typos in counter enumeration

2013-05-29 Thread Lijun Pan
Signed-off-by: Lijun Pan lijun@freescale.com
---
 arch/powerpc/include/asm/reg_fsl_emb.h |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/include/asm/reg_fsl_emb.h 
b/arch/powerpc/include/asm/reg_fsl_emb.h
index 77bb71c..1cf8ab0 100644
--- a/arch/powerpc/include/asm/reg_fsl_emb.h
+++ b/arch/powerpc/include/asm/reg_fsl_emb.h
@@ -17,8 +17,8 @@
 /* Freescale Book E Performance Monitor APU Registers */
 #define PMRN_PMC0  0x010   /* Performance Monitor Counter 0 */
 #define PMRN_PMC1  0x011   /* Performance Monitor Counter 1 */
-#define PMRN_PMC2  0x012   /* Performance Monitor Counter 1 */
-#define PMRN_PMC3  0x013   /* Performance Monitor Counter 1 */
+#define PMRN_PMC2  0x012   /* Performance Monitor Counter 2 */
+#define PMRN_PMC3  0x013   /* Performance Monitor Counter 3 */
 #define PMRN_PMLCA00x090   /* PM Local Control A0 */
 #define PMRN_PMLCA10x091   /* PM Local Control A1 */
 #define PMRN_PMLCA20x092   /* PM Local Control A2 */
@@ -55,8 +55,8 @@
 
 #define PMRN_UPMC0 0x000   /* User Performance Monitor Counter 0 */
 #define PMRN_UPMC1 0x001   /* User Performance Monitor Counter 1 */
-#define PMRN_UPMC2 0x002   /* User Performance Monitor Counter 1 */
-#define PMRN_UPMC3 0x003   /* User Performance Monitor Counter 1 */
+#define PMRN_UPMC2 0x002   /* User Performance Monitor Counter 2 */
+#define PMRN_UPMC3 0x003   /* User Performance Monitor Counter 3 */
 #define PMRN_UPMLCA0   0x080   /* User PM Local Control A0 */
 #define PMRN_UPMLCA1   0x081   /* User PM Local Control A1 */
 #define PMRN_UPMLCA2   0x082   /* User PM Local Control A2 */
-- 
1.7.9.7


___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH 2/3] powerpc/perf: add 2 additional performance monitor counters for e6500 core

2013-05-29 Thread Lijun Pan
There are 6 counters in e6500 core instead of 4 in e500 core.

Signed-off-by: Lijun Pan lijun@freescale.com
---
 arch/powerpc/include/asm/reg_fsl_emb.h   |   12 
 arch/powerpc/kernel/cputable.c   |2 +-
 arch/powerpc/oprofile/op_model_fsl_emb.c |   30 ++
 arch/powerpc/perf/core-fsl-emb.c |   24 
 4 files changed, 67 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/include/asm/reg_fsl_emb.h 
b/arch/powerpc/include/asm/reg_fsl_emb.h
index 1cf8ab0..c51d52e 100644
--- a/arch/powerpc/include/asm/reg_fsl_emb.h
+++ b/arch/powerpc/include/asm/reg_fsl_emb.h
@@ -19,10 +19,14 @@
 #define PMRN_PMC1  0x011   /* Performance Monitor Counter 1 */
 #define PMRN_PMC2  0x012   /* Performance Monitor Counter 2 */
 #define PMRN_PMC3  0x013   /* Performance Monitor Counter 3 */
+#define PMRN_PMC4  0x014   /* Performance Monitor Counter 4 */
+#define PMRN_PMC5  0x015   /* Performance Monitor Counter 5 */
 #define PMRN_PMLCA00x090   /* PM Local Control A0 */
 #define PMRN_PMLCA10x091   /* PM Local Control A1 */
 #define PMRN_PMLCA20x092   /* PM Local Control A2 */
 #define PMRN_PMLCA30x093   /* PM Local Control A3 */
+#define PMRN_PMLCA40x094   /* PM Local Control A4 */
+#define PMRN_PMLCA50x095   /* PM Local Control A5 */
 
 #define PMLCA_FC   0x8000  /* Freeze Counter */
 #define PMLCA_FCS  0x4000  /* Freeze in Supervisor */
@@ -38,6 +42,8 @@
 #define PMRN_PMLCB10x111   /* PM Local Control B1 */
 #define PMRN_PMLCB20x112   /* PM Local Control B2 */
 #define PMRN_PMLCB30x113   /* PM Local Control B3 */
+#define PMRN_PMLCB40x114   /* PM Local Control B4 */
+#define PMRN_PMLCB50x115   /* PM Local Control B5 */
 
 #define PMLCB_THRESHMUL_MASK   0x0700  /* Threshold Multiple Field */
 #define PMLCB_THRESHMUL_SHIFT  8
@@ -57,14 +63,20 @@
 #define PMRN_UPMC1 0x001   /* User Performance Monitor Counter 1 */
 #define PMRN_UPMC2 0x002   /* User Performance Monitor Counter 2 */
 #define PMRN_UPMC3 0x003   /* User Performance Monitor Counter 3 */
+#define PMRN_UPMC4 0x004   /* User Performance Monitor Counter 4 */
+#define PMRN_UPMC5 0x005   /* User Performance Monitor Counter 5 */
 #define PMRN_UPMLCA0   0x080   /* User PM Local Control A0 */
 #define PMRN_UPMLCA1   0x081   /* User PM Local Control A1 */
 #define PMRN_UPMLCA2   0x082   /* User PM Local Control A2 */
 #define PMRN_UPMLCA3   0x083   /* User PM Local Control A3 */
+#define PMRN_UPMLCA4   0x084   /* User PM Local Control A4 */
+#define PMRN_UPMLCA5   0x085   /* User PM Local Control A5 */
 #define PMRN_UPMLCB0   0x100   /* User PM Local Control B0 */
 #define PMRN_UPMLCB1   0x101   /* User PM Local Control B1 */
 #define PMRN_UPMLCB2   0x102   /* User PM Local Control B2 */
 #define PMRN_UPMLCB3   0x103   /* User PM Local Control B3 */
+#define PMRN_UPMLCB4   0x104   /* User PM Local Control B4 */
+#define PMRN_UPMLCB5   0x105   /* User PM Local Control B5 */
 #define PMRN_UPMGC00x180   /* User PM Global Control 0 */
 
 
diff --git a/arch/powerpc/kernel/cputable.c b/arch/powerpc/kernel/cputable.c
index cc39139..2d4eee2 100644
--- a/arch/powerpc/kernel/cputable.c
+++ b/arch/powerpc/kernel/cputable.c
@@ -2073,7 +2073,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
MMU_FTR_USE_TLBILX,
.icache_bsize   = 64,
.dcache_bsize   = 64,
-   .num_pmcs   = 4,
+   .num_pmcs   = 6,
.oprofile_cpu_type  = ppc/e6500,
.oprofile_type  = PPC_OPROFILE_FSL_EMB,
.cpu_setup  = __setup_cpu_e6500,
diff --git a/arch/powerpc/oprofile/op_model_fsl_emb.c 
b/arch/powerpc/oprofile/op_model_fsl_emb.c
index ccc1daa..2a82d3e 100644
--- a/arch/powerpc/oprofile/op_model_fsl_emb.c
+++ b/arch/powerpc/oprofile/op_model_fsl_emb.c
@@ -46,6 +46,12 @@ static inline u32 get_pmlca(int ctr)
case 3:
pmlca = mfpmr(PMRN_PMLCA3);
break;
+   case 4:
+   pmlca = mfpmr(PMRN_PMLCA4);
+   break;
+   case 5:
+   pmlca = mfpmr(PMRN_PMLCA5);
+   break;
default:
panic(Bad ctr number\n);
}
@@ -68,6 +74,12 @@ static inline void set_pmlca(int ctr, u32 pmlca)
case 3:
mtpmr(PMRN_PMLCA3, pmlca);
break;
+   case 4:
+   mtpmr(PMRN_PMLCA4, pmlca);
+   break;
+   case 5:
+   mtpmr(PMRN_PMLCA5, pmlca);
+   break;
default:
panic(Bad ctr number\n);
}
@@ -84,6 +96,10 @@ static inline unsigned int ctr_read(unsigned int i

[PATCH 3/3] powerpc/perf: Add e6500 PMU driver

2013-05-29 Thread Lijun Pan
e6500 core performance monitors has the following features:
- 6 performance monitor counters
- 512 events supported
- no threshold events

e6500 PMU has more specific events (Data L1 cache misses, Instruction L1
cache misses, etc ) than e500 PMU (which only had Data L1 cache reloads,
etc). Where available, the more specific events have been used which will
produce slightly different results than e500 PMU equivalents.

Based on work done by Priyanka Jain

Signed-off-by: Lijun Pan lijun@freescale.com
Signed-off-by: Priyanka Jain priyanka.j...@freescale.com
Signed-off-by: Poonam Aggrwal poonam.aggr...@freescale.com
---
 arch/powerpc/include/asm/reg_fsl_emb.h |4 +-
 arch/powerpc/perf/Makefile |2 +-
 arch/powerpc/perf/e6500-pmu.c  |  120 
 3 files changed, 124 insertions(+), 2 deletions(-)
 create mode 100644 arch/powerpc/perf/e6500-pmu.c

diff --git a/arch/powerpc/include/asm/reg_fsl_emb.h 
b/arch/powerpc/include/asm/reg_fsl_emb.h
index c51d52e..0e3ddf5 100644
--- a/arch/powerpc/include/asm/reg_fsl_emb.h
+++ b/arch/powerpc/include/asm/reg_fsl_emb.h
@@ -34,8 +34,10 @@
 #define PMLCA_FCM1 0x1000  /* Freeze when PMM==1 */
 #define PMLCA_FCM0 0x0800  /* Freeze when PMM==0 */
 #define PMLCA_CE   0x0400  /* Condition Enable */
+#define PMLCA_FGCS10x0002  /* Freeze in guest state */
+#define PMLCA_FGCS00x0001  /* Freeze in hypervisor state */
 
-#define PMLCA_EVENT_MASK 0x00ff/* Event field */
+#define PMLCA_EVENT_MASK 0x01ff/* Event field */
 #define PMLCA_EVENT_SHIFT  16
 
 #define PMRN_PMLCB00x110   /* PM Local Control B0 */
diff --git a/arch/powerpc/perf/Makefile b/arch/powerpc/perf/Makefile
index af3fac2..06dd8d5 100644
--- a/arch/powerpc/perf/Makefile
+++ b/arch/powerpc/perf/Makefile
@@ -8,7 +8,7 @@ obj64-$(CONFIG_PPC_PERF_CTRS)   += power4-pmu.o ppc970-pmu.o 
power5-pmu.o \
 obj32-$(CONFIG_PPC_PERF_CTRS)  += mpc7450-pmu.o
 
 obj-$(CONFIG_FSL_EMB_PERF_EVENT) += core-fsl-emb.o
-obj-$(CONFIG_FSL_EMB_PERF_EVENT_E500) += e500-pmu.o
+obj-$(CONFIG_FSL_EMB_PERF_EVENT_E500) += e500-pmu.o e6500-pmu.o
 
 obj-$(CONFIG_PPC64)+= $(obj64-y)
 obj-$(CONFIG_PPC32)+= $(obj32-y)
diff --git a/arch/powerpc/perf/e6500-pmu.c b/arch/powerpc/perf/e6500-pmu.c
new file mode 100644
index 000..e38ed1f
--- /dev/null
+++ b/arch/powerpc/perf/e6500-pmu.c
@@ -0,0 +1,120 @@
+/*
+ * Performance counter support for e6500 family processors.
+ *
+ * Based on e500-pmu.c
+ * Copyright 2013 Freescale Semiconductor, Inc.
+ * Copyright 2008-2009 Paul Mackerras, IBM Corporation.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ */
+
+#include linux/string.h
+#include linux/perf_event.h
+#include asm/reg.h
+#include asm/cputable.h
+
+/*
+ * Map of generic hardware event types to hardware events
+ * Zero if unsupported
+ */
+static int e6500_generic_events[] = {
+   [PERF_COUNT_HW_CPU_CYCLES] = 1,
+   [PERF_COUNT_HW_INSTRUCTIONS] = 2,
+   [PERF_COUNT_HW_CACHE_MISSES] = 221,
+   [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = 12,
+   [PERF_COUNT_HW_BRANCH_MISSES] = 15,
+};
+
+#define C(x)   PERF_COUNT_HW_CACHE_##x
+
+/*
+ * Table of generalized cache-related events.
+ * 0 means not supported, -1 means nonsensical, other values
+ * are event codes.
+ */
+static int e6500_cache_events[C(MAX)][C(OP_MAX)][C(RESULT_MAX)] = {
+   [C(L1D)] = {
+   /*RESULT_ACCESS RESULT_MISS */
+   [C(OP_READ)] = {27, 222 },
+   [C(OP_WRITE)] = {   28, 223 },
+   [C(OP_PREFETCH)] = {29, 0   },
+   },
+   [C(L1I)] = {
+   /*RESULT_ACCESS RESULT_MISS */
+   [C(OP_READ)] = {2,  254 },
+   [C(OP_WRITE)] = {   -1, -1  },
+   [C(OP_PREFETCH)] = {37, 0   },
+   },
+   /*
+* Assuming LL means L2, it's not a good match for this model.
+* It does not have separate read/write events (but it does have
+* separate instruction/data events).
+*/
+   [C(LL)] = {
+   /*RESULT_ACCESS RESULT_MISS */
+   [C(OP_READ)] = {0,  0   },
+   [C(OP_WRITE)] = {   0,  0   },
+   [C(OP_PREFETCH)] = {0,  0   },
+   },
+   /*
+* There are data/instruction MMU misses, but that's a miss on
+* the chip's internal level-one TLB which is probably not
+* what the user wants.  Instead, unified level-two TLB misses
+* are reported here

[PATCH 1/3] powerpc/perf: correct typos in counter enumeration

2013-05-02 Thread Lijun Pan
Signed-off-by: Lijun Pan lijun@freescale.com
---
 arch/powerpc/include/asm/reg_fsl_emb.h |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/include/asm/reg_fsl_emb.h 
b/arch/powerpc/include/asm/reg_fsl_emb.h
index 77bb71c..1cf8ab0 100644
--- a/arch/powerpc/include/asm/reg_fsl_emb.h
+++ b/arch/powerpc/include/asm/reg_fsl_emb.h
@@ -17,8 +17,8 @@
 /* Freescale Book E Performance Monitor APU Registers */
 #define PMRN_PMC0  0x010   /* Performance Monitor Counter 0 */
 #define PMRN_PMC1  0x011   /* Performance Monitor Counter 1 */
-#define PMRN_PMC2  0x012   /* Performance Monitor Counter 1 */
-#define PMRN_PMC3  0x013   /* Performance Monitor Counter 1 */
+#define PMRN_PMC2  0x012   /* Performance Monitor Counter 2 */
+#define PMRN_PMC3  0x013   /* Performance Monitor Counter 3 */
 #define PMRN_PMLCA00x090   /* PM Local Control A0 */
 #define PMRN_PMLCA10x091   /* PM Local Control A1 */
 #define PMRN_PMLCA20x092   /* PM Local Control A2 */
@@ -55,8 +55,8 @@
 
 #define PMRN_UPMC0 0x000   /* User Performance Monitor Counter 0 */
 #define PMRN_UPMC1 0x001   /* User Performance Monitor Counter 1 */
-#define PMRN_UPMC2 0x002   /* User Performance Monitor Counter 1 */
-#define PMRN_UPMC3 0x003   /* User Performance Monitor Counter 1 */
+#define PMRN_UPMC2 0x002   /* User Performance Monitor Counter 2 */
+#define PMRN_UPMC3 0x003   /* User Performance Monitor Counter 3 */
 #define PMRN_UPMLCA0   0x080   /* User PM Local Control A0 */
 #define PMRN_UPMLCA1   0x081   /* User PM Local Control A1 */
 #define PMRN_UPMLCA2   0x082   /* User PM Local Control A2 */
-- 
1.7.9.7


___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev


[PATCH 2/3] powerpc/perf: add 2 additional performance monitor counters for e6500 core

2013-05-02 Thread Lijun Pan
There are 6 counters in e6500 core instead of 4 in e500 core.

Signed-off-by: Lijun Pan lijun@freescale.com
---
 arch/powerpc/include/asm/reg_fsl_emb.h   |   12 
 arch/powerpc/kernel/cputable.c   |2 +-
 arch/powerpc/oprofile/op_model_fsl_emb.c |   30 ++
 arch/powerpc/perf/core-fsl-emb.c |   24 
 4 files changed, 67 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/include/asm/reg_fsl_emb.h 
b/arch/powerpc/include/asm/reg_fsl_emb.h
index 1cf8ab0..c51d52e 100644
--- a/arch/powerpc/include/asm/reg_fsl_emb.h
+++ b/arch/powerpc/include/asm/reg_fsl_emb.h
@@ -19,10 +19,14 @@
 #define PMRN_PMC1  0x011   /* Performance Monitor Counter 1 */
 #define PMRN_PMC2  0x012   /* Performance Monitor Counter 2 */
 #define PMRN_PMC3  0x013   /* Performance Monitor Counter 3 */
+#define PMRN_PMC4  0x014   /* Performance Monitor Counter 4 */
+#define PMRN_PMC5  0x015   /* Performance Monitor Counter 5 */
 #define PMRN_PMLCA00x090   /* PM Local Control A0 */
 #define PMRN_PMLCA10x091   /* PM Local Control A1 */
 #define PMRN_PMLCA20x092   /* PM Local Control A2 */
 #define PMRN_PMLCA30x093   /* PM Local Control A3 */
+#define PMRN_PMLCA40x094   /* PM Local Control A4 */
+#define PMRN_PMLCA50x095   /* PM Local Control A5 */
 
 #define PMLCA_FC   0x8000  /* Freeze Counter */
 #define PMLCA_FCS  0x4000  /* Freeze in Supervisor */
@@ -38,6 +42,8 @@
 #define PMRN_PMLCB10x111   /* PM Local Control B1 */
 #define PMRN_PMLCB20x112   /* PM Local Control B2 */
 #define PMRN_PMLCB30x113   /* PM Local Control B3 */
+#define PMRN_PMLCB40x114   /* PM Local Control B4 */
+#define PMRN_PMLCB50x115   /* PM Local Control B5 */
 
 #define PMLCB_THRESHMUL_MASK   0x0700  /* Threshold Multiple Field */
 #define PMLCB_THRESHMUL_SHIFT  8
@@ -57,14 +63,20 @@
 #define PMRN_UPMC1 0x001   /* User Performance Monitor Counter 1 */
 #define PMRN_UPMC2 0x002   /* User Performance Monitor Counter 2 */
 #define PMRN_UPMC3 0x003   /* User Performance Monitor Counter 3 */
+#define PMRN_UPMC4 0x004   /* User Performance Monitor Counter 4 */
+#define PMRN_UPMC5 0x005   /* User Performance Monitor Counter 5 */
 #define PMRN_UPMLCA0   0x080   /* User PM Local Control A0 */
 #define PMRN_UPMLCA1   0x081   /* User PM Local Control A1 */
 #define PMRN_UPMLCA2   0x082   /* User PM Local Control A2 */
 #define PMRN_UPMLCA3   0x083   /* User PM Local Control A3 */
+#define PMRN_UPMLCA4   0x084   /* User PM Local Control A4 */
+#define PMRN_UPMLCA5   0x085   /* User PM Local Control A5 */
 #define PMRN_UPMLCB0   0x100   /* User PM Local Control B0 */
 #define PMRN_UPMLCB1   0x101   /* User PM Local Control B1 */
 #define PMRN_UPMLCB2   0x102   /* User PM Local Control B2 */
 #define PMRN_UPMLCB3   0x103   /* User PM Local Control B3 */
+#define PMRN_UPMLCB4   0x104   /* User PM Local Control B4 */
+#define PMRN_UPMLCB5   0x105   /* User PM Local Control B5 */
 #define PMRN_UPMGC00x180   /* User PM Global Control 0 */
 
 
diff --git a/arch/powerpc/kernel/cputable.c b/arch/powerpc/kernel/cputable.c
index cc39139..2d4eee2 100644
--- a/arch/powerpc/kernel/cputable.c
+++ b/arch/powerpc/kernel/cputable.c
@@ -2073,7 +2073,7 @@ static struct cpu_spec __initdata cpu_specs[] = {
MMU_FTR_USE_TLBILX,
.icache_bsize   = 64,
.dcache_bsize   = 64,
-   .num_pmcs   = 4,
+   .num_pmcs   = 6,
.oprofile_cpu_type  = ppc/e6500,
.oprofile_type  = PPC_OPROFILE_FSL_EMB,
.cpu_setup  = __setup_cpu_e6500,
diff --git a/arch/powerpc/oprofile/op_model_fsl_emb.c 
b/arch/powerpc/oprofile/op_model_fsl_emb.c
index ccc1daa..2a82d3e 100644
--- a/arch/powerpc/oprofile/op_model_fsl_emb.c
+++ b/arch/powerpc/oprofile/op_model_fsl_emb.c
@@ -46,6 +46,12 @@ static inline u32 get_pmlca(int ctr)
case 3:
pmlca = mfpmr(PMRN_PMLCA3);
break;
+   case 4:
+   pmlca = mfpmr(PMRN_PMLCA4);
+   break;
+   case 5:
+   pmlca = mfpmr(PMRN_PMLCA5);
+   break;
default:
panic(Bad ctr number\n);
}
@@ -68,6 +74,12 @@ static inline void set_pmlca(int ctr, u32 pmlca)
case 3:
mtpmr(PMRN_PMLCA3, pmlca);
break;
+   case 4:
+   mtpmr(PMRN_PMLCA4, pmlca);
+   break;
+   case 5:
+   mtpmr(PMRN_PMLCA5, pmlca);
+   break;
default:
panic(Bad ctr number\n);
}
@@ -84,6 +96,10 @@ static inline unsigned int ctr_read(unsigned int i

[PATCH 3/3] powerpc/perf: Add e6500 PMU driver

2013-05-02 Thread Lijun Pan
e6500 core performance monitors has the following features:
- 6 performance monitor counters
- 512 events supported
- no threshold events

e6500 PMU has more specific events (Data L1 cache misses, Instruction L1
cache misses, etc ) than e500 PMU (which only had Data L1 cache reloads,
etc). Where available, the more specific events have been used which will
produce slightly different results than e500 PMU equivalents.

Based on work done by Priyanka Jain

Signed-off-by: Lijun Pan lijun@freescale.com
---
 arch/powerpc/include/asm/reg_fsl_emb.h |4 +-
 arch/powerpc/perf/Makefile |2 +-
 arch/powerpc/perf/e6500-pmu.c  |  120 
 3 files changed, 124 insertions(+), 2 deletions(-)
 create mode 100644 arch/powerpc/perf/e6500-pmu.c

diff --git a/arch/powerpc/include/asm/reg_fsl_emb.h 
b/arch/powerpc/include/asm/reg_fsl_emb.h
index c51d52e..0e3ddf5 100644
--- a/arch/powerpc/include/asm/reg_fsl_emb.h
+++ b/arch/powerpc/include/asm/reg_fsl_emb.h
@@ -34,8 +34,10 @@
 #define PMLCA_FCM1 0x1000  /* Freeze when PMM==1 */
 #define PMLCA_FCM0 0x0800  /* Freeze when PMM==0 */
 #define PMLCA_CE   0x0400  /* Condition Enable */
+#define PMLCA_FGCS10x0002  /* Freeze in guest state */
+#define PMLCA_FGCS00x0001  /* Freeze in hypervisor state */
 
-#define PMLCA_EVENT_MASK 0x00ff/* Event field */
+#define PMLCA_EVENT_MASK 0x01ff/* Event field */
 #define PMLCA_EVENT_SHIFT  16
 
 #define PMRN_PMLCB00x110   /* PM Local Control B0 */
diff --git a/arch/powerpc/perf/Makefile b/arch/powerpc/perf/Makefile
index af3fac2..06dd8d5 100644
--- a/arch/powerpc/perf/Makefile
+++ b/arch/powerpc/perf/Makefile
@@ -8,7 +8,7 @@ obj64-$(CONFIG_PPC_PERF_CTRS)   += power4-pmu.o ppc970-pmu.o 
power5-pmu.o \
 obj32-$(CONFIG_PPC_PERF_CTRS)  += mpc7450-pmu.o
 
 obj-$(CONFIG_FSL_EMB_PERF_EVENT) += core-fsl-emb.o
-obj-$(CONFIG_FSL_EMB_PERF_EVENT_E500) += e500-pmu.o
+obj-$(CONFIG_FSL_EMB_PERF_EVENT_E500) += e500-pmu.o e6500-pmu.o
 
 obj-$(CONFIG_PPC64)+= $(obj64-y)
 obj-$(CONFIG_PPC32)+= $(obj32-y)
diff --git a/arch/powerpc/perf/e6500-pmu.c b/arch/powerpc/perf/e6500-pmu.c
new file mode 100644
index 000..cf6eab7
--- /dev/null
+++ b/arch/powerpc/perf/e6500-pmu.c
@@ -0,0 +1,120 @@
+/*
+ * Performance counter support for e6500 family processors.
+ *
+ * Author: Lijun Pan
+ * Based on Priyanka Jain's code
+ * Based on e500-pmu.c
+ * Copyright 2013 Freescale Semiconductor, Inc.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version
+ * 2 of the License, or (at your option) any later version.
+ */
+
+#include linux/string.h
+#include linux/perf_event.h
+#include asm/reg.h
+#include asm/cputable.h
+
+/*
+ * Map of generic hardware event types to hardware events
+ * Zero if unsupported
+ */
+static int e6500_generic_events[] = {
+   [PERF_COUNT_HW_CPU_CYCLES] = 1,
+   [PERF_COUNT_HW_INSTRUCTIONS] = 2,
+   [PERF_COUNT_HW_CACHE_MISSES] = 221,
+   [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = 12,
+   [PERF_COUNT_HW_BRANCH_MISSES] = 15,
+};
+
+#define C(x)   PERF_COUNT_HW_CACHE_##x
+
+/*
+ * Table of generalized cache-related events.
+ * 0 means not supported, -1 means nonsensical, other values
+ * are event codes.
+ */
+static int e6500_cache_events[C(MAX)][C(OP_MAX)][C(RESULT_MAX)] = {
+   [C(L1D)] = {
+   /*RESULT_ACCESS RESULT_MISS */
+   [C(OP_READ)] = {27, 222 },
+   [C(OP_WRITE)] = {   28, 223 },
+   [C(OP_PREFETCH)] = {29, 0   },
+   },
+   [C(L1I)] = {
+   /*RESULT_ACCESS RESULT_MISS */
+   [C(OP_READ)] = {2,  254 },
+   [C(OP_WRITE)] = {   -1, -1  },
+   [C(OP_PREFETCH)] = {37, 0   },
+   },
+   /*
+* Assuming LL means L2, it's not a good match for this model.
+* It does not have separate read/write events (but it does have
+* separate instruction/data events).
+*/
+   [C(LL)] = {
+   /*RESULT_ACCESS RESULT_MISS */
+   [C(OP_READ)] = {0,  0   },
+   [C(OP_WRITE)] = {   0,  0   },
+   [C(OP_PREFETCH)] = {0,  0   },
+   },
+   /*
+* There are data/instruction MMU misses, but that's a miss on
+* the chip's internal level-one TLB which is probably not
+* what the user wants.  Instead, unified level-two TLB misses
+* are reported here.
+*/
+   [C(DTLB)] = {
+   /*RESULT_ACCESS RESULT_MISS