* [edk2-devel] [PATCH] MdePkg: fix the types of casting for TD MMIO read
@ 2024-01-12 2:15 Zhiquan Li
0 siblings, 0 replies; 4+ messages in thread
From: Zhiquan Li @ 2024-01-12 2:15 UTC (permalink / raw)
To: devel; +Cc: zhiquan1.li
Currently the types of casting mismatch with TD MMIO read 1, 2 and 4
bytes, that might introduce potential issues. So fix the types as
conventional MmioRead[8|16|32] does.
Signed-off-by: Zhiquan Li <zhiquan1.li@intel.com>
---
MdePkg/Library/BaseIoLibIntrinsic/IoLibInternalTdx.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/MdePkg/Library/BaseIoLibIntrinsic/IoLibInternalTdx.c b/MdePkg/Library/BaseIoLibIntrinsic/IoLibInternalTdx.c
index ec837f5eb03e..1acc3b3d9638 100644
--- a/MdePkg/Library/BaseIoLibIntrinsic/IoLibInternalTdx.c
+++ b/MdePkg/Library/BaseIoLibIntrinsic/IoLibInternalTdx.c
@@ -237,7 +237,7 @@ TdMmioRead8 (
Status = TdVmCall (TDVMCALL_MMIO, TDVMCALL_ACCESS_SIZE_1, TDVMCALL_ACCESS_READ, Address | TdSharedPageMask (), 0, &Value);
if (Status != 0) {
- Value = *(volatile UINT64 *)Address;
+ Value = *(volatile UINT8 *)Address;
}
return (UINT8)Value;
@@ -294,7 +294,7 @@ TdMmioRead16 (
Status = TdVmCall (TDVMCALL_MMIO, TDVMCALL_ACCESS_SIZE_2, TDVMCALL_ACCESS_READ, Address | TdSharedPageMask (), 0, &Value);
if (Status != 0) {
- Value = *(volatile UINT64 *)Address;
+ Value = *(volatile UINT16 *)Address;
}
return (UINT16)Value;
@@ -353,7 +353,7 @@ TdMmioRead32 (
Status = TdVmCall (TDVMCALL_MMIO, TDVMCALL_ACCESS_SIZE_4, TDVMCALL_ACCESS_READ, Address | TdSharedPageMask (), 0, &Value);
if (Status != 0) {
- Value = *(volatile UINT64 *)Address;
+ Value = *(volatile UINT32 *)Address;
}
return (UINT32)Value;
--
2.25.1
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#113763): https://edk2.groups.io/g/devel/message/113763
Mute This Topic: https://groups.io/mt/103689726/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [edk2-devel] [PATCH] MdePkg: fix the types of casting for TD MMIO read
@ 2024-01-12 6:02 Zhiquan Li
2024-01-20 2:49 ` Michael D Kinney
0 siblings, 1 reply; 4+ messages in thread
From: Zhiquan Li @ 2024-01-12 6:02 UTC (permalink / raw)
To: devel; +Cc: zhiquan1.li
Currently the types of casting mismatch with TD MMIO read 1, 2 and 4
bytes, that might introduce potential issues. So fix the types as
conventional MmioRead[8|16|32] does.
Signed-off-by: Zhiquan Li <zhiquan1.li@intel.com>
---
MdePkg/Library/BaseIoLibIntrinsic/IoLibInternalTdx.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/MdePkg/Library/BaseIoLibIntrinsic/IoLibInternalTdx.c b/MdePkg/Library/BaseIoLibIntrinsic/IoLibInternalTdx.c
index ec837f5eb03e..1acc3b3d9638 100644
--- a/MdePkg/Library/BaseIoLibIntrinsic/IoLibInternalTdx.c
+++ b/MdePkg/Library/BaseIoLibIntrinsic/IoLibInternalTdx.c
@@ -237,7 +237,7 @@ TdMmioRead8 (
Status = TdVmCall (TDVMCALL_MMIO, TDVMCALL_ACCESS_SIZE_1, TDVMCALL_ACCESS_READ, Address | TdSharedPageMask (), 0, &Value);
if (Status != 0) {
- Value = *(volatile UINT64 *)Address;
+ Value = *(volatile UINT8 *)Address;
}
return (UINT8)Value;
@@ -294,7 +294,7 @@ TdMmioRead16 (
Status = TdVmCall (TDVMCALL_MMIO, TDVMCALL_ACCESS_SIZE_2, TDVMCALL_ACCESS_READ, Address | TdSharedPageMask (), 0, &Value);
if (Status != 0) {
- Value = *(volatile UINT64 *)Address;
+ Value = *(volatile UINT16 *)Address;
}
return (UINT16)Value;
@@ -353,7 +353,7 @@ TdMmioRead32 (
Status = TdVmCall (TDVMCALL_MMIO, TDVMCALL_ACCESS_SIZE_4, TDVMCALL_ACCESS_READ, Address | TdSharedPageMask (), 0, &Value);
if (Status != 0) {
- Value = *(volatile UINT64 *)Address;
+ Value = *(volatile UINT32 *)Address;
}
return (UINT32)Value;
--
2.25.1
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#113765): https://edk2.groups.io/g/devel/message/113765
Mute This Topic: https://groups.io/mt/103689726/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [edk2-devel] [PATCH] MdePkg: fix the types of casting for TD MMIO read
2024-01-12 6:02 Zhiquan Li
@ 2024-01-20 2:49 ` Michael D Kinney
2024-01-20 4:39 ` Michael D Kinney
0 siblings, 1 reply; 4+ messages in thread
From: Michael D Kinney @ 2024-01-20 2:49 UTC (permalink / raw)
To: devel@edk2.groups.io, Li, Zhiquan1; +Cc: Kinney, Michael D
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
Please include Cc tags in commit message with the maintainers of
the patch for review. Otherwise, the maintainers may miss the
email patches.
Thanks,
Mike
> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Zhiquan
> Li
> Sent: Thursday, January 11, 2024 10:02 PM
> To: devel@edk2.groups.io
> Cc: Li, Zhiquan1 <zhiquan1.li@intel.com>
> Subject: [edk2-devel] [PATCH] MdePkg: fix the types of casting for TD
> MMIO read
>
> Currently the types of casting mismatch with TD MMIO read 1, 2 and 4
> bytes, that might introduce potential issues. So fix the types as
> conventional MmioRead[8|16|32] does.
>
> Signed-off-by: Zhiquan Li <zhiquan1.li@intel.com>
> ---
> MdePkg/Library/BaseIoLibIntrinsic/IoLibInternalTdx.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/MdePkg/Library/BaseIoLibIntrinsic/IoLibInternalTdx.c
> b/MdePkg/Library/BaseIoLibIntrinsic/IoLibInternalTdx.c
> index ec837f5eb03e..1acc3b3d9638 100644
> --- a/MdePkg/Library/BaseIoLibIntrinsic/IoLibInternalTdx.c
> +++ b/MdePkg/Library/BaseIoLibIntrinsic/IoLibInternalTdx.c
> @@ -237,7 +237,7 @@ TdMmioRead8 (
>
>
> Status = TdVmCall (TDVMCALL_MMIO, TDVMCALL_ACCESS_SIZE_1,
> TDVMCALL_ACCESS_READ, Address | TdSharedPageMask (), 0, &Value);
>
> if (Status != 0) {
>
> - Value = *(volatile UINT64 *)Address;
>
> + Value = *(volatile UINT8 *)Address;
>
> }
>
>
>
> return (UINT8)Value;
>
> @@ -294,7 +294,7 @@ TdMmioRead16 (
>
>
> Status = TdVmCall (TDVMCALL_MMIO, TDVMCALL_ACCESS_SIZE_2,
> TDVMCALL_ACCESS_READ, Address | TdSharedPageMask (), 0, &Value);
>
> if (Status != 0) {
>
> - Value = *(volatile UINT64 *)Address;
>
> + Value = *(volatile UINT16 *)Address;
>
> }
>
>
>
> return (UINT16)Value;
>
> @@ -353,7 +353,7 @@ TdMmioRead32 (
>
>
> Status = TdVmCall (TDVMCALL_MMIO, TDVMCALL_ACCESS_SIZE_4,
> TDVMCALL_ACCESS_READ, Address | TdSharedPageMask (), 0, &Value);
>
> if (Status != 0) {
>
> - Value = *(volatile UINT64 *)Address;
>
> + Value = *(volatile UINT32 *)Address;
>
> }
>
>
>
> return (UINT32)Value;
>
> --
> 2.25.1
>
>
>
> -=-=-=-=-=-=
> Groups.io Links: You receive all messages sent to this group.
> View/Reply Online (#113765):
> https://edk2.groups.io/g/devel/message/113765
> Mute This Topic: https://groups.io/mt/103689726/1643496
> Group Owner: devel+owner@edk2.groups.io
> Unsubscribe: https://edk2.groups.io/g/devel/unsub
> [michael.d.kinney@intel.com]
> -=-=-=-=-=-=
>
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#114110): https://edk2.groups.io/g/devel/message/114110
Mute This Topic: https://groups.io/mt/103689726/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/leave/12367111/7686176/1913456212/xyzzy [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [edk2-devel] [PATCH] MdePkg: fix the types of casting for TD MMIO read
2024-01-20 2:49 ` Michael D Kinney
@ 2024-01-20 4:39 ` Michael D Kinney
0 siblings, 0 replies; 4+ messages in thread
From: Michael D Kinney @ 2024-01-20 4:39 UTC (permalink / raw)
To: devel@edk2.groups.io, Li, Zhiquan1; +Cc: Kinney, Michael D
Merged: https://github.com/tianocore/edk2/pull/5278
> -----Original Message-----
> From: Kinney, Michael D <michael.d.kinney@intel.com>
> Sent: Friday, January 19, 2024 6:49 PM
> To: devel@edk2.groups.io; Li, Zhiquan1 <zhiquan1.li@intel.com>
> Cc: Kinney, Michael D <michael.d.kinney@intel.com>
> Subject: RE: [edk2-devel] [PATCH] MdePkg: fix the types of casting for
> TD MMIO read
>
> Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
>
> Please include Cc tags in commit message with the maintainers of
> the patch for review. Otherwise, the maintainers may miss the
> email patches.
>
> Thanks,
>
> Mike
>
>
>
> > -----Original Message-----
> > From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Zhiquan
> > Li
> > Sent: Thursday, January 11, 2024 10:02 PM
> > To: devel@edk2.groups.io
> > Cc: Li, Zhiquan1 <zhiquan1.li@intel.com>
> > Subject: [edk2-devel] [PATCH] MdePkg: fix the types of casting for TD
> > MMIO read
> >
> > Currently the types of casting mismatch with TD MMIO read 1, 2 and 4
> > bytes, that might introduce potential issues. So fix the types as
> > conventional MmioRead[8|16|32] does.
> >
> > Signed-off-by: Zhiquan Li <zhiquan1.li@intel.com>
> > ---
> > MdePkg/Library/BaseIoLibIntrinsic/IoLibInternalTdx.c | 6 +++---
> > 1 file changed, 3 insertions(+), 3 deletions(-)
> >
> > diff --git a/MdePkg/Library/BaseIoLibIntrinsic/IoLibInternalTdx.c
> > b/MdePkg/Library/BaseIoLibIntrinsic/IoLibInternalTdx.c
> > index ec837f5eb03e..1acc3b3d9638 100644
> > --- a/MdePkg/Library/BaseIoLibIntrinsic/IoLibInternalTdx.c
> > +++ b/MdePkg/Library/BaseIoLibIntrinsic/IoLibInternalTdx.c
> > @@ -237,7 +237,7 @@ TdMmioRead8 (
> >
> >
> > Status = TdVmCall (TDVMCALL_MMIO, TDVMCALL_ACCESS_SIZE_1,
> > TDVMCALL_ACCESS_READ, Address | TdSharedPageMask (), 0, &Value);
> >
> > if (Status != 0) {
> >
> > - Value = *(volatile UINT64 *)Address;
> >
> > + Value = *(volatile UINT8 *)Address;
> >
> > }
> >
> >
> >
> > return (UINT8)Value;
> >
> > @@ -294,7 +294,7 @@ TdMmioRead16 (
> >
> >
> > Status = TdVmCall (TDVMCALL_MMIO, TDVMCALL_ACCESS_SIZE_2,
> > TDVMCALL_ACCESS_READ, Address | TdSharedPageMask (), 0, &Value);
> >
> > if (Status != 0) {
> >
> > - Value = *(volatile UINT64 *)Address;
> >
> > + Value = *(volatile UINT16 *)Address;
> >
> > }
> >
> >
> >
> > return (UINT16)Value;
> >
> > @@ -353,7 +353,7 @@ TdMmioRead32 (
> >
> >
> > Status = TdVmCall (TDVMCALL_MMIO, TDVMCALL_ACCESS_SIZE_4,
> > TDVMCALL_ACCESS_READ, Address | TdSharedPageMask (), 0, &Value);
> >
> > if (Status != 0) {
> >
> > - Value = *(volatile UINT64 *)Address;
> >
> > + Value = *(volatile UINT32 *)Address;
> >
> > }
> >
> >
> >
> > return (UINT32)Value;
> >
> > --
> > 2.25.1
> >
> >
> >
> > -=-=-=-=-=-=
> > Groups.io Links: You receive all messages sent to this group.
> > View/Reply Online (#113765):
> > https://edk2.groups.io/g/devel/message/113765
> > Mute This Topic: https://groups.io/mt/103689726/1643496
> > Group Owner: devel+owner@edk2.groups.io
> > Unsubscribe: https://edk2.groups.io/g/devel/unsub
> > [michael.d.kinney@intel.com]
> > -=-=-=-=-=-=
> >
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#114112): https://edk2.groups.io/g/devel/message/114112
Mute This Topic: https://groups.io/mt/103689726/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/leave/12367111/7686176/1913456212/xyzzy [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-01-20 4:40 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-12 2:15 [edk2-devel] [PATCH] MdePkg: fix the types of casting for TD MMIO read Zhiquan Li
-- strict thread matches above, loose matches on Subject: below --
2024-01-12 6:02 Zhiquan Li
2024-01-20 2:49 ` Michael D Kinney
2024-01-20 4:39 ` Michael D Kinney
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox