Re: [PATCH v2] powerpc/powernv: Initialise nest mmu

2016-12-02 Thread Tyrel Datwyler
On 12/02/2016 01:24 AM, Michael Ellerman wrote:
> Alistair Popple  writes:
> 
>> diff --git a/arch/powerpc/platforms/powernv/powernv.h 
>> b/arch/powerpc/platforms/powernv/powernv.h
>> index da7c843..6fa9551 100644
>> --- a/arch/powerpc/platforms/powernv/powernv.h
>> +++ b/arch/powerpc/platforms/powernv/powernv.h
>> @@ -9,6 +9,12 @@ static inline void pnv_smp_init(void) { }
>>  
>>  struct pci_dev;
>>  
>> +#ifdef CONFIG_PPC_POWERNV
>> +extern void powernv_set_ptcr(unsigned long ptcr);
>> +#else
>> +static inline void powernv_set_ptcr(unisigned long ptcr) { }
>  ^
>  Your shout next time we're at the 
> pub ;)
> 
> cheers
> 

Ah, the elusive unicorn of signed longs!

-Tyrel



Re: [PATCH v2] powerpc/powernv: Initialise nest mmu

2016-12-02 Thread Alistair Popple
On Fri, 2 Dec 2016 08:24:09 PM Michael Ellerman wrote:
> Alistair Popple  writes:
> 
> > diff --git a/arch/powerpc/platforms/powernv/powernv.h 
> > b/arch/powerpc/platforms/powernv/powernv.h
> > index da7c843..6fa9551 100644
> > --- a/arch/powerpc/platforms/powernv/powernv.h
> > +++ b/arch/powerpc/platforms/powernv/powernv.h
> > @@ -9,6 +9,12 @@ static inline void pnv_smp_init(void) { }
> >  
> >  struct pci_dev;
> >  
> > +#ifdef CONFIG_PPC_POWERNV
> > +extern void powernv_set_ptcr(unsigned long ptcr);
> > +#else
> > +static inline void powernv_set_ptcr(unisigned long ptcr) { }
>  ^
>  Your shout next time we're at the 
> pub ;)

Whoops. Guess I was too keen to get there myself. Thanks for picking that up!

> cheers



Re: [PATCH] powerpc: cputime: fix a compile warning

2016-12-02 Thread Scott Wood
On Fri, 2016-12-02 at 15:15 +1100, Michael Ellerman wrote:
> yanjiang@windriver.com writes:
> 
> > 
> > diff --git a/arch/powerpc/include/asm/cputime.h
> > b/arch/powerpc/include/asm/cputime.h
> > index 4f60db0..4423e97 100644
> > --- a/arch/powerpc/include/asm/cputime.h
> > +++ b/arch/powerpc/include/asm/cputime.h
> > @@ -228,7 +228,8 @@ static inline cputime_t clock_t_to_cputime(const
> > unsigned long clk)
> >     return (__force cputime_t) ct;
> >  }
> >  
> > -#define cputime64_to_clock_t(ct)   cputime_to_clock_t((cputime_t)(ct
> > ))
> > +#define cputime64_to_clock_t(ct)   \
> > +   (__force u64)(cputime_to_clock_t((cputime_t)(ct)))
> Given the name of the function is "cputime64 to clock_t", surely we
> should be returning a clock_t ?

That was my initial reaction but it seems that this function has meant "return
a u64 that is otherwise like clock_t" since before the beginning of git
history.  Both generic implementations return u64, including
jiffies_64_to_clock_t which does so explicitly.

-Scott



Re: [PATCH v2 2/5] ia64: reuse append_elf_note() and final_note() functions

2016-12-02 Thread Eric W. Biederman
Hari Bathini  writes:

