Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1241878 > unrolled thread

[PATCH] vTPM: fix memory allocation flag for rtce buffer at kernel boot

Started by"Hon Ching(Vicky) Lo" <honclo@linux.vnet.ibm.com>
First post2015-10-08 02:20 +0200
Last post2015-10-14 23:30 +0200
Articles 6 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] vTPM: fix memory allocation flag for rtce buffer at kernel boot "Hon Ching(Vicky) Lo" <honclo@linux.vnet.ibm.com> - 2015-10-08 02:20 +0200
    [PATCH v2 2/3] vTPM: reformat event log to be byte-aligned "Hon Ching(Vicky) Lo" <honclo@linux.vnet.ibm.com> - 2015-10-08 02:20 +0200
      Re: [PATCH v2 2/3] vTPM: reformat event log to be byte-aligned Ashley Lai <ashleydlai@gmail.com> - 2015-10-13 20:50 +0200
        Re: [PATCH v2 2/3] vTPM: reformat event log to be byte-aligned "Hon Ching(Vicky) Lo" <honclo@linux.vnet.ibm.com> - 2015-10-13 23:30 +0200
          Re: [PATCH v2 2/3] vTPM: reformat event log to be byte-aligned Ashley Lai <ashleydlai@gmail.com> - 2015-10-14 23:20 +0200
            Re: [PATCH v2 2/3] vTPM: reformat event log to be byte-aligned Ashley Lai <ashleydlai@gmail.com> - 2015-10-14 23:30 +0200

#1241878 — [PATCH] vTPM: fix memory allocation flag for rtce buffer at kernel boot

From"Hon Ching(Vicky) Lo" <honclo@linux.vnet.ibm.com>
Date2015-10-08 02:20 +0200
Subject[PATCH] vTPM: fix memory allocation flag for rtce buffer at kernel boot
Message-ID<qh769-3Sm-3@gated-at.bofh.it>
At ibm vtpm initialzation, tpm_ibmvtpm_probe() registers its interrupt
handler, ibmvtpm_interrupt, which calls ibmvtpm_crq_process to allocate
memory for rtce buffer.  The current code uses 'GFP_KERNEL' as the
type of kernel memory allocation, which resulted a warning at
kernel/lockdep.c.  This patch uses 'GFP_ATOMIC' instead so that the
allocation is high-priority and does not sleep.

Signed-off-by: Hon Ching(Vicky) Lo <honclo@linux.vnet.ibm.com>
---
 drivers/char/tpm/tpm_ibmvtpm.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/char/tpm/tpm_ibmvtpm.c b/drivers/char/tpm/tpm_ibmvtpm.c
index 27ebf95..3e6a226 100644
--- a/drivers/char/tpm/tpm_ibmvtpm.c
+++ b/drivers/char/tpm/tpm_ibmvtpm.c
@@ -491,7 +491,7 @@ static void ibmvtpm_crq_process(struct ibmvtpm_crq *crq,
 			}
 			ibmvtpm->rtce_size = be16_to_cpu(crq->len);
 			ibmvtpm->rtce_buf = kmalloc(ibmvtpm->rtce_size,
-						    GFP_KERNEL);
+						    GFP_ATOMIC);
 			if (!ibmvtpm->rtce_buf) {
 				dev_err(ibmvtpm->dev, "Failed to allocate memory for rtce buffer\n");
 				return;
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1241883 — [PATCH v2 2/3] vTPM: reformat event log to be byte-aligned

From"Hon Ching(Vicky) Lo" <honclo@linux.vnet.ibm.com>
Date2015-10-08 02:20 +0200
Subject[PATCH v2 2/3] vTPM: reformat event log to be byte-aligned
Message-ID<qh76a-3Sm-19@gated-at.bofh.it>
In reply to#1241878
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) {
+			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) {
-- 
1.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1246051 — Re: [PATCH v2 2/3] vTPM: reformat event log to be byte-aligned

FromAshley Lai <ashleydlai@gmail.com>
Date2015-10-13 20:50 +0200
SubjectRe: [PATCH v2 2/3] vTPM: reformat event log to be byte-aligned
Message-ID<qjcO6-6Ct-17@gated-at.bofh.it>
In reply to#1241883

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) {

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1246169 — Re: [PATCH v2 2/3] vTPM: reformat event log to be byte-aligned

From"Hon Ching(Vicky) Lo" <honclo@linux.vnet.ibm.com>
Date2015-10-13 23:30 +0200
SubjectRe: [PATCH v2 2/3] vTPM: reformat event log to be byte-aligned
Message-ID<qjfiY-1XD-41@gated-at.bofh.it>
In reply to#1246051
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) {
> 


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1247193 — Re: [PATCH v2 2/3] vTPM: reformat event log to be byte-aligned

FromAshley Lai <ashleydlai@gmail.com>
Date2015-10-14 23:20 +0200
SubjectRe: [PATCH v2 2/3] vTPM: reformat event log to be byte-aligned
Message-ID<qjBCO-2bI-19@gated-at.bofh.it>
In reply to#1246169

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.

>
>>
>>>
>

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [next] | [standalone]


#1247197 — Re: [PATCH v2 2/3] vTPM: reformat event log to be byte-aligned

FromAshley Lai <ashleydlai@gmail.com>
Date2015-10-14 23:30 +0200
SubjectRe: [PATCH v2 2/3] vTPM: reformat event log to be byte-aligned
Message-ID<qjBMu-2mZ-15@gated-at.bofh.it>
In reply to#1247193

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.


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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web