From nobody Tue Feb 10 09:57:46 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+58087+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+58087+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=oracle.com ARC-Seal: i=1; a=rsa-sha256; t=1587751072; cv=none; d=zohomail.com; s=zohoarc; b=LN+r3mm7V56Yfpb6/jpHWpkZdAP7e9EAgY8AsafKPn8p5EjSMCJscGlAgoHg6474dOov/xBNt2VsIOWmpGUIc2VWPGYIlFKpp7P1foT3Jn/q3Ab7rjCi2suACqBVCuOI45lK1/wbn7c6jcIaaDpGiwrQ9XQ69/3R4JQkBEmDA0c= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1587751072; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=wZkjBLm/M9StSiYreG1LWyrOCTC8ia8GdNLXDvhFmsc=; b=oKO2lbyHCIU7xerAKsZpslQoUd5owBglTy8UcoeABLiFIPFwDeB+uKBscBLSszMIBS1EdtWR7fdq5N7jWu8YrTxBRZz4u+TnS9KfP7IZJI/m1tHB2qs7YvWWYtzRI6WXCiGizhnPceOCYY3rj8jJ79xauilNoD0mToH8DshusEs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+58087+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1587751072808147.89572925459026; Fri, 24 Apr 2020 10:57:52 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id bzL3YY1788612xQHyIiiy062; Fri, 24 Apr 2020 10:57:52 -0700 X-Received: from aserp2120.oracle.com (aserp2120.oracle.com [141.146.126.78]) by mx.groups.io with SMTP id smtpd.web10.2017.1587751002929489329 for ; Fri, 24 Apr 2020 10:56:43 -0700 X-Received: from pps.filterd (aserp2120.oracle.com [127.0.0.1]) by aserp2120.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 03OHqYgn185165; Fri, 24 Apr 2020 17:56:39 GMT X-Received: from aserp3030.oracle.com (aserp3030.oracle.com [141.146.126.71]) by aserp2120.oracle.com with ESMTP id 30jvq52fbs-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 24 Apr 2020 17:56:39 +0000 X-Received: from pps.filterd (aserp3030.oracle.com [127.0.0.1]) by aserp3030.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 03OHlkZX050759; Fri, 24 Apr 2020 17:56:39 GMT X-Received: from aserv0122.oracle.com (aserv0122.oracle.com [141.146.126.236]) by aserp3030.oracle.com with ESMTP id 30gb3xsqgy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 24 Apr 2020 17:56:39 +0000 X-Received: from abhmp0006.oracle.com (abhmp0006.oracle.com [141.146.116.12]) by aserv0122.oracle.com (8.14.4/8.14.4) with ESMTP id 03OHuc5R008741; Fri, 24 Apr 2020 17:56:38 GMT X-Received: from spark.ravello.local (/213.57.127.2) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 24 Apr 2020 10:56:38 -0700 From: "Nikita Leshenko" To: devel@edk2.groups.io Cc: Nikita Leshenko , liran.alon@oracle.com, aaron.young@oracle.com, Jordan Justen , Laszlo Ersek , Ard Biesheuvel Subject: [edk2-devel] [PATCH v5 12/12] OvmfPkg/MptScsiDxe: Reset device on ExitBootServices() Date: Fri, 24 Apr 2020 20:59:27 +0300 Message-Id: <20200424175927.41210-13-nikita.leshchenko@oracle.com> In-Reply-To: <20200424175927.41210-1-nikita.leshchenko@oracle.com> References: <20200424175927.41210-1-nikita.leshchenko@oracle.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: 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,nikita.leshchenko@oracle.com X-Gm-Message-State: vBP4TIodoosllBVhtX4iUud8x1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1587751072; bh=j+bsQ+d9ceapaVxmoq9CGbZCsNvKfaOcNtMHFyJDrYw=; h=Cc:Date:From:Reply-To:Subject:To; b=jlNCZsP2hcPmfQt1jXo0/Qne9BCMgMbeaitHQ6Od2RUub5GcoTJSrFO+rbrcx2UeOrl a1yqhBqSpAFxEjnPKeIH42pq1srCSwsQM7e4j+MyY2WRXn99EqLmopFS5Vgb0qSqznuis Ys4Y8fiIqOjx+zHUxb4eGteylCQOWCMPn5s= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" This causes the device to forget about the reply frame. We allocated the reply frame in EfiBootServicesData type memory, and code executing after ExitBootServices() is permitted to overwrite it. Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3D2390 Signed-off-by: Nikita Leshenko Reviewed-by: Laszlo Ersek --- OvmfPkg/MptScsiDxe/MptScsi.c | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/OvmfPkg/MptScsiDxe/MptScsi.c b/OvmfPkg/MptScsiDxe/MptScsi.c index 9cb5088bfbf9..d8649cf45541 100644 --- a/OvmfPkg/MptScsiDxe/MptScsi.c +++ b/OvmfPkg/MptScsiDxe/MptScsi.c @@ -57,6 +57,7 @@ typedef struct { UINT32 StallPerPollUsec; EFI_PCI_IO_PROTOCOL *PciIo; UINT64 OriginalPciAttributes; + EFI_EVENT ExitBoot; MPT_SCSI_DMA_BUFFER *Dma; EFI_PHYSICAL_ADDRESS DmaPhysical; VOID *DmaMapping; @@ -750,6 +751,20 @@ MptScsiResetChannel ( return EFI_UNSUPPORTED; } =20 +STATIC +VOID +EFIAPI +MptScsiExitBoot ( + IN EFI_EVENT Event, + IN VOID *Context + ) +{ + MPT_SCSI_DEV *Dev; + + Dev =3D Context; + DEBUG ((DEBUG_VERBOSE, "%a: Context=3D0x%p\n", __FUNCTION__, Context)); + MptScsiReset (Dev); +} STATIC EFI_STATUS EFIAPI @@ -943,6 +958,17 @@ MptScsiControllerStart ( goto Unmap; } =20 + Status =3D gBS->CreateEvent ( + EVT_SIGNAL_EXIT_BOOT_SERVICES, + TPL_CALLBACK, + &MptScsiExitBoot, + Dev, + &Dev->ExitBoot + ); + if (EFI_ERROR (Status)) { + goto UninitDev; + } + // // Host adapter channel, doesn't exist // @@ -967,11 +993,14 @@ MptScsiControllerStart ( &Dev->PassThru ); if (EFI_ERROR (Status)) { - goto UninitDev; + goto CloseExitBoot; } =20 return EFI_SUCCESS; =20 +CloseExitBoot: + gBS->CloseEvent (Dev->ExitBoot); + UninitDev: MptScsiReset (Dev); =20 @@ -1047,6 +1076,8 @@ MptScsiControllerStop ( return Status; } =20 + gBS->CloseEvent (Dev->ExitBoot); + MptScsiReset (Dev); =20 Dev->PciIo->Unmap ( --=20 2.20.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#58087): https://edk2.groups.io/g/devel/message/58087 Mute This Topic: https://groups.io/mt/73247274/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-