Re: [PATCH v2 3/3] powerpc/fsl: Implement cpu_show_spectre_v1/v2 for NXP PowerPC Book3E

2018-07-05 Thread Diana Madalina Craciun
On 07/03/2018 10:26 AM, Michael Ellerman wrote:
> Michal Suchánek  writes:
>> On Tue, 12 Jun 2018 02:59:11 +
>> Bharat Bhushan  wrote:
>>
>>> Hi Diana,
>>>
>>>> -Original Message-
>>>> From: Diana Craciun [mailto:diana.crac...@nxp.com]
>>>> Sent: Monday, June 11, 2018 6:23 PM
>>>> To: linuxppc-dev@lists.ozlabs.org
>>>> Cc: m...@ellerman.id.au; o...@buserror.net; Leo Li
>>>> ; Bharat Bhushan ;
>>>> Diana Madalina Craciun 
>>>> Subject: [PATCH v2 3/3] powerpc/fsl: Implement
>>>> cpu_show_spectre_v1/v2 for NXP PowerPC Book3E  
>>> Please add some description
>> To me the subject is self-explanatory. It implements a kernel interface
>> that was already described elsewhere.
>>
>> What are you missing here?
> It should at least explain why it's reimplementing a function that
> already exists for powerpc. ie. Why can't the existing version be used?
>
> cheers
>
OK. I think I can use the cpu_show_spectre_v1 and for now I can use
cpu_show_spectre_v2 as well (the patches are under development for
mitigating Spectre v2). But I cannot use cpu_show_meltdown because it
uses references to variables that are specific to BOOK3S_64. But I do
not need a special implementation for cpu_show_meltdown because our
platform is not vulnerable to Meltdown. So, I will just ifdef the
cpu_show_meltdown and leave the default implementation.

Diana






Re: [PATCH v2 3/3] powerpc/fsl: Implement cpu_show_spectre_v1/v2 for NXP PowerPC Book3E

2018-07-03 Thread Michael Ellerman
Michal Suchánek  writes:
> On Tue, 12 Jun 2018 02:59:11 +
> Bharat Bhushan  wrote:
>
>> Hi Diana,
>> 
>> > -Original Message-
>> > From: Diana Craciun [mailto:diana.crac...@nxp.com]
>> > Sent: Monday, June 11, 2018 6:23 PM
>> > To: linuxppc-dev@lists.ozlabs.org
>> > Cc: m...@ellerman.id.au; o...@buserror.net; Leo Li
>> > ; Bharat Bhushan ;
>> > Diana Madalina Craciun 
>> > Subject: [PATCH v2 3/3] powerpc/fsl: Implement
>> > cpu_show_spectre_v1/v2 for NXP PowerPC Book3E  
>> 
>> Please add some description
>
> To me the subject is self-explanatory. It implements a kernel interface
> that was already described elsewhere.
>
> What are you missing here?

It should at least explain why it's reimplementing a function that
already exists for powerpc. ie. Why can't the existing version be used?

cheers


Re: [PATCH v2 3/3] powerpc/fsl: Implement cpu_show_spectre_v1/v2 for NXP PowerPC Book3E

2018-06-12 Thread Michal Suchánek
On Tue, 12 Jun 2018 02:59:11 +
Bharat Bhushan  wrote:

> Hi Diana,
> 
> > -Original Message-
> > From: Diana Craciun [mailto:diana.crac...@nxp.com]
> > Sent: Monday, June 11, 2018 6:23 PM
> > To: linuxppc-dev@lists.ozlabs.org
> > Cc: m...@ellerman.id.au; o...@buserror.net; Leo Li
> > ; Bharat Bhushan ;
> > Diana Madalina Craciun 
> > Subject: [PATCH v2 3/3] powerpc/fsl: Implement
> > cpu_show_spectre_v1/v2 for NXP PowerPC Book3E  
> 
> Please add some description

To me the subject is self-explanatory. It implements a kernel interface
that was already described elsewhere.

What are you missing here?

Thanks

Michal

