From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id 85DAFAC10AB for ; Fri, 12 Jan 2024 19:16:09 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=MNSDSfJ32pb1uAGZwrvLmjLi91Mau/wQSd4X85TJ1TY=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding; s=20140610; t=1705086968; v=1; b=o6iXF29kCzbhkDR6Jof41Ot5cLDapcwprZ540QuzCk21a16P5apOzduBH+jTdK8f7b9XzwCQ StAfGaT3CcyG8Gebw4IIP27I47c/ULlOLyDy52XNyvjjfpvnzVFHv+/ptGQG6TMplwA5p+J+fDJ XRZcxRRmi2REhu+MEiCuSX/8= X-Received: by 127.0.0.2 with SMTP id C3HWYY7687511xIbWN1CNzlg; Fri, 12 Jan 2024 11:16:08 -0800 X-Received: from mgamail.intel.com (mgamail.intel.com [192.55.52.43]) by mx.groups.io with SMTP id smtpd.web11.9977.1705024435917917572 for ; Thu, 11 Jan 2024 17:53:56 -0800 X-IronPort-AV: E=McAfee;i="6600,9927,10950"; a="485234236" X-IronPort-AV: E=Sophos;i="6.04,188,1695711600"; d="scan'208";a="485234236" X-Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Jan 2024 17:53:50 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10950"; a="786197970" X-IronPort-AV: E=Sophos;i="6.04,188,1695711600"; d="scan'208";a="786197970" X-Received: from zhiquan-linux-dev.bj.intel.com ([10.238.156.102]) by fmsmga007.fm.intel.com with ESMTP; 11 Jan 2024 17:53:49 -0800 From: "Zhiquan Li" To: devel@edk2.groups.io Cc: zhiquan1.li@intel.com Subject: [edk2-devel] [PATCH] MdePkg: fix the types of casting for TD MMIO read Date: Fri, 12 Jan 2024 10:15:57 +0800 Message-Id: <20240112021557.813290-1-zhiquan1.li@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,zhiquan1.li@intel.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: tikEVbLrVJBBHPmjmBqBkUagx7686176AA= Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=o6iXF29k; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=intel.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io 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 --- 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 ( =0D Status =3D TdVmCall (TDVMCALL_MMIO, TDVMCALL_ACCESS_SIZE_1, TDVMCALL_ACC= ESS_READ, Address | TdSharedPageMask (), 0, &Value);=0D if (Status !=3D 0) {=0D - Value =3D *(volatile UINT64 *)Address;=0D + Value =3D *(volatile UINT8 *)Address;=0D }=0D =0D return (UINT8)Value;=0D @@ -294,7 +294,7 @@ TdMmioRead16 ( =0D Status =3D TdVmCall (TDVMCALL_MMIO, TDVMCALL_ACCESS_SIZE_2, TDVMCALL_ACC= ESS_READ, Address | TdSharedPageMask (), 0, &Value);=0D if (Status !=3D 0) {=0D - Value =3D *(volatile UINT64 *)Address;=0D + Value =3D *(volatile UINT16 *)Address;=0D }=0D =0D return (UINT16)Value;=0D @@ -353,7 +353,7 @@ TdMmioRead32 ( =0D Status =3D TdVmCall (TDVMCALL_MMIO, TDVMCALL_ACCESS_SIZE_4, TDVMCALL_ACC= ESS_READ, Address | TdSharedPageMask (), 0, &Value);=0D if (Status !=3D 0) {=0D - Value =3D *(volatile UINT64 *)Address;=0D + Value =3D *(volatile UINT32 *)Address;=0D }=0D =0D return (UINT32)Value;=0D --=20 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] -=-=-=-=-=-=-=-=-=-=-=-