:p
atchew
Login
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 XXXXXXX..XXXXXXX 100644 --- a/MdePkg/Library/BaseIoLibIntrinsic/IoLibInternalTdx.c +++ b/MdePkg/Library/BaseIoLibIntrinsic/IoLibInternalTdx.c @@ -XXX,XX +XXX,XX @@ 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; @@ -XXX,XX +XXX,XX @@ 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; @@ -XXX,XX +XXX,XX @@ 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/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=-=-=-=-=-=-=-=-=-=-=-
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 XXXXXXX..XXXXXXX 100644 --- a/MdePkg/Library/BaseIoLibIntrinsic/IoLibInternalTdx.c +++ b/MdePkg/Library/BaseIoLibIntrinsic/IoLibInternalTdx.c @@ -XXX,XX +XXX,XX @@ 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; @@ -XXX,XX +XXX,XX @@ 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; @@ -XXX,XX +XXX,XX @@ 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/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=-=-=-=-=-=-=-=-=-=-=-