> 
> > 
> > Signed-off-by: Diana Craciun 
> > ---
> >  arch/powerpc/Kconfig   |  2 +-
> >  arch/powerpc/kernel/security.c | 15 +++
> >  2 files changed, 16 insertions(+), 1 deletion(-)
> > 
> > diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index
> > 940c955..a781d60 100644
> > --- a/arch/powerpc/Kconfig
> > +++ b/arch/powerpc/Kconfig
> > @@ -170,7 +170,7 @@ config PPC
> > select GENERIC_CLOCKEVENTS_BROADCASTif SMP
> > select GENERIC_CMOS_UPDATE
> > select GENERIC_CPU_AUTOPROBE
> > -   select GENERIC_CPU_VULNERABILITIES  if PPC_BOOK3S_64
> > +   select GENERIC_CPU_VULNERABILITIES  if PPC_BOOK3S_64
> > || PPC_FSL_BOOK3E
> > select GENERIC_IRQ_SHOW
> > select GENERIC_IRQ_SHOW_LEVEL
> > select GENERIC_SMP_IDLE_THREAD
> > diff --git a/arch/powerpc/kernel/security.c
> > b/arch/powerpc/kernel/security.c index 797c975..aceaadc 100644
> > --- a/arch/powerpc/kernel/security.c
> > +++ b/arch/powerpc/kernel/security.c
> > @@ -183,3 +183,18 @@ ssize_t cpu_show_spectre_v2(struct device *dev,
> > struct device_attribute *attr, c  }  #endif /* CONFIG_PPC_BOOK3S_64
> > */
> > 
> > +#ifdef CONFIG_PPC_FSL_BOOK3E
> > +ssize_t cpu_show_spectre_v1(struct device *dev, struct
> > device_attribute +*attr, char *buf) {
> > +   if (barrier_nospec_enabled)
> > +   return sprintf(buf, "Mitigation: __user pointer
> > sanitization\n"); +
> > +   return sprintf(buf, "Vulnerable\n");
> > +}
> > +
> > +ssize_t cpu_show_spectre_v2(struct device *dev, struct
> > device_attribute +*attr, char *buf) {
> > +   return sprintf(buf, "Vulnerable\n");
> > +}
> > +#endif /* CONFIG_PPC_FSL_BOOK3E */
> > +
> > --
> > 2.5.5  
> 



RE: [PATCH v2 3/3] powerpc/fsl: Implement cpu_show_spectre_v1/v2 for NXP PowerPC Book3E

2018-06-11 Thread Bharat Bhushan
Hi Diana,

> -Original Message-
> From: Diana Craciun [mailto:diana.crac...@nxp.com]
> Sent: Monday, June 11, 2018 6:23 PM
> To: linuxppc-dev@lists.ozlabs.org
> Cc: m...@ellerman.id.au; o...@buserror.net; Leo Li ;
> Bharat Bhushan ; Diana Madalina Craciun
> 
> Subject: [PATCH v2 3/3] powerpc/fsl: Implement cpu_show_spectre_v1/v2 for
> NXP PowerPC Book3E

Please add some description

> 
> Signed-off-by: Diana Craciun 
> ---
>  arch/powerpc/Kconfig   |  2 +-
>  arch/powerpc/kernel/security.c | 15 +++
>  2 files changed, 16 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig index
> 940c955..a781d60 100644
> --- a/arch/powerpc/Kconfig
> +++ b/arch/powerpc/Kconfig
> @@ -170,7 +170,7 @@ config PPC
>   select GENERIC_CLOCKEVENTS_BROADCASTif SMP
>   select GENERIC_CMOS_UPDATE
>   select GENERIC_CPU_AUTOPROBE
> - select GENERIC_CPU_VULNERABILITIES  if PPC_BOOK3S_64
> + select GENERIC_CPU_VULNERABILITIES  if PPC_BOOK3S_64 ||
> PPC_FSL_BOOK3E
>   select GENERIC_IRQ_SHOW
>   select GENERIC_IRQ_SHOW_LEVEL
>   select GENERIC_SMP_IDLE_THREAD
> diff --git a/arch/powerpc/kernel/security.c b/arch/powerpc/kernel/security.c
> index 797c975..aceaadc 100644
> --- a/arch/powerpc/kernel/security.c
> +++ b/arch/powerpc/kernel/security.c
> @@ -183,3 +183,18 @@ ssize_t cpu_show_spectre_v2(struct device *dev,
> struct device_attribute *attr, c  }  #endif /* CONFIG_PPC_BOOK3S_64 */
> 
> +#ifdef CONFIG_PPC_FSL_BOOK3E
> +ssize_t cpu_show_spectre_v1(struct device *dev, struct device_attribute
> +*attr, char *buf) {
> + if (barrier_nospec_enabled)
> + return sprintf(buf, "Mitigation: __user pointer 
> sanitization\n");
> +
> + return sprintf(buf, "Vulnerable\n");
> +}
> +
> +ssize_t cpu_show_spectre_v2(struct device *dev, struct device_attribute
> +*attr, char *buf) {
> + return sprintf(buf, "Vulnerable\n");
> +}
> +#endif /* CONFIG_PPC_FSL_BOOK3E */
> +
> --
> 2.5.5



[PATCH v2 3/3] powerpc/fsl: Implement cpu_show_spectre_v1/v2 for NXP PowerPC Book3E

2018-06-11 Thread Diana Craciun
Signed-off-by: Diana Craciun 
---
 arch/powerpc/Kconfig   |  2 +-
 arch/powerpc/kernel/security.c | 15 +++
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 940c955..a781d60 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -170,7 +170,7 @@ config PPC
select GENERIC_CLOCKEVENTS_BROADCASTif SMP
select GENERIC_CMOS_UPDATE
select GENERIC_CPU_AUTOPROBE
-   select GENERIC_CPU_VULNERABILITIES  if PPC_BOOK3S_64
+   select GENERIC_CPU_VULNERABILITIES  if PPC_BOOK3S_64 || 
PPC_FSL_BOOK3E
select GENERIC_IRQ_SHOW
select GENERIC_IRQ_SHOW_LEVEL
select GENERIC_SMP_IDLE_THREAD
diff --git a/arch/powerpc/kernel/security.c b/arch/powerpc/kernel/security.c
index 797c975..aceaadc 100644
--- a/arch/powerpc/kernel/security.c
+++ b/arch/powerpc/kernel/security.c
@@ -183,3 +183,18 @@ ssize_t cpu_show_spectre_v2(struct device *dev, struct 
device_attribute *attr, c
 }
 #endif /* CONFIG_PPC_BOOK3S_64 */
 
+#ifdef CONFIG_PPC_FSL_BOOK3E
+ssize_t cpu_show_spectre_v1(struct device *dev, struct device_attribute *attr, 
char *buf)
+{
+   if (barrier_nospec_enabled)
+   return sprintf(buf, "Mitigation: __user pointer 
sanitization\n");
+
+   return sprintf(buf, "Vulnerable\n");
+}
+
+ssize_t cpu_show_spectre_v2(struct device *dev, struct device_attribute *attr, 
char *buf)
+{
+   return sprintf(buf, "Vulnerable\n");
+}
+#endif /* CONFIG_PPC_FSL_BOOK3E */
+
-- 
2.5.5