> Hi Dave,
>
>
> Thanks for the review.
>
>
> On Thursday 01 December 2016 10:26 AM, Dave Young wrote:
>> Hi Hari
>>
>> Personally I like V1 more, but split the patch 2 is easier for ia64
>> people to reivew.  I did basic x86 testing, it runs ok.
>>
>> On 11/25/16 at 05:24pm, Hari Bathini wrote:
>>> Get rid of multiple definitions of append_elf_note() & final_note()
>>> functions. Reuse these functions compiled under CONFIG_CRASH_CORE.
>>>
>>> Signed-off-by: Hari Bathini 
>>> ---
>>>   arch/ia64/kernel/crash.c   |   22 --
>>>   include/linux/crash_core.h |4 
>>>   kernel/crash_core.c|6 +++---
>>>   kernel/kexec_core.c|   28 
>>>   4 files changed, 7 insertions(+), 53 deletions(-)
>>>
>>> diff --git a/arch/ia64/kernel/crash.c b/arch/ia64/kernel/crash.c
>>> index 2955f35..75859a0 100644
>>> --- a/arch/ia64/kernel/crash.c
>>> +++ b/arch/ia64/kernel/crash.c
>>> @@ -27,28 +27,6 @@ static int kdump_freeze_monarch;
>>>   static int kdump_on_init = 1;
>>>   static int kdump_on_fatal_mca = 1;
>>>   -static inline Elf64_Word
>>> -*append_elf_note(Elf64_Word *buf, char *name, unsigned type, void *data,
>>> -   size_t data_len)
>>> -{
>>> -   struct elf_note *note = (struct elf_note *)buf;
>>> -   note->n_namesz = strlen(name) + 1;
>>> -   note->n_descsz = data_len;
>>> -   note->n_type   = type;
>>> -   buf += (sizeof(*note) + 3)/4;
>>> -   memcpy(buf, name, note->n_namesz);
>>> -   buf += (note->n_namesz + 3)/4;
>>> -   memcpy(buf, data, data_len);
>>> -   buf += (data_len + 3)/4;
>>> -   return buf;
>>> -}
>>> -
>>> -static void
>>> -final_note(void *buf)
>>> -{
>>> -   memset(buf, 0, sizeof(struct elf_note));
>>> -}
>>> -
>> The above IA64 version looks better than the functions in kexec_core.c
>> about the Elf64_Word type usage and the simpler final_note function.
>
> Hmmm.. Is void* better over Elf64_Word* to be agnostic of Elf32 or
> Elf64 type?

Both Elf64_Word and Elf32_Word result in a u32.  So I expect the right
solution is to add a definition of Elf_Word to include/linux/elf.h
and to make the buffer "Elf_Word *buf".

That way we preserve the alignment knowledge, while making the code
depend on 32bit or 64bit.

Eric


Re: [RFC PATCH] PCI: designware: add host_init() error handling

2016-12-02 Thread Srinivas Kandagatla



On 02/12/16 10:32, Joao Pinto wrote:


Hi Srinivas,

Às 11:51 AM de 12/1/2016, Srinivas Kandagatla escreveu:

 drivers/pci/host/pci-dra7xx.c   |  4 +++-
 drivers/pci/host/pci-exynos.c   |  4 +++-
 drivers/pci/host/pci-imx6.c |  4 +++-
 drivers/pci/host/pci-keystone.c |  4 +++-
 drivers/pci/host/pci-layerscape.c   | 12 
 drivers/pci/host/pcie-armada8k.c|  4 +++-
 drivers/pci/host/pcie-designware-plat.c |  4 +++-
 drivers/pci/host/pcie-designware.c  |  4 +++-
 drivers/pci/host/pcie-designware.h  |  2 +-
 drivers/pci/host/pcie-qcom.c|  6 --
 drivers/pci/host/pcie-spear13xx.c   |  4 +++-
 11 files changed, 37 insertions(+), 15 deletions(-)



Thanks for the patch!

In my opinion your idea is good but only qcom driver is able to detect failure
in the specific host init routine, all others have a 'return 0' even if
something not well init. I would recomend that we take this issue a bit further
and add the error checking to all specific pci drivers in order to make them as
robust as qcom'.

I totally agree with you, I can give this a go in next version.

Thanks,
srini



Thanks,
Joao



Re: [RFC PATCH] PCI: designware: add host_init() error handling

2016-12-02 Thread Joao Pinto

Hi Srinivas,

Às 11:51 AM de 12/1/2016, Srinivas Kandagatla escreveu:
>  drivers/pci/host/pci-dra7xx.c   |  4 +++-
>  drivers/pci/host/pci-exynos.c   |  4 +++-
>  drivers/pci/host/pci-imx6.c |  4 +++-
>  drivers/pci/host/pci-keystone.c |  4 +++-
>  drivers/pci/host/pci-layerscape.c   | 12 
>  drivers/pci/host/pcie-armada8k.c|  4 +++-
>  drivers/pci/host/pcie-designware-plat.c |  4 +++-
>  drivers/pci/host/pcie-designware.c  |  4 +++-
>  drivers/pci/host/pcie-designware.h  |  2 +-
>  drivers/pci/host/pcie-qcom.c|  6 --
>  drivers/pci/host/pcie-spear13xx.c   |  4 +++-
>  11 files changed, 37 insertions(+), 15 deletions(-)
> 

Thanks for the patch!

In my opinion your idea is good but only qcom driver is able to detect failure
in the specific host init routine, all others have a 'return 0' even if
something not well init. I would recomend that we take this issue a bit further
and add the error checking to all specific pci drivers in order to make them as
robust as qcom'.

Thanks,
Joao



Re: [PATCH v2 2/5] ia64: reuse append_elf_note() and final_note() functions

2016-12-02 Thread Hari Bathini

Hi Dave,


Thanks for the review.


On Thursday 01 December 2016 10:26 AM, Dave Young wrote:

