* [PATCH] UefiCpuPkg/MpInitLib: Properly cast from PCD to SEV-ES jump table pointer
@ 2021-05-10 14:24 Lendacky, Thomas
2021-05-11 3:04 ` 回复: [edk2-devel] " gaoliming
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Lendacky, Thomas @ 2021-05-10 14:24 UTC (permalink / raw)
To: devel; +Cc: Brijesh Singh, Eric Dong, Ray Ni, Laszlo Ersek, Rahul Kumar
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3385
A VS2012 build fails with a cast conversion warning when the SEV-ES work
area PCD is cast as a pointer to the SEV_ES_AP_JMP_FAR type.
When casting from a PCD value to a pointer, the cast should first be done
to a UINTN and then to the pointer. Update the code to perform a cast to
a UINTN before casting to a pointer to the SEV_ES_AP_JMP_FAR type.
Cc: Eric Dong <eric.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
---
UefiCpuPkg/Library/MpInitLib/MpLib.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c b/UefiCpuPkg/Library/MpInitLib/MpLib.c
index 3d945972a025..dc2a54aa31e8 100644
--- a/UefiCpuPkg/Library/MpInitLib/MpLib.c
+++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c
@@ -1265,7 +1265,7 @@ SetSevEsJumpTable (
UINT32 Offset, InsnByte;
UINT8 LoNib, HiNib;
- JmpFar = (SEV_ES_AP_JMP_FAR *) FixedPcdGet32 (PcdSevEsWorkAreaBase);
+ JmpFar = (SEV_ES_AP_JMP_FAR *) (UINTN) FixedPcdGet32 (PcdSevEsWorkAreaBase);
ASSERT (JmpFar != NULL);
//
--
2.31.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* 回复: [edk2-devel] [PATCH] UefiCpuPkg/MpInitLib: Properly cast from PCD to SEV-ES jump table pointer
2021-05-10 14:24 [PATCH] UefiCpuPkg/MpInitLib: Properly cast from PCD to SEV-ES jump table pointer Lendacky, Thomas
@ 2021-05-11 3:04 ` gaoliming
2021-05-14 19:54 ` Lendacky, Thomas
[not found] ` <167F06F8CCEA121A.12775@groups.io>
2021-05-11 17:18 ` Laszlo Ersek
2021-05-11 17:53 ` Laszlo Ersek
2 siblings, 2 replies; 6+ messages in thread
From: gaoliming @ 2021-05-11 3:04 UTC (permalink / raw)
To: devel, thomas.lendacky
Cc: 'Brijesh Singh', 'Eric Dong', 'Ray Ni',
'Laszlo Ersek', 'Rahul Kumar'
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
> -----邮件原件-----
> 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Lendacky,
> Thomas
> 发送时间: 2021年5月10日 22:25
> 收件人: devel@edk2.groups.io
> 抄送: Brijesh Singh <brijesh.singh@amd.com>; Eric Dong
> <eric.dong@intel.com>; Ray Ni <ray.ni@intel.com>; Laszlo Ersek
> <lersek@redhat.com>; Rahul Kumar <rahul1.kumar@intel.com>
> 主题: [edk2-devel] [PATCH] UefiCpuPkg/MpInitLib: Properly cast from PCD to
> SEV-ES jump table pointer
>
> BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3385
>
> A VS2012 build fails with a cast conversion warning when the SEV-ES work
> area PCD is cast as a pointer to the SEV_ES_AP_JMP_FAR type.
>
> When casting from a PCD value to a pointer, the cast should first be done
> to a UINTN and then to the pointer. Update the code to perform a cast to
> a UINTN before casting to a pointer to the SEV_ES_AP_JMP_FAR type.
>
> Cc: Eric Dong <eric.dong@intel.com>
> Cc: Ray Ni <ray.ni@intel.com>
> Cc: Laszlo Ersek <lersek@redhat.com>
> Cc: Rahul Kumar <rahul1.kumar@intel.com>
> Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
> ---
> UefiCpuPkg/Library/MpInitLib/MpLib.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c
> b/UefiCpuPkg/Library/MpInitLib/MpLib.c
> index 3d945972a025..dc2a54aa31e8 100644
> --- a/UefiCpuPkg/Library/MpInitLib/MpLib.c
> +++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c
> @@ -1265,7 +1265,7 @@ SetSevEsJumpTable (
> UINT32 Offset, InsnByte;
> UINT8 LoNib, HiNib;
>
> - JmpFar = (SEV_ES_AP_JMP_FAR *) FixedPcdGet32
> (PcdSevEsWorkAreaBase);
> + JmpFar = (SEV_ES_AP_JMP_FAR *) (UINTN) FixedPcdGet32
> (PcdSevEsWorkAreaBase);
> ASSERT (JmpFar != NULL);
>
> //
> --
> 2.31.0
>
>
>
>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [edk2-devel] [PATCH] UefiCpuPkg/MpInitLib: Properly cast from PCD to SEV-ES jump table pointer
2021-05-10 14:24 [PATCH] UefiCpuPkg/MpInitLib: Properly cast from PCD to SEV-ES jump table pointer Lendacky, Thomas
2021-05-11 3:04 ` 回复: [edk2-devel] " gaoliming
@ 2021-05-11 17:18 ` Laszlo Ersek
2021-05-11 17:53 ` Laszlo Ersek
2 siblings, 0 replies; 6+ messages in thread
From: Laszlo Ersek @ 2021-05-11 17:18 UTC (permalink / raw)
To: devel, thomas.lendacky; +Cc: Brijesh Singh, Eric Dong, Ray Ni, Rahul Kumar
On 05/10/21 16:24, Lendacky, Thomas wrote:
> BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3385
>
> A VS2012 build fails with a cast conversion warning when the SEV-ES work
> area PCD is cast as a pointer to the SEV_ES_AP_JMP_FAR type.
>
> When casting from a PCD value to a pointer, the cast should first be done
> to a UINTN and then to the pointer. Update the code to perform a cast to
> a UINTN before casting to a pointer to the SEV_ES_AP_JMP_FAR type.
>
> Cc: Eric Dong <eric.dong@intel.com>
> Cc: Ray Ni <ray.ni@intel.com>
> Cc: Laszlo Ersek <lersek@redhat.com>
> Cc: Rahul Kumar <rahul1.kumar@intel.com>
> Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
> ---
> UefiCpuPkg/Library/MpInitLib/MpLib.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c b/UefiCpuPkg/Library/MpInitLib/MpLib.c
> index 3d945972a025..dc2a54aa31e8 100644
> --- a/UefiCpuPkg/Library/MpInitLib/MpLib.c
> +++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c
> @@ -1265,7 +1265,7 @@ SetSevEsJumpTable (
> UINT32 Offset, InsnByte;
> UINT8 LoNib, HiNib;
>
> - JmpFar = (SEV_ES_AP_JMP_FAR *) FixedPcdGet32 (PcdSevEsWorkAreaBase);
> + JmpFar = (SEV_ES_AP_JMP_FAR *) (UINTN) FixedPcdGet32 (PcdSevEsWorkAreaBase);
> ASSERT (JmpFar != NULL);
>
> //
>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [edk2-devel] [PATCH] UefiCpuPkg/MpInitLib: Properly cast from PCD to SEV-ES jump table pointer
2021-05-10 14:24 [PATCH] UefiCpuPkg/MpInitLib: Properly cast from PCD to SEV-ES jump table pointer Lendacky, Thomas
2021-05-11 3:04 ` 回复: [edk2-devel] " gaoliming
2021-05-11 17:18 ` Laszlo Ersek
@ 2021-05-11 17:53 ` Laszlo Ersek
2 siblings, 0 replies; 6+ messages in thread
From: Laszlo Ersek @ 2021-05-11 17:53 UTC (permalink / raw)
To: devel, thomas.lendacky; +Cc: Brijesh Singh, Eric Dong, Ray Ni, Rahul Kumar
On 05/10/21 16:24, Lendacky, Thomas wrote:
> BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3385
>
> A VS2012 build fails with a cast conversion warning when the SEV-ES work
> area PCD is cast as a pointer to the SEV_ES_AP_JMP_FAR type.
>
> When casting from a PCD value to a pointer, the cast should first be done
> to a UINTN and then to the pointer. Update the code to perform a cast to
> a UINTN before casting to a pointer to the SEV_ES_AP_JMP_FAR type.
>
> Cc: Eric Dong <eric.dong@intel.com>
> Cc: Ray Ni <ray.ni@intel.com>
> Cc: Laszlo Ersek <lersek@redhat.com>
> Cc: Rahul Kumar <rahul1.kumar@intel.com>
> Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
> ---
> UefiCpuPkg/Library/MpInitLib/MpLib.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c b/UefiCpuPkg/Library/MpInitLib/MpLib.c
> index 3d945972a025..dc2a54aa31e8 100644
> --- a/UefiCpuPkg/Library/MpInitLib/MpLib.c
> +++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c
> @@ -1265,7 +1265,7 @@ SetSevEsJumpTable (
> UINT32 Offset, InsnByte;
> UINT8 LoNib, HiNib;
>
> - JmpFar = (SEV_ES_AP_JMP_FAR *) FixedPcdGet32 (PcdSevEsWorkAreaBase);
> + JmpFar = (SEV_ES_AP_JMP_FAR *) (UINTN) FixedPcdGet32 (PcdSevEsWorkAreaBase);
> ASSERT (JmpFar != NULL);
>
> //
>
Merged as commit 6933c78e4dc2, via
<https://github.com/tianocore/edk2/pull/1634>.
Thanks
Laszlo
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: 回复: [edk2-devel] [PATCH] UefiCpuPkg/MpInitLib: Properly cast from PCD to SEV-ES jump table pointer
2021-05-11 3:04 ` 回复: [edk2-devel] " gaoliming
@ 2021-05-14 19:54 ` Lendacky, Thomas
[not found] ` <167F06F8CCEA121A.12775@groups.io>
1 sibling, 0 replies; 6+ messages in thread
From: Lendacky, Thomas @ 2021-05-14 19:54 UTC (permalink / raw)
To: devel, gaoliming
Cc: 'Brijesh Singh', 'Eric Dong', 'Ray Ni',
'Laszlo Ersek', 'Rahul Kumar'
On 5/10/21 10:04 PM, gaoliming via groups.io wrote:
> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Thanks, Liming.
Sorry, for the delay, your email ended up in my Spam folder... urg, IT at
its best. Anyway...
The patch is changing enough that I don't think I should add your
Reviewed-by: just yet. Look for a new version soon.
Thanks,
Tom
>
>> -----邮件原件-----
>> 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Lendacky,
>> Thomas
>> 发送时间: 2021年5月10日 22:25
>> 收件人: devel@edk2.groups.io
>> 抄送: Brijesh Singh <brijesh.singh@amd.com>; Eric Dong
>> <eric.dong@intel.com>; Ray Ni <ray.ni@intel.com>; Laszlo Ersek
>> <lersek@redhat.com>; Rahul Kumar <rahul1.kumar@intel.com>
>> 主题: [edk2-devel] [PATCH] UefiCpuPkg/MpInitLib: Properly cast from PCD to
>> SEV-ES jump table pointer
>>
>> BZ: https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbugzilla.tianocore.org%2Fshow_bug.cgi%3Fid%3D3385&data=04%7C01%7Cthomas.lendacky%40amd.com%7Ce447839eff4f4dfcf2f408d9142974b8%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637566181281381668%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=Hy8B0K8gLfdQyPFtkIQlYGQ82r2f5x%2BRf0PkWilprjc%3D&reserved=0
>>
>> A VS2012 build fails with a cast conversion warning when the SEV-ES work
>> area PCD is cast as a pointer to the SEV_ES_AP_JMP_FAR type.
>>
>> When casting from a PCD value to a pointer, the cast should first be done
>> to a UINTN and then to the pointer. Update the code to perform a cast to
>> a UINTN before casting to a pointer to the SEV_ES_AP_JMP_FAR type.
>>
>> Cc: Eric Dong <eric.dong@intel.com>
>> Cc: Ray Ni <ray.ni@intel.com>
>> Cc: Laszlo Ersek <lersek@redhat.com>
>> Cc: Rahul Kumar <rahul1.kumar@intel.com>
>> Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
>> ---
>> UefiCpuPkg/Library/MpInitLib/MpLib.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c
>> b/UefiCpuPkg/Library/MpInitLib/MpLib.c
>> index 3d945972a025..dc2a54aa31e8 100644
>> --- a/UefiCpuPkg/Library/MpInitLib/MpLib.c
>> +++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c
>> @@ -1265,7 +1265,7 @@ SetSevEsJumpTable (
>> UINT32 Offset, InsnByte;
>> UINT8 LoNib, HiNib;
>>
>> - JmpFar = (SEV_ES_AP_JMP_FAR *) FixedPcdGet32
>> (PcdSevEsWorkAreaBase);
>> + JmpFar = (SEV_ES_AP_JMP_FAR *) (UINTN) FixedPcdGet32
>> (PcdSevEsWorkAreaBase);
>> ASSERT (JmpFar != NULL);
>>
>> //
>> --
>> 2.31.0
>>
>>
>>
>>
>>
>
>
>
>
>
>
>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: 回复: [edk2-devel] [PATCH] UefiCpuPkg/MpInitLib: Properly cast from PCD to SEV-ES jump table pointer
[not found] ` <167F06F8CCEA121A.12775@groups.io>
@ 2021-05-14 20:32 ` Lendacky, Thomas
0 siblings, 0 replies; 6+ messages in thread
From: Lendacky, Thomas @ 2021-05-14 20:32 UTC (permalink / raw)
To: devel, gaoliming
Cc: 'Brijesh Singh', 'Eric Dong', 'Ray Ni',
'Laszlo Ersek', 'Rahul Kumar'
On 5/14/21 2:54 PM, Lendacky, Thomas via groups.io wrote:
> On 5/10/21 10:04 PM, gaoliming via groups.io wrote:
>> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
>
> Thanks, Liming.
>
> Sorry, for the delay, your email ended up in my Spam folder... urg, IT at
> its best. Anyway...
>
> The patch is changing enough that I don't think I should add your
> Reviewed-by: just yet. Look for a new version soon.
Ugh, I thought this was for AP reset stack... wrong patch. Disregard.
Thanks,
Tom
>
> Thanks,
> Tom
>
>>
>>> -----邮件原件-----
>>> 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Lendacky,
>>> Thomas
>>> 发送时间: 2021年5月10日 22:25
>>> 收件人: devel@edk2.groups.io
>>> 抄送: Brijesh Singh <brijesh.singh@amd.com>; Eric Dong
>>> <eric.dong@intel.com>; Ray Ni <ray.ni@intel.com>; Laszlo Ersek
>>> <lersek@redhat.com>; Rahul Kumar <rahul1.kumar@intel.com>
>>> 主题: [edk2-devel] [PATCH] UefiCpuPkg/MpInitLib: Properly cast from PCD to
>>> SEV-ES jump table pointer
>>>
>>> BZ: https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fbugzilla.tianocore.org%2Fshow_bug.cgi%3Fid%3D3385&data=04%7C01%7Cthomas.lendacky%40amd.com%7C0587fecbb35842c6d81408d9171212b5%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637566188656978758%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=sdSuHzrY%2BTfhad8aLKLSHvnPnL91CqHxclfH5E07aAc%3D&reserved=0
>>>
>>> A VS2012 build fails with a cast conversion warning when the SEV-ES work
>>> area PCD is cast as a pointer to the SEV_ES_AP_JMP_FAR type.
>>>
>>> When casting from a PCD value to a pointer, the cast should first be done
>>> to a UINTN and then to the pointer. Update the code to perform a cast to
>>> a UINTN before casting to a pointer to the SEV_ES_AP_JMP_FAR type.
>>>
>>> Cc: Eric Dong <eric.dong@intel.com>
>>> Cc: Ray Ni <ray.ni@intel.com>
>>> Cc: Laszlo Ersek <lersek@redhat.com>
>>> Cc: Rahul Kumar <rahul1.kumar@intel.com>
>>> Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
>>> ---
>>> UefiCpuPkg/Library/MpInitLib/MpLib.c | 2 +-
>>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c
>>> b/UefiCpuPkg/Library/MpInitLib/MpLib.c
>>> index 3d945972a025..dc2a54aa31e8 100644
>>> --- a/UefiCpuPkg/Library/MpInitLib/MpLib.c
>>> +++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c
>>> @@ -1265,7 +1265,7 @@ SetSevEsJumpTable (
>>> UINT32 Offset, InsnByte;
>>> UINT8 LoNib, HiNib;
>>>
>>> - JmpFar = (SEV_ES_AP_JMP_FAR *) FixedPcdGet32
>>> (PcdSevEsWorkAreaBase);
>>> + JmpFar = (SEV_ES_AP_JMP_FAR *) (UINTN) FixedPcdGet32
>>> (PcdSevEsWorkAreaBase);
>>> ASSERT (JmpFar != NULL);
>>>
>>> //
>>> --
>>> 2.31.0
>>>
>>>
>>>
>>>
>>>
>>
>>
>>
>>
>>
>>
>>
>>
>
>
>
>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2021-05-14 20:32 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-05-10 14:24 [PATCH] UefiCpuPkg/MpInitLib: Properly cast from PCD to SEV-ES jump table pointer Lendacky, Thomas
2021-05-11 3:04 ` 回复: [edk2-devel] " gaoliming
2021-05-14 19:54 ` Lendacky, Thomas
[not found] ` <167F06F8CCEA121A.12775@groups.io>
2021-05-14 20:32 ` Lendacky, Thomas
2021-05-11 17:18 ` Laszlo Ersek
2021-05-11 17:53 ` Laszlo Ersek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox