* [PATCH] powerpc/powernv: Check image loaded or not before calling flash
@ 2015-02-12 9:53 Vasant Hegde
2015-02-12 21:27 ` Benjamin Herrenschmidt
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Vasant Hegde @ 2015-02-12 9:53 UTC (permalink / raw)
To: linuxppc-dev; +Cc: benh, sam.bobroff
Present code checks for update_flash_data in opal_flash_term_callback().
update_flash_data has been statically initialized to zero, and that
is the value of FLASH_IMG_READY. Also code update initialization happens
during subsys init.
So if reboot is issued before the subsys init stage then we endup displaying
"Flashing new firmware" message.. which may confuse end user.
This patch adds additional validation to make sure image is actually loaded
or not.
Reported-by: Sam Bobroff <sam.bobroff@au1.ibm.com>
Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
---
arch/powerpc/platforms/powernv/opal-flash.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/powerpc/platforms/powernv/opal-flash.c b/arch/powerpc/platforms/powernv/opal-flash.c
index 5c21d9c..5455cd4 100644
--- a/arch/powerpc/platforms/powernv/opal-flash.c
+++ b/arch/powerpc/platforms/powernv/opal-flash.c
@@ -319,7 +319,8 @@ void opal_flash_term_callback(void)
{
struct cpumask mask;
- if (update_flash_data.status != FLASH_IMG_READY)
+ if (update_flash_data.status != FLASH_IMG_READY ||
+ image_data.status != IMAGE_READY)
return;
pr_alert("FLASH: Flashing new firmware\n");
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] powerpc/powernv: Check image loaded or not before calling flash
2015-02-12 9:53 [PATCH] powerpc/powernv: Check image loaded or not before calling flash Vasant Hegde
@ 2015-02-12 21:27 ` Benjamin Herrenschmidt
2015-02-13 2:46 ` Sam Bobroff
2015-02-13 5:52 ` Vasant Hegde
2015-02-13 9:48 ` Vasant Hegde
2015-02-13 9:56 ` [PATCH v2] " Vasant Hegde
2 siblings, 2 replies; 7+ messages in thread
From: Benjamin Herrenschmidt @ 2015-02-12 21:27 UTC (permalink / raw)
To: Vasant Hegde; +Cc: linuxppc-dev, sam.bobroff
On Thu, 2015-02-12 at 15:23 +0530, Vasant Hegde wrote:
> Present code checks for update_flash_data in opal_flash_term_callback().
> update_flash_data has been statically initialized to zero, and that
> is the value of FLASH_IMG_READY. Also code update initialization happens
> during subsys init.
Please statically initialize it to a sane value instead.
> So if reboot is issued before the subsys init stage then we endup displaying
> "Flashing new firmware" message.. which may confuse end user.
>
> This patch adds additional validation to make sure image is actually loaded
> or not.
>
> Reported-by: Sam Bobroff <sam.bobroff@au1.ibm.com>
> Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
> ---
> arch/powerpc/platforms/powernv/opal-flash.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/arch/powerpc/platforms/powernv/opal-flash.c b/arch/powerpc/platforms/powernv/opal-flash.c
> index 5c21d9c..5455cd4 100644
> --- a/arch/powerpc/platforms/powernv/opal-flash.c
> +++ b/arch/powerpc/platforms/powernv/opal-flash.c
> @@ -319,7 +319,8 @@ void opal_flash_term_callback(void)
> {
> struct cpumask mask;
>
> - if (update_flash_data.status != FLASH_IMG_READY)
> + if (update_flash_data.status != FLASH_IMG_READY ||
> + image_data.status != IMAGE_READY)
> return;
>
> pr_alert("FLASH: Flashing new firmware\n");
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] powerpc/powernv: Check image loaded or not before calling flash
2015-02-12 21:27 ` Benjamin Herrenschmidt
@ 2015-02-13 2:46 ` Sam Bobroff
2015-02-13 5:53 ` Vasant Hegde
2015-02-13 5:52 ` Vasant Hegde
1 sibling, 1 reply; 7+ messages in thread
From: Sam Bobroff @ 2015-02-13 2:46 UTC (permalink / raw)
To: linuxppc-dev
On 13/02/15 08:27, Benjamin Herrenschmidt wrote:
> On Thu, 2015-02-12 at 15:23 +0530, Vasant Hegde wrote:
>> Present code checks for update_flash_data in opal_flash_term_callback().
>> update_flash_data has been statically initialized to zero, and that
>> is the value of FLASH_IMG_READY. Also code update initialization happens
>> during subsys init.
>
> Please statically initialize it to a sane value instead.
I've tested this patch and it works for me (the message is suppressed)
but I agree with Ben that it seems cleaner to use a static initializer.
>> So if reboot is issued before the subsys init stage then we endup displaying
>> "Flashing new firmware" message.. which may confuse end user.
>>
>> This patch adds additional validation to make sure image is actually loaded
>> or not.
>>
>> Reported-by: Sam Bobroff <sam.bobroff@au1.ibm.com>
>> Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
>> ---
>> arch/powerpc/platforms/powernv/opal-flash.c | 3 ++-
>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/arch/powerpc/platforms/powernv/opal-flash.c b/arch/powerpc/platforms/powernv/opal-flash.c
>> index 5c21d9c..5455cd4 100644
>> --- a/arch/powerpc/platforms/powernv/opal-flash.c
>> +++ b/arch/powerpc/platforms/powernv/opal-flash.c
>> @@ -319,7 +319,8 @@ void opal_flash_term_callback(void)
>> {
>> struct cpumask mask;
>>
>> - if (update_flash_data.status != FLASH_IMG_READY)
>> + if (update_flash_data.status != FLASH_IMG_READY ||
>> + image_data.status != IMAGE_READY)
>> return;
>>
>> pr_alert("FLASH: Flashing new firmware\n");
>
>
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] powerpc/powernv: Check image loaded or not before calling flash
2015-02-13 2:46 ` Sam Bobroff
@ 2015-02-13 5:53 ` Vasant Hegde
0 siblings, 0 replies; 7+ messages in thread
From: Vasant Hegde @ 2015-02-13 5:53 UTC (permalink / raw)
To: Sam Bobroff, linuxppc-dev
On 02/13/2015 08:16 AM, Sam Bobroff wrote:
> On 13/02/15 08:27, Benjamin Herrenschmidt wrote:
>> On Thu, 2015-02-12 at 15:23 +0530, Vasant Hegde wrote:
>>> Present code checks for update_flash_data in opal_flash_term_callback().
>>> update_flash_data has been statically initialized to zero, and that
>>> is the value of FLASH_IMG_READY. Also code update initialization happens
>>> during subsys init.
>>
>> Please statically initialize it to a sane value instead.
>
> I've tested this patch and it works for me (the message is suppressed)
Sam,
Thanks for testing!
-Vasant
> but I agree with Ben that it seems cleaner to use a static initializer.
>
>>> So if reboot is issued before the subsys init stage then we endup displaying
>>> "Flashing new firmware" message.. which may confuse end user.
>>>
>>> This patch adds additional validation to make sure image is actually loaded
>>> or not.
>>>
>>> Reported-by: Sam Bobroff <sam.bobroff@au1.ibm.com>
>>> Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
>>> ---
>>> arch/powerpc/platforms/powernv/opal-flash.c | 3 ++-
>>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/arch/powerpc/platforms/powernv/opal-flash.c b/arch/powerpc/platforms/powernv/opal-flash.c
>>> index 5c21d9c..5455cd4 100644
>>> --- a/arch/powerpc/platforms/powernv/opal-flash.c
>>> +++ b/arch/powerpc/platforms/powernv/opal-flash.c
>>> @@ -319,7 +319,8 @@ void opal_flash_term_callback(void)
>>> {
>>> struct cpumask mask;
>>>
>>> - if (update_flash_data.status != FLASH_IMG_READY)
>>> + if (update_flash_data.status != FLASH_IMG_READY ||
>>> + image_data.status != IMAGE_READY)
>>> return;
>>>
>>> pr_alert("FLASH: Flashing new firmware\n");
>>
>>
>> _______________________________________________
>> Linuxppc-dev mailing list
>> Linuxppc-dev@lists.ozlabs.org
>> https://lists.ozlabs.org/listinfo/linuxppc-dev
>>
>
> _______________________________________________
> Linuxppc-dev mailing list
> Linuxppc-dev@lists.ozlabs.org
> https://lists.ozlabs.org/listinfo/linuxppc-dev
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] powerpc/powernv: Check image loaded or not before calling flash
2015-02-12 21:27 ` Benjamin Herrenschmidt
2015-02-13 2:46 ` Sam Bobroff
@ 2015-02-13 5:52 ` Vasant Hegde
1 sibling, 0 replies; 7+ messages in thread
From: Vasant Hegde @ 2015-02-13 5:52 UTC (permalink / raw)
To: Benjamin Herrenschmidt; +Cc: linuxppc-dev, sam.bobroff
On 02/13/2015 02:57 AM, Benjamin Herrenschmidt wrote:
> On Thu, 2015-02-12 at 15:23 +0530, Vasant Hegde wrote:
>> Present code checks for update_flash_data in opal_flash_term_callback().
>> update_flash_data has been statically initialized to zero, and that
>> is the value of FLASH_IMG_READY. Also code update initialization happens
>> during subsys init.
>
> Please statically initialize it to a sane value instead.
Ok. Will fix and send v2 soon. Thanks!
-Vasant
>
>> So if reboot is issued before the subsys init stage then we endup displaying
>> "Flashing new firmware" message.. which may confuse end user.
>>
>> This patch adds additional validation to make sure image is actually loaded
>> or not.
>>
>> Reported-by: Sam Bobroff <sam.bobroff@au1.ibm.com>
>> Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
>> ---
>> arch/powerpc/platforms/powernv/opal-flash.c | 3 ++-
>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/arch/powerpc/platforms/powernv/opal-flash.c b/arch/powerpc/platforms/powernv/opal-flash.c
>> index 5c21d9c..5455cd4 100644
>> --- a/arch/powerpc/platforms/powernv/opal-flash.c
>> +++ b/arch/powerpc/platforms/powernv/opal-flash.c
>> @@ -319,7 +319,8 @@ void opal_flash_term_callback(void)
>> {
>> struct cpumask mask;
>>
>> - if (update_flash_data.status != FLASH_IMG_READY)
>> + if (update_flash_data.status != FLASH_IMG_READY ||
>> + image_data.status != IMAGE_READY)
>> return;
>>
>> pr_alert("FLASH: Flashing new firmware\n");
>
>
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH] powerpc/powernv: Check image loaded or not before calling flash
2015-02-12 9:53 [PATCH] powerpc/powernv: Check image loaded or not before calling flash Vasant Hegde
2015-02-12 21:27 ` Benjamin Herrenschmidt
@ 2015-02-13 9:48 ` Vasant Hegde
2015-02-13 9:56 ` [PATCH v2] " Vasant Hegde
2 siblings, 0 replies; 7+ messages in thread
From: Vasant Hegde @ 2015-02-13 9:48 UTC (permalink / raw)
To: linuxppc-dev; +Cc: benh, sam.bobroff
Present code checks for update_flash_data in opal_flash_term_callback().
update_flash_data has been statically initialized to zero, and that
is the value of FLASH_IMG_READY. Also code update initialization happens
during subsys init.
So if reboot is issued before the subsys init stage then we endup displaying
"Flashing new firmware" message.. which may confuse end user.
This patch fixes above described issue by initializes update_flash status
to invalid state.
Reported-by: Sam Bobroff <sam.bobroff@au1.ibm.com>
Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
---
Ben, Sam,
How about this patch?
Initially I though of changing FLASH_IMG_READY value. But it has a impact
on user space tool. (update_flash checks this value before calling reboot.
See update_show function. Of course we can work around that .. But I thought
this one is simpler approach.
-Vasant
arch/powerpc/platforms/powernv/opal-flash.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/arch/powerpc/platforms/powernv/opal-flash.c b/arch/powerpc/platforms/powernv/opal-flash.c
index 5c21d9c..0ff07ff 100644
--- a/arch/powerpc/platforms/powernv/opal-flash.c
+++ b/arch/powerpc/platforms/powernv/opal-flash.c
@@ -120,7 +120,11 @@ static struct image_header_t image_header;
static struct image_data_t image_data;
static struct validate_flash_t validate_flash_data;
static struct manage_flash_t manage_flash_data;
-static struct update_flash_t update_flash_data;
+
+/* Initialize update_flash_data status to No Operation */
+static struct update_flash_t update_flash_data = {
+ .status = FLASH_NO_OP,
+};
static DEFINE_MUTEX(image_data_mutex);
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v2] powerpc/powernv: Check image loaded or not before calling flash
2015-02-12 9:53 [PATCH] powerpc/powernv: Check image loaded or not before calling flash Vasant Hegde
2015-02-12 21:27 ` Benjamin Herrenschmidt
2015-02-13 9:48 ` Vasant Hegde
@ 2015-02-13 9:56 ` Vasant Hegde
2 siblings, 0 replies; 7+ messages in thread
From: Vasant Hegde @ 2015-02-13 9:56 UTC (permalink / raw)
To: linuxppc-dev; +Cc: benh, sam.bobroff
Present code checks for update_flash_data in opal_flash_term_callback().
update_flash_data has been statically initialized to zero, and that
is the value of FLASH_IMG_READY. Also code update initialization happens
during subsys init.
So if reboot is issued before the subsys init stage then we endup displaying
"Flashing new firmware" message.. which may confuse end user.
This patch fixes above described issue by initializes update_flash status
to invalid state.
Reported-by: Sam Bobroff <sam.bobroff@au1.ibm.com>
Signed-off-by: Vasant Hegde <hegdevasant@linux.vnet.ibm.com>
---
arch/powerpc/platforms/powernv/opal-flash.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/arch/powerpc/platforms/powernv/opal-flash.c b/arch/powerpc/platforms/powernv/opal-flash.c
index 5c21d9c..0ff07ff 100644
--- a/arch/powerpc/platforms/powernv/opal-flash.c
+++ b/arch/powerpc/platforms/powernv/opal-flash.c
@@ -120,7 +120,11 @@ static struct image_header_t image_header;
static struct image_data_t image_data;
static struct validate_flash_t validate_flash_data;
static struct manage_flash_t manage_flash_data;
-static struct update_flash_t update_flash_data;
+
+/* Initialize update_flash_data status to No Operation */
+static struct update_flash_t update_flash_data = {
+ .status = FLASH_NO_OP,
+};
static DEFINE_MUTEX(image_data_mutex);
^ permalink raw reply related [flat|nested] 7+ messages in thread
end of thread, other threads:[~2015-02-13 9:56 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-12 9:53 [PATCH] powerpc/powernv: Check image loaded or not before calling flash Vasant Hegde
2015-02-12 21:27 ` Benjamin Herrenschmidt
2015-02-13 2:46 ` Sam Bobroff
2015-02-13 5:53 ` Vasant Hegde
2015-02-13 5:52 ` Vasant Hegde
2015-02-13 9:48 ` Vasant Hegde
2015-02-13 9:56 ` [PATCH v2] " Vasant Hegde
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).