diff mbox

[v2,2/3] vTPM: reformat event log to be byte-aligned

Message ID 1444263114-15081-3-git-send-email-honclo@linux.vnet.ibm.com (mailing list archive)
State New, archived
Headers show

Commit Message

Hon Ching (Vicky) Lo Oct. 8, 2015, 12:11 a.m. UTC
The event log generated by OpenFirmware in PowerPC is 4-byte aligned.
This patch reformats the log to be byte-aligned for the Linux client.

Signed-off-by: Hon Ching(Vicky) Lo <honclo@linux.vnet.ibm.com>
---
 arch/powerpc/kernel/prom_init.c |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)

Comments

Ashley Lai Oct. 13, 2015, 6:43 p.m. UTC | #1
On 10/07/2015 07:11 PM, Hon Ching(Vicky) Lo wrote:
> The event log generated by OpenFirmware in PowerPC is 4-byte aligned.
> This patch reformats the log to be byte-aligned for the Linux client.
>
> Signed-off-by: Hon Ching(Vicky) Lo <honclo@linux.vnet.ibm.com>
> ---
>   arch/powerpc/kernel/prom_init.c |   13 ++++++++++++-
>   1 files changed, 12 insertions(+), 1 deletions(-)
>
> diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
> index b9b6bb1..8a5c248 100644
> --- a/arch/powerpc/kernel/prom_init.c
> +++ b/arch/powerpc/kernel/prom_init.c
> @@ -1417,8 +1417,9 @@ static void __init prom_instantiate_sml(void)
>   {
>   	phandle ibmvtpm_node;
>   	ihandle ibmvtpm_inst;
> -	u32 entry = 0, size = 0;
> +	u32 entry = 0, size = 0, succ = 0;
>   	u64 base;
> +	__be32 val;
>   
>   	prom_debug("prom_instantiate_sml: start...\n");
>   
> @@ -1433,6 +1434,16 @@ static void __init prom_instantiate_sml(void)
>   		return;
>   	}
>   
> +	if (prom_getprop(ibmvtpm_node, "ibm,sml-efi-reformat-supported",
> +			 &val, sizeof(val)) != PROM_ERROR) {
> +		if (call_prom_ret("call-method", 2, 2, &succ,
> +				  ADDR("reformat-sml-to-efi-alignment"),
> +				  ibmvtpm_inst) != 0 || succ == 0) {

reformat-sml-to-efi-alignment is something new just added in the firmware?  I don't remember seeing it before.


> +			prom_printf("Reformat SML to EFI alignment failed\n");
> +			return;
> +		}
> +	}
> +
>   	if (call_prom_ret("call-method", 2, 2, &size,
>   			  ADDR("sml-get-handover-size"),
>   			  ibmvtpm_inst) != 0 || size == 0) {


------------------------------------------------------------------------------
Hon Ching (Vicky) Lo Oct. 13, 2015, 9:27 p.m. UTC | #2
On Tue, 2015-10-13 at 13:43 -0500, Ashley Lai wrote:
> 
> On 10/07/2015 07:11 PM, Hon Ching(Vicky) Lo wrote:
> > The event log generated by OpenFirmware in PowerPC is 4-byte aligned.
> > This patch reformats the log to be byte-aligned for the Linux client.
> >
> > Signed-off-by: Hon Ching(Vicky) Lo <honclo@linux.vnet.ibm.com>
> > ---
> >   arch/powerpc/kernel/prom_init.c |   13 ++++++++++++-
> >   1 files changed, 12 insertions(+), 1 deletions(-)
> >
> > diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
> > index b9b6bb1..8a5c248 100644
> > --- a/arch/powerpc/kernel/prom_init.c
> > +++ b/arch/powerpc/kernel/prom_init.c
> > @@ -1417,8 +1417,9 @@ static void __init prom_instantiate_sml(void)
> >   {
> >   	phandle ibmvtpm_node;
> >   	ihandle ibmvtpm_inst;
> > -	u32 entry = 0, size = 0;
> > +	u32 entry = 0, size = 0, succ = 0;
> >   	u64 base;
> > +	__be32 val;
> >   
> >   	prom_debug("prom_instantiate_sml: start...\n");
> >   
> > @@ -1433,6 +1434,16 @@ static void __init prom_instantiate_sml(void)
> >   		return;
> >   	}
> >   
> > +	if (prom_getprop(ibmvtpm_node, "ibm,sml-efi-reformat-supported",
> > +			 &val, sizeof(val)) != PROM_ERROR) {
> > +		if (call_prom_ret("call-method", 2, 2, &succ,
> > +				  ADDR("reformat-sml-to-efi-alignment"),
> > +				  ibmvtpm_inst) != 0 || succ == 0) {
> 
> reformat-sml-to-efi-alignment is something new just added in the firmware?  I don't remember seeing it before.

Yes, it's new.  Our new firmware version will support it.

> 
> 
> > +			prom_printf("Reformat SML to EFI alignment failed\n");
> > +			return;
> > +		}
> > +	}
> > +
> >   	if (call_prom_ret("call-method", 2, 2, &size,
> >   			  ADDR("sml-get-handover-size"),
> >   			  ibmvtpm_inst) != 0 || size == 0) {
> 



------------------------------------------------------------------------------
Ashley Lai Oct. 14, 2015, 9:15 p.m. UTC | #3
On 10/13/2015 04:27 PM, Hon Ching(Vicky) Lo wrote:
> On Tue, 2015-10-13 at 13:43 -0500, Ashley Lai wrote:
>> On 10/07/2015 07:11 PM, Hon Ching(Vicky) Lo wrote:
>>> The event log generated by OpenFirmware in PowerPC is 4-byte aligned.
>>> This patch reformats the log to be byte-aligned for the Linux client.
>>>
>>> Signed-off-by: Hon Ching(Vicky) Lo <honclo@linux.vnet.ibm.com>
>>> ---
>>>    arch/powerpc/kernel/prom_init.c |   13 ++++++++++++-
>>>    1 files changed, 12 insertions(+), 1 deletions(-)
>>>
>>> diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
>>> index b9b6bb1..8a5c248 100644
>>> --- a/arch/powerpc/kernel/prom_init.c
>>> +++ b/arch/powerpc/kernel/prom_init.c
>>> @@ -1417,8 +1417,9 @@ static void __init prom_instantiate_sml(void)
>>>    {
>>>    	phandle ibmvtpm_node;
>>>    	ihandle ibmvtpm_inst;
>>> -	u32 entry = 0, size = 0;
>>> +	u32 entry = 0, size = 0, succ = 0;
>>>    	u64 base;
>>> +	__be32 val;
>>>    
>>>    	prom_debug("prom_instantiate_sml: start...\n");
>>>    
>>> @@ -1433,6 +1434,16 @@ static void __init prom_instantiate_sml(void)
>>>    		return;
>>>    	}
>>>    
>>> +	if (prom_getprop(ibmvtpm_node, "ibm,sml-efi-reformat-supported",
>>> +			 &val, sizeof(val)) != PROM_ERROR) {
>>> +		if (call_prom_ret("call-method", 2, 2, &succ,
>>> +				  ADDR("reformat-sml-to-efi-alignment"),
>>> +				  ibmvtpm_inst) != 0 || succ == 0) {
>> reformat-sml-to-efi-alignment is something new just added in the firmware?  I don't remember seeing it before.
> Yes, it's new.  Our new firmware version will support it.
Looks like this will break the backward compatibility with the new 
kernel running on the older firmware.

>
>>
>>>
>


------------------------------------------------------------------------------
Ashley Lai Oct. 14, 2015, 9:20 p.m. UTC | #4
On 10/14/2015 04:15 PM, Ashley Lai wrote:
>
>
> On 10/13/2015 04:27 PM, Hon Ching(Vicky) Lo wrote:
>> On Tue, 2015-10-13 at 13:43 -0500, Ashley Lai wrote:
>>> On 10/07/2015 07:11 PM, Hon Ching(Vicky) Lo wrote:
>>>> The event log generated by OpenFirmware in PowerPC is 4-byte aligned.
>>>> This patch reformats the log to be byte-aligned for the Linux client.
>>>>
>>>> Signed-off-by: Hon Ching(Vicky) Lo <honclo@linux.vnet.ibm.com>
>>>> ---
>>>>    arch/powerpc/kernel/prom_init.c |   13 ++++++++++++-
>>>>    1 files changed, 12 insertions(+), 1 deletions(-)
>>>>
>>>> diff --git a/arch/powerpc/kernel/prom_init.c 
>>>> b/arch/powerpc/kernel/prom_init.c
>>>> index b9b6bb1..8a5c248 100644
>>>> --- a/arch/powerpc/kernel/prom_init.c
>>>> +++ b/arch/powerpc/kernel/prom_init.c
>>>> @@ -1417,8 +1417,9 @@ static void __init prom_instantiate_sml(void)
>>>>    {
>>>>        phandle ibmvtpm_node;
>>>>        ihandle ibmvtpm_inst;
>>>> -    u32 entry = 0, size = 0;
>>>> +    u32 entry = 0, size = 0, succ = 0;
>>>>        u64 base;
>>>> +    __be32 val;
>>>>           prom_debug("prom_instantiate_sml: start...\n");
>>>>    @@ -1433,6 +1434,16 @@ static void __init 
>>>> prom_instantiate_sml(void)
>>>>            return;
>>>>        }
>>>>    +    if (prom_getprop(ibmvtpm_node, 
>>>> "ibm,sml-efi-reformat-supported",
>>>> +             &val, sizeof(val)) != PROM_ERROR) {
>>>> +        if (call_prom_ret("call-method", 2, 2, &succ,
>>>> +                  ADDR("reformat-sml-to-efi-alignment"),
>>>> +                  ibmvtpm_inst) != 0 || succ == 0) {
>>> reformat-sml-to-efi-alignment is something new just added in the 
>>> firmware?  I don't remember seeing it before.
>> Yes, it's new.  Our new firmware version will support it.
> Looks like this will break the backward compatibility with the new 
> kernel running on the older firmware.
Never mind.  I missed the check before that.  Looks good to me.


>
>>
>>>
>>>>
>>
>


------------------------------------------------------------------------------
diff mbox

Patch

diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
index b9b6bb1..8a5c248 100644
--- a/arch/powerpc/kernel/prom_init.c
+++ b/arch/powerpc/kernel/prom_init.c
@@ -1417,8 +1417,9 @@  static void __init prom_instantiate_sml(void)
 {
 	phandle ibmvtpm_node;
 	ihandle ibmvtpm_inst;
-	u32 entry = 0, size = 0;
+	u32 entry = 0, size = 0, succ = 0;
 	u64 base;
+	__be32 val;
 
 	prom_debug("prom_instantiate_sml: start...\n");
 
@@ -1433,6 +1434,16 @@  static void __init prom_instantiate_sml(void)
 		return;
 	}
 
+	if (prom_getprop(ibmvtpm_node, "ibm,sml-efi-reformat-supported",
+			 &val, sizeof(val)) != PROM_ERROR) {
+		if (call_prom_ret("call-method", 2, 2, &succ,
+				  ADDR("reformat-sml-to-efi-alignment"),
+				  ibmvtpm_inst) != 0 || succ == 0) {
+			prom_printf("Reformat SML to EFI alignment failed\n");
+			return;
+		}
+	}
+
 	if (call_prom_ret("call-method", 2, 2, &size,
 			  ADDR("sml-get-handover-size"),
 			  ibmvtpm_inst) != 0 || size == 0) {