From nobody Fri Dec 27 01:38:15 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1504108430504273.21739167994554; Wed, 30 Aug 2017 08:53:50 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 6B35C2095BB60; Wed, 30 Aug 2017 08:53:33 -0700 (PDT) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 2C6BE21E70D2B for ; Wed, 30 Aug 2017 08:53:29 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8DEFF81DFA; Wed, 30 Aug 2017 15:53:32 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-120-136.rdu2.redhat.com [10.10.120.136]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9D8D98D564; Wed, 30 Aug 2017 15:53:31 +0000 (UTC) X-Original-To: edk2-devel@lists.01.org DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 8DEFF81DFA Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=lersek@redhat.com From: Laszlo Ersek To: edk2-devel-01 Date: Wed, 30 Aug 2017 17:53:14 +0200 Message-Id: <20170830155317.30917-9-lersek@redhat.com> In-Reply-To: <20170830155317.30917-1-lersek@redhat.com> References: <20170830155317.30917-1-lersek@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Wed, 30 Aug 2017 15:53:32 +0000 (UTC) Subject: [edk2] [PATCH 08/11] OvmfPkg/IoMmuDxe: IoMmuMap(): log nicer and more informative DEBUG msgs X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jordan Justen MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Log all relevant IN and IN OUT parameters on entry. When exiting with success, log all relevant OUT and IN OUT parameters. Don't log OUT and IN OUT parameters that are never set or changed after entering the function (i.e., *NumberOfBytes). Cc: Brijesh Singh Cc: Jordan Justen Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Laszlo Ersek --- OvmfPkg/IoMmuDxe/AmdSevIoMmu.c | 31 ++++++++++++++++++-- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/OvmfPkg/IoMmuDxe/AmdSevIoMmu.c b/OvmfPkg/IoMmuDxe/AmdSevIoMmu.c index ec625166f459..59cee95c0e21 100644 --- a/OvmfPkg/IoMmuDxe/AmdSevIoMmu.c +++ b/OvmfPkg/IoMmuDxe/AmdSevIoMmu.c @@ -44,6 +44,19 @@ STATIC LIST_ENTRY mRecycledMapInfos =3D INITIALIZE_LIST_= HEAD_VARIABLE ( =20 #define COMMON_BUFFER_SIG SIGNATURE_64 ('C', 'M', 'N', 'B', 'U', 'F', 'F',= 'R') =20 +// +// ASCII names for EDKII_IOMMU_OPERATION constants, for debug logging. +// +STATIC CONST CHAR8 * CONST +mBusMasterOperationName[EdkiiIoMmuOperationMaximum] =3D { + "Read", + "Write", + "CommonBuffer", + "Read64", + "Write64", + "CommonBuffer64" +}; + // // The following structure enables Map() and Unmap() to perform in-place // decryption and encryption, respectively, for BusMasterCommonBuffer[64] @@ -116,6 +129,18 @@ IoMmuMap ( COMMON_BUFFER_HEADER *CommonBufferHeader; VOID *DecryptionSource; =20 + DEBUG (( + DEBUG_VERBOSE, + "%a: Operation=3D%a Host=3D0x%p Bytes=3D0x%Lx\n", + __FUNCTION__, + ((Operation >=3D 0 && + Operation < ARRAY_SIZE (mBusMasterOperationName)) ? + mBusMasterOperationName[Operation] : + "Invalid"), + HostAddress, + (UINT64)((NumberOfBytes =3D=3D NULL) ? 0 : *NumberOfBytes) + )); + if (HostAddress =3D=3D NULL || NumberOfBytes =3D=3D NULL || DeviceAddres= s =3D=3D NULL || Mapping =3D=3D NULL) { return EFI_INVALID_PARAMETER; @@ -281,12 +306,12 @@ IoMmuMap ( =20 DEBUG (( DEBUG_VERBOSE, - "%a PlainText 0x%Lx Crypted 0x%Lx Pages 0x%Lx Bytes 0x%Lx\n", + "%a: Mapping=3D0x%p Device(PlainText)=3D0x%Lx Crypted=3D0x%Lx Pages=3D= 0x%Lx\n", __FUNCTION__, + MapInfo, MapInfo->PlainTextAddress, MapInfo->CryptedAddress, - (UINT64)MapInfo->NumberOfPages, - (UINT64)MapInfo->NumberOfBytes + (UINT64)MapInfo->NumberOfPages )); =20 return EFI_SUCCESS; --=20 2.14.1.3.gb7cf6e02401b _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel