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 5D2FFAC1523 for ; Fri, 12 Jan 2024 19:16:11 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=GYopg18CED7Fj0bPSh7Fcg3o7iwQEvArjEGMkUsIPsI=; 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=1705086970; v=1; b=ET/zbGbnwmDlShScMNPNPwwE6LQQJYv86YtFV+3DT210metZEXjI6EVOC4qParZjlsGg0wOp 8Q9Y4aXVkaUlPiWveH0hksO4p6XYR3VeUplWQAUF8iXBLx/EkslMu+cgOl61pOC4Ia9rnrzWjo6 E3yF3nPK6+68hC7R4NSakk5Q= X-Received: by 127.0.0.2 with SMTP id ASzZYY7687511xSuDZUE9ZGH; Fri, 12 Jan 2024 11:16:10 -0800 X-Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.10]) by mx.groups.io with SMTP id smtpd.web10.1463.1705038041141047884 for ; Thu, 11 Jan 2024 21:40:41 -0800 X-IronPort-AV: E=McAfee;i="6600,9927,10950"; a="12445915" X-IronPort-AV: E=Sophos;i="6.04,188,1695711600"; d="scan'208";a="12445915" X-Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orvoesa102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Jan 2024 21:40:40 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10950"; a="782919245" X-IronPort-AV: E=Sophos;i="6.04,188,1695711600"; d="scan'208";a="782919245" X-Received: from zhiquan-linux-dev.bj.intel.com ([10.238.156.102]) by orsmga002.jf.intel.com with ESMTP; 11 Jan 2024 21:40:18 -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 14:02:20 +0800 Message-Id: <20240112060220.824280-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: miprid6nD1etFPYCoZxFCvHpx7686176AA= 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="ET/zbGbn"; 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 (#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] -=-=-=-=-=-=-=-=-=-=-=-