Hi Hari

Personally I like V1 more, but split the patch 2 is easier for ia64
people to reivew.  I did basic x86 testing, it runs ok.

On 11/25/16 at 05:24pm, Hari Bathini wrote:

Get rid of multiple definitions of append_elf_note() & final_note()
functions. Reuse these functions compiled under CONFIG_CRASH_CORE.

Signed-off-by: Hari Bathini 
---
  arch/ia64/kernel/crash.c   |   22 --
  include/linux/crash_core.h |4 
  kernel/crash_core.c|6 +++---
  kernel/kexec_core.c|   28 
  4 files changed, 7 insertions(+), 53 deletions(-)

diff --git a/arch/ia64/kernel/crash.c b/arch/ia64/kernel/crash.c
index 2955f35..75859a0 100644
--- a/arch/ia64/kernel/crash.c
+++ b/arch/ia64/kernel/crash.c
@@ -27,28 +27,6 @@ static int kdump_freeze_monarch;
  static int kdump_on_init = 1;
  static int kdump_on_fatal_mca = 1;
  
-static inline Elf64_Word

-*append_elf_note(Elf64_Word *buf, char *name, unsigned type, void *data,
-   size_t data_len)
-{
-   struct elf_note *note = (struct elf_note *)buf;
-   note->n_namesz = strlen(name) + 1;
-   note->n_descsz = data_len;
-   note->n_type   = type;
-   buf += (sizeof(*note) + 3)/4;
-   memcpy(buf, name, note->n_namesz);
-   buf += (note->n_namesz + 3)/4;
-   memcpy(buf, data, data_len);
-   buf += (data_len + 3)/4;
-   return buf;
-}
-
-static void
-final_note(void *buf)
-{
-   memset(buf, 0, sizeof(struct elf_note));
-}
-

The above IA64 version looks better than the functions in kexec_core.c
about the Elf64_Word type usage and the simpler final_note function.


Hmmm.. Is void* better over Elf64_Word* to be agnostic of Elf32 or Elf64 
type?




Care to update crash_core.c to use this instead?


Sure. Will resend.

Thanks
Hari



Re: [PATCH v2] powerpc/powernv: Initialise nest mmu

2016-12-02 Thread Balbir Singh


>  static void __init radix_init_partition_table(void)
>  {
> -   unsigned long rts_field;
> +   unsigned long rts_field, ptcr;

I think these functions have changed, check for conflicts against
http://git.kernel.org/cgit/linux/kernel/git/paulus/powerpc.git/commit/?h=kvm-ppc-next=9d66195807ac6cb8a14231fd055ff755977c5fca



>
> rts_field = radix__get_tree_size();
>
> @@ -193,7 +194,9 @@ static void __init radix_init_partition_table(void)
>  * update partition table control register,
>  * 64 K size.
>  */

>
> +#ifdef CONFIG_PPC_POWERNV
> +extern void powernv_set_ptcr(unsigned long ptcr);
> +#else
> +static inline void powernv_set_ptcr(unisigned long ptcr) { }

Michael caught you for this already

Balbir


Re: [PATCH 1/2] powerpc/64: Fix checksum folding in csum_tcpudp_nofold and ip_fast_csum_nofold

2016-12-02 Thread Michael Ellerman
Paul Mackerras  writes:

> These functions compute an IP checksum by computing a 64-bit sum and
> folding it to 32 bits (the "nofold" in their names refers to folding
> down to 16 bits).  However, doing (u32) (s + (s >> 32)) is not
> sufficient to fold a 64-bit sum to 32 bits correctly.  The addition
> can produce a carry out from bit 31, which needs to be added in to
> the sum to produce the correct result.
>
> To fix this, we copy the from64to32() function from lib/checksum.c
> and use that.

This collided with:

f9d4286b9516 ("arch/powerpc: Update parameters for csum_tcpudp_magic & 
csum_tcpudp_nofold")

Mind rebasing?

cheers


Re: [PATCH v2] powerpc/powernv: Initialise nest mmu

2016-12-02 Thread Michael Ellerman
Alistair Popple  writes:

> diff --git a/arch/powerpc/platforms/powernv/powernv.h 
> b/arch/powerpc/platforms/powernv/powernv.h
> index da7c843..6fa9551 100644
> --- a/arch/powerpc/platforms/powernv/powernv.h
> +++ b/arch/powerpc/platforms/powernv/powernv.h
> @@ -9,6 +9,12 @@ static inline void pnv_smp_init(void) { }
>  
>  struct pci_dev;
>  
> +#ifdef CONFIG_PPC_POWERNV
> +extern void powernv_set_ptcr(unsigned long ptcr);
> +#else
> +static inline void powernv_set_ptcr(unisigned long ptcr) { }
 ^
 Your shout next time we're at the pub 
;)

cheers