From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 4F33921AEB0DC for ; Wed, 2 Aug 2017 14:23:04 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B184C85363; Wed, 2 Aug 2017 21:25:14 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com B184C85363 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 Received: from lacos-laptop-7.usersys.redhat.com (ovpn-116-47.phx2.redhat.com [10.3.116.47]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6330917B57; Wed, 2 Aug 2017 21:25:13 +0000 (UTC) From: Laszlo Ersek To: edk2-devel-01 Cc: Ard Biesheuvel , Brijesh Singh , Jordan Justen , Tom Lendacky Date: Wed, 2 Aug 2017 23:24:47 +0200 Message-Id: <20170802212453.19221-7-lersek@redhat.com> In-Reply-To: <20170802212453.19221-1-lersek@redhat.com> References: <20170802212453.19221-1-lersek@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Wed, 02 Aug 2017 21:25:14 +0000 (UTC) Subject: [PATCH 06/12] OvmfPkg/IoMmuDxe: propagate errors from AmdSevInstallIoMmuProtocol() 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: , X-List-Received-Date: Wed, 02 Aug 2017 21:23:04 -0000 If we cannot install the IOMMU protocol for whatever reason, exit the driver with an error. The same is already done for the IOMMU Absent protocol. Cc: Ard Biesheuvel Cc: Brijesh Singh Cc: Jordan Justen Cc: Tom Lendacky Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Laszlo Ersek --- OvmfPkg/IoMmuDxe/AmdSevIoMmu.h | 2 +- OvmfPkg/IoMmuDxe/AmdSevIoMmu.c | 4 ++-- OvmfPkg/IoMmuDxe/IoMmuDxe.c | 4 +--- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/OvmfPkg/IoMmuDxe/AmdSevIoMmu.h b/OvmfPkg/IoMmuDxe/AmdSevIoMmu.h index 88dabfc2c435..0f2155350817 100644 --- a/OvmfPkg/IoMmuDxe/AmdSevIoMmu.h +++ b/OvmfPkg/IoMmuDxe/AmdSevIoMmu.h @@ -34,7 +34,7 @@ MemEncryptSevLib. **/ -VOID +EFI_STATUS EFIAPI AmdSevInstallIoMmuProtocol ( VOID diff --git a/OvmfPkg/IoMmuDxe/AmdSevIoMmu.c b/OvmfPkg/IoMmuDxe/AmdSevIoMmu.c index 954062442782..8c2c23356a40 100644 --- a/OvmfPkg/IoMmuDxe/AmdSevIoMmu.c +++ b/OvmfPkg/IoMmuDxe/AmdSevIoMmu.c @@ -499,20 +499,20 @@ EDKII_IOMMU_PROTOCOL mAmdSev = { Initialize Iommu Protocol. **/ -VOID +EFI_STATUS EFIAPI AmdSevInstallIoMmuProtocol ( VOID ) { EFI_STATUS Status; EFI_HANDLE Handle; Handle = NULL; Status = gBS->InstallMultipleProtocolInterfaces ( &Handle, &gEdkiiIoMmuProtocolGuid, &mAmdSev, NULL ); - ASSERT_EFI_ERROR (Status); + return Status; } diff --git a/OvmfPkg/IoMmuDxe/IoMmuDxe.c b/OvmfPkg/IoMmuDxe/IoMmuDxe.c index 27b1856e0a17..0ea42cbc13ce 100644 --- a/OvmfPkg/IoMmuDxe/IoMmuDxe.c +++ b/OvmfPkg/IoMmuDxe/IoMmuDxe.c @@ -31,27 +31,25 @@ EFIAPI IoMmuDxeEntryPoint ( IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable ) { EFI_STATUS Status; EFI_HANDLE Handle; - Status = EFI_SUCCESS; - // // When SEV is enabled, install IoMmu protocol otherwise install the // placeholder protocol so that other dependent module can run. // if (MemEncryptSevIsEnabled ()) { - AmdSevInstallIoMmuProtocol (); + Status = AmdSevInstallIoMmuProtocol (); } else { Handle = NULL; Status = gBS->InstallMultipleProtocolInterfaces ( &Handle, &gIoMmuAbsentProtocolGuid, NULL, NULL); } return Status; } -- 2.13.1.3.g8be5a757fa67