diff mbox

[v2,2/4] ARM: nommu: dynamic exception base address setting

Message ID 20170308162258.GA3515@afzalpc (mailing list archive)
State New, archived
Headers show

Commit Message

afzal mohammed March 8, 2017, 4:22 p.m. UTC
Hi Greg,

Was standing on one leg & hoping that nothing breaks, knocked down,

On Wed, Mar 08, 2017 at 01:21:36PM +1000, Greg Ungerer wrote:

> This patch (which is in mainline now as commit f8300a0b5d) breaks
> my patch series to support running the Versatile QEMU target with
> a nommu configured linux kernel.

Sorry

> > +	return !!cpuid_feature_extract(CPUID_EXT_PFR1, 4);
> 
> The problem is here. This ends up generating the asm code:
> 
>   2ebacc:       ee103f31        mrc     15, 0, r3, cr0, cr1, {1}

Thanks for finding the root cause


i have in mind the diff at the end (need to recheck it's correctness),
saw your response that Vladimir's fix works for you, either (if this
works) way, let's fix ASAP.

Regards
afzal

---8<---

Comments

Greg Ungerer March 8, 2017, 11:51 p.m. UTC | #1
Hi Afzal,

On 09/03/17 02:22, afzal mohammed wrote:
> Was standing on one leg & hoping that nothing breaks, knocked down,

I think you are still standing... Breaking an out-of-tree patch
is a bit like the tree that falls in the forest that no-one hears :-)


> On Wed, Mar 08, 2017 at 01:21:36PM +1000, Greg Ungerer wrote:
> 
>> This patch (which is in mainline now as commit f8300a0b5d) breaks
>> my patch series to support running the Versatile QEMU target with
>> a nommu configured linux kernel.
> 
> Sorry
>
>>> +	return !!cpuid_feature_extract(CPUID_EXT_PFR1, 4);
>>
>> The problem is here. This ends up generating the asm code:
>>
>>   2ebacc:       ee103f31        mrc     15, 0, r3, cr0, cr1, {1}
> 
> Thanks for finding the root cause
> 
> 
> i have in mind the diff at the end (need to recheck it's correctness),
> saw your response that Vladimir's fix works for you, either (if this
> works) way, let's fix ASAP.

The patch below works too. Thanks for the quick response.

Regards
Greg


> ---8<---
> diff --git a/arch/arm/mm/nommu.c b/arch/arm/mm/nommu.c
> index 3b5c7aaf9c76..081562f5436e 100644
> --- a/arch/arm/mm/nommu.c
> +++ b/arch/arm/mm/nommu.c
> @@ -303,7 +303,9 @@ static inline void set_vbar(unsigned long val)
>   */
>  static inline bool security_extensions_enabled(void)
>  {
> -	return !!cpuid_feature_extract(CPUID_EXT_PFR1, 4);
> +	if ((read_cpuid_id() & 0x000F0000) == 0x000F0000)
> +		return !!cpuid_feature_extract(CPUID_EXT_PFR1, 4);
> +	return 0;
>  }
>  
>  static unsigned long __init setup_vectors_base(void)
>
afzal mohammed March 9, 2017, 12:46 p.m. UTC | #2
Hi,

On Thu, Mar 09, 2017 at 09:51:58AM +1000, Greg Ungerer wrote:
> The patch below works too. Thanks for the quick response.

Thanks Greg for verifying

Vladimir, would the diff like below okay ?

Regards
afzal

> > ---8<---
> > diff --git a/arch/arm/mm/nommu.c b/arch/arm/mm/nommu.c
> > index 3b5c7aaf9c76..081562f5436e 100644
> > --- a/arch/arm/mm/nommu.c
> > +++ b/arch/arm/mm/nommu.c
> > @@ -303,7 +303,9 @@ static inline void set_vbar(unsigned long val)
> >   */
> >  static inline bool security_extensions_enabled(void)
> >  {
> > -	return !!cpuid_feature_extract(CPUID_EXT_PFR1, 4);
> > +	if ((read_cpuid_id() & 0x000F0000) == 0x000F0000)
> > +		return !!cpuid_feature_extract(CPUID_EXT_PFR1, 4);
> > +	return 0;
> >  }
> >  
> >  static unsigned long __init setup_vectors_base(void)
> >
Vladimir Murzin March 9, 2017, 12:55 p.m. UTC | #3
On 09/03/17 12:46, afzal mohammed wrote:
> Hi,
> 
> On Thu, Mar 09, 2017 at 09:51:58AM +1000, Greg Ungerer wrote:
>> The patch below works too. Thanks for the quick response.
> 
> Thanks Greg for verifying
> 
> Vladimir, would the diff like below okay ?

Well, we should ask Russell which version he (dis)likes :)

Cheers
Vladimir

> 
> Regards
> afzal
> 
>>> ---8<---
>>> diff --git a/arch/arm/mm/nommu.c b/arch/arm/mm/nommu.c
>>> index 3b5c7aaf9c76..081562f5436e 100644
>>> --- a/arch/arm/mm/nommu.c
>>> +++ b/arch/arm/mm/nommu.c
>>> @@ -303,7 +303,9 @@ static inline void set_vbar(unsigned long val)
>>>   */
>>>  static inline bool security_extensions_enabled(void)
>>>  {
>>> -	return !!cpuid_feature_extract(CPUID_EXT_PFR1, 4);
>>> +	if ((read_cpuid_id() & 0x000F0000) == 0x000F0000)
>>> +		return !!cpuid_feature_extract(CPUID_EXT_PFR1, 4);
>>> +	return 0;
>>>  }
>>>  
>>>  static unsigned long __init setup_vectors_base(void)
>>>
>
afzal mohammed March 10, 2017, 2:08 p.m. UTC | #4
Hi,

i was thinking of sending a patch to fix the Greg's issue today as
will be losing access to the boards shortly for a few days, and then
came to know that -next won't be there next week, so once back after a
few days plan to post the fix unless some one overtakes me. And
perhaps more suggestion/feedback can be obtained by that time, rather
an excuse for laziness ;)

Regards
afzal
diff mbox

Patch

diff --git a/arch/arm/mm/nommu.c b/arch/arm/mm/nommu.c
index 3b5c7aaf9c76..081562f5436e 100644
--- a/arch/arm/mm/nommu.c
+++ b/arch/arm/mm/nommu.c
@@ -303,7 +303,9 @@  static inline void set_vbar(unsigned long val)
  */
 static inline bool security_extensions_enabled(void)
 {
-	return !!cpuid_feature_extract(CPUID_EXT_PFR1, 4);
+	if ((read_cpuid_id() & 0x000F0000) == 0x000F0000)
+		return !!cpuid_feature_extract(CPUID_EXT_PFR1, 4);
+	return 0;
 }
 
 static unsigned long __init setup_vectors_base(void)