From nobody Fri Dec 27 01:57:12 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=fail; 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 1504191698112227.44331013999988; Thu, 31 Aug 2017 08:01:38 -0700 (PDT) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id B4C922095BB94; Thu, 31 Aug 2017 07:58:51 -0700 (PDT) Received: from NAM02-CY1-obe.outbound.protection.outlook.com (mail-cys01nam02on0069.outbound.protection.outlook.com [104.47.37.69]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id CA0F42095BB8A for ; Thu, 31 Aug 2017 07:58:48 -0700 (PDT) Received: from brijesh-build-machine.amd.com (165.204.77.1) by SN1PR12MB0158.namprd12.prod.outlook.com (10.162.3.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.1.1385.9; Thu, 31 Aug 2017 15:01:28 +0000 X-Original-To: edk2-devel@lists.01.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=dL22XaQWiPEyUhgQFndyDcxZhhiRESs2ro9h2wiFfe4=; b=uv6+ja4KRRW2vmZsfaNEg7IZgTz4nokam8eD0QYjj2vw7NsmPcB60rlw+xU6y3Cl8gnIfSf+oydeMxxkAOJ/CVFwAUHRizUiLxylMi45xa5y2QHA00hryvkdfWfshjBcU8Wec7QSrrmJ46xjnCV6SpCGoIVvPbjLa7GooumY3r8= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=brijesh.singh@amd.com; From: Brijesh Singh To: edk2-devel@lists.01.org Date: Thu, 31 Aug 2017 11:01:12 -0400 Message-Id: <1504191674-3949-3-git-send-email-brijesh.singh@amd.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1504191674-3949-1-git-send-email-brijesh.singh@amd.com> References: <1504191674-3949-1-git-send-email-brijesh.singh@amd.com> MIME-Version: 1.0 X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: MWHPR08CA0056.namprd08.prod.outlook.com (10.173.236.30) To SN1PR12MB0158.namprd12.prod.outlook.com (10.162.3.145) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: afdf0e72-27b4-49c7-e305-08d4f0812924 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(300000500095)(300135000095)(300000501095)(300135300095)(22001)(300000502095)(300135100095)(2017030254152)(300000503095)(300135400095)(48565401081)(2017052603199)(201703131423075)(201703031133081)(201702281549075)(300000504095)(300135200095)(300000505095)(300135600095)(300000506095)(300135500095); SRVR:SN1PR12MB0158; X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0158; 3:8/JG/ROgUqW3Es+pkZpwYOLzC0+tKgbe+ff7dNdES6UPi6pIKRfCv6Nv2QBCkvxLlYMoTfk0qxbZ5XVtVts4Co5TWufgQvECGTHqPTmcPJQhtqbN9SkvdfiCvwOBqQ7t1VY++cvXcpCIuWnREP8bzH/TJjXMBDmmTRcYWKWNbwlMw67uyG3RflxAgWWrVrAseZE2q0DZYVno2odJUtZ+AWqWAf3yl8LwCnK5rz+EpAiOrkadVsFBtWrYILdvouhb; 25:bPUmHlT/0kTn7g31Ufa+aczfqLr2L6W2ZkeXPAXQztLVYGt9Hjk3mnKO58PftNIfON671yNR0aAl9OrxUj5OZ4CflUmqE3d4fi8mOxCpcP8tg8HkwPxFJgG1T6decDW8Kj9Z/7I/gLFxDf7YDvGxdnUgX1HHgn5mKswHFXeAihAGyRoOBqsl2gdnVLEBmpF5pZNx4jfUk69mbh5s2bkZGskEy+jZAbTaU9V9jV3u7PvZrngftLti5H4uASxYYjdyK04H66nl7njgvQSB26AoKvqsmtPmzsapwYuRoLV9nxGeOJPKL7iOm45I++qoftRUkeVRAHq7K9MkafcaRD6YgA==; 31:B81b6s5gzP19Lt9/u+fkFPd7rf1rsT2eFDCy11iT15UF/MH/gqEWFau6JyFmzADi/7ZYycqXPGhuLyfSPymOL2/fnLnkX6+sjrSY0IcKilqRc0VDtjkZaHIO29R8T++l9Iby4W5k4Vib0Mb2jrNls8TADWYqCVutlr15lO/DQgCiBwC/yeZ/A2VL2ab0TsrTp3nfP4/v1deM6LCy0QjSgUiBoEiYSMO/zyUo6qXet78= X-MS-TrafficTypeDiagnostic: SN1PR12MB0158: X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0158; 20:L5phPXtMee1rEWA6l0XncaxJkOCGOvXIlS0kPIfIHXj7FnxoVfYKpKVVYAt3t6bqyyOAAgBUssk5VsDJsjdt576/sKRcyX+QsZubVVpWPi9JUzluqRKGjJ/SUfOtmHyr2hvv1Qfce0UH2X4dN+BtYcUjcjidKWe5WDONFPwRA7f21vECH+PUN+TUYhxW/jqlacEblQnKt21JEJadqUAr5HYNOi6utrINYIX1C/ztPBNeL+wjqay8iwfNpeDXLItFby3PwEGbSvN0Yz8G482/No2x5i5uCedHsQF5p516mwaa/sk18kavSKDTa6tz2vUBCP7Y76UmiUY4DJxcJcSBQGV23t8B9PgTCF2mkZ3u3pSYNp7pAKfIDiSSKVo2SGW+n3D5VgS22CdZ06JEyarent7UDtcCIuz0Hk/r73SgFHEwvRWs9Oq+GxNM8ebdyZ5Gxs06LS4weFooaoz4J3F6JT9+8XSRdelWDNfm/bUUZqMlotuEydKkBw13xkBkbo8Y; 4:J3HX26Rz5pM4Axs46pKgXGg53cBsgTqhts2GpWupgGcBUncFG04brm28iVXJRpyuWdGotfqlbuji5JdoTClT1x6vi9iacE4et2tPDlN5O4nH90niKTW00il/eKLGa9l3RK4GSZ0d5lmz9rdmErQyDtpbmsx5chw8MEqdqFmdv4/IZCZ52kTqowV0ccVKTMkkE/X9UFCQrPQqXZGTpjFzE7Eszi4J8Jl1w1pJd55tqp3dJ32aECyHZP6b7TNkZTHbA8qWOULLg0wMFbkP1eIreOmnHhgL5nAUd25gHbt0Tad19RfFGBcQrzEfWPAGiTH0LXKaBS96K3ucIg0yv+55lw== X-Exchange-Antispam-Report-Test: UriScan:(767451399110)(228905959029699); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(5005006)(8121501046)(100000703101)(100105400095)(10201501046)(3002001)(93006095)(93001095)(6055026)(6041248)(20161123560025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123558100)(20161123555025)(20161123564025)(20161123562025)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:SN1PR12MB0158; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:SN1PR12MB0158; X-Forefront-PRVS: 04163EF38A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(39860400002)(199003)(189002)(81156014)(8676002)(478600001)(81166006)(5003940100001)(50226002)(76176999)(8936002)(4326008)(50986999)(2361001)(110136004)(2906002)(2351001)(189998001)(66066001)(106356001)(105586002)(7736002)(42186005)(53416004)(54906002)(47776003)(25786009)(97736004)(53936002)(33646002)(101416001)(305945005)(6486002)(6916009)(2950100002)(48376002)(3846002)(6116002)(36756003)(6666003)(575784001)(5660300001)(86362001)(50466002)(68736007); DIR:OUT; SFP:1101; SCL:1; SRVR:SN1PR12MB0158; H:brijesh-build-machine.amd.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; 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; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SN1PR12MB0158; 23:gKEGoUtNcSlkRMwL6DARRMpicLfFogZr2H+UEK4LX?= =?us-ascii?Q?7zajMp+TU+5muNe3E4W+Tb/sBkkNz0JowOc6wITOK2LiWDcEBKDUKqes9AIq?= =?us-ascii?Q?5uEEpS1DqEeS8awzqOjqlPV4QdZLqJu9QJNwp3Jn2xXzhBphlIs0zy3vDNUQ?= =?us-ascii?Q?kl3xQ2rZrWS5CTEvNTVhamZ+nWQKOZ5Lj9vJrf0xbE3pGJIRS3HuhCdA9kYk?= =?us-ascii?Q?3ehg8eLvKCIACBo2gflRO9Y5UxVfxRUpCnkmYU+tfJ2Vr+pTAObiuJELW2tn?= =?us-ascii?Q?Tpruym+gpEsBukNrUX8s2oY7vlZgMhaOUSDrPPX5P3NqPd1/2EjPUKAOmBkA?= =?us-ascii?Q?JtB0KnTP0njtvH/VKMHgBnlG4zLSLmK3hMv1NiGaacWfntVdVzmYiH+EE6Rn?= =?us-ascii?Q?VuQZSJ6ajObdMy/OyDtrguYA3Cdq9089OkezsERZKvzgna5f+S8k/yJybjRc?= =?us-ascii?Q?klP1RvBoKC6BKLY4A7fuRlJmWFBilQ3j7LlAyf6wMl73X9pdI0PtEHMG4Yx8?= =?us-ascii?Q?zROSsgfy2rzHhCjZht5KJ8+KCtJ9W4iEVg1jOUfn+BzW1oJn8CJLzP4fcyiW?= =?us-ascii?Q?h/ytZDjVJ1AYvgUuTLyWxhxA6jFusdbD4O0znUwAORE9dxl9esgcZmPNRtss?= =?us-ascii?Q?8OU2A8kxtVtHe4Xs78l0J3PMA+Yr23SY5IcVd/22waLIvgE6YAULvHvf9yJc?= =?us-ascii?Q?Ixbgw1YTlr2olPRPWug2PK5gVlNmlQ18bcKqU9E1NCsQDWZZIIMG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gK2Yjhg4ljsrLW3XahiFFmigGn7LrjaUSIzsUuX20=; 7:+1/Ae6P64nlWEkVOs/b6hif1myprslEpIFSfaJcnRD9zOFv7tZGZzR7Fu2tHsXQBymqi/8FbLdK2slkj9yV5SssJFjJXpGGtfOgt7w9ueIdte0UWJHnTpOPAE3TDuiCk6xiwTwq8ksUzAaklYf22BgU32j9x3Nht0YmSBy3kPPfqgi2qmcLDDbZq1zfSqd8w3ttlkKjy7P3hjI9o4AJmHRWZFlBe2pJdq+wV/aLxkag= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0158; 20:xyUDA2FKIYngz19ZxgJPwwPjxwCFdYMi4HYt7szPuminoUrquDDLJqY1RzniR5Ifo6q/l5nPyieIUCLUP1Cbl3evF2ozr0Hd8lEcuwTswCxWdWACu/Y+FJBlkHCcaeVUuC0KE+v1nZ8Y7ZeL6SmViiRnIpzBTjrg3B8XDjIxeFDlnYeV94mkBQlh89tA853aBnLlOEeFAd1+d6K2VUbybbMS+zdZ1avOb98mgzPIxifg2r3VS7wEG/RdS0GxhuDh X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Aug 2017 15:01:28.8438 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR12MB0158 Subject: [edk2] [PATCH v3 2/4] OvmfPkg/VirtioScsiDxe: add helper to create a fake host adapter error 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 , Tom Lendacky , Laszlo Ersek , Ard Biesheuvel Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" When virtio request fails we return EFI_DEVICE_ERROR, as per the spec EFI_EXT_SCSI_PASS_THRU_PROTOCOL.PassThru() member function is required to implement elaborated error reporting. The patch refactors out entire block of the code that creates the host adapter error into a separate helper function (ReportHostAdapterError). Suggested-by: Laszlo Ersek Cc: Ard Biesheuvel Cc: Jordan Justen Cc: Tom Lendacky Cc: Laszlo Ersek Contributed-under: TianoCore Contribution Agreement 1.1 Reviewed-by: Laszlo Ersek Signed-off-by: Brijesh Singh --- OvmfPkg/VirtioScsiDxe/VirtioScsi.c | 36 ++++++++++++++++---- 1 file changed, 29 insertions(+), 7 deletions(-) diff --git a/OvmfPkg/VirtioScsiDxe/VirtioScsi.c b/OvmfPkg/VirtioScsiDxe/Vir= tioScsi.c index 5e72b1a24b59..5e977c636a0a 100644 --- a/OvmfPkg/VirtioScsiDxe/VirtioScsi.c +++ b/OvmfPkg/VirtioScsiDxe/VirtioScsi.c @@ -97,7 +97,7 @@ // set some fields in the EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET in/out // parameter on return. The following is a full list of those fields, for // easier validation of PopulateRequest(), ParseResponse(), and -// VirtioScsiPassThru() below. +// ReportHostAdapterError() below. // // - InTransferLength // - OutTransferLength @@ -387,6 +387,33 @@ ParseResponse ( return EFI_DEVICE_ERROR; } =20 +/** + * The function can be used to create a fake host adapter error. + * + * When VirtioScsiPassThru is failed due to some reasons then this function + * can be called to contstruct a host adapter error. + * + * @param[out] Packet The Extended SCSI Pass Thru Protocol packet = that + * the host adapter error shall be placed in. + * + * @retval EFI_DEVICE_ERROR The function returns this status code + * unconditionally, to be propagated by + * VirtioScsiPassThru(). + */ +STATIC +EFI_STATUS +ReportHostAdapterError ( + OUT EFI_EXT_SCSI_PASS_THRU_SCSI_REQUEST_PACKET *Packet + ) +{ + Packet->InTransferLength =3D 0; + Packet->OutTransferLength =3D 0; + Packet->HostAdapterStatus =3D EFI_EXT_SCSI_STATUS_HOST_ADAPTER_OTHER; + Packet->TargetStatus =3D EFI_EXT_SCSI_STATUS_TARGET_GOOD; + Packet->SenseDataLength =3D 0; + return EFI_DEVICE_ERROR; +} + =20 // // The next seven functions implement EFI_EXT_SCSI_PASS_THRU_PROTOCOL @@ -472,12 +499,7 @@ VirtioScsiPassThru ( // if (VirtioFlush (Dev->VirtIo, VIRTIO_SCSI_REQUEST_QUEUE, &Dev->Ring, &Indices, NULL) !=3D EFI_SUCCESS) { - Packet->InTransferLength =3D 0; - Packet->OutTransferLength =3D 0; - Packet->HostAdapterStatus =3D EFI_EXT_SCSI_STATUS_HOST_ADAPTER_OTHER; - Packet->TargetStatus =3D EFI_EXT_SCSI_STATUS_TARGET_GOOD; - Packet->SenseDataLength =3D 0; - return EFI_DEVICE_ERROR; + return ReportHostAdapterError (Packet); } =20 return ParseResponse (Packet, &Response); --=20 2.7.4 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel