Please submit the patch by creating Pull Request in Edk2 project.

> -----邮件原件-----
> 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 annie li via
> groups.io
> 发送时间: 2025年8月27日 5:28
> 收件人: devel@edk2.groups.io; christopher.j.zurc...@intel.com;
> liming....@intel.com; zhiguang....@intel.com
> 抄送: boris.ostrov...@oracle.com; joe....@oracle.com;
> maciej.szmigi...@oracle.com; alejandro.j.jime...@oracle.com;
> annie...@oracle.com
> 主题: [edk2-devel][PATCH] Revert "MdePkg/UefiScsiLib: Set FUA bit for
> synchronous SCSI Write operations"
> 
> 
> This reverts commit 8c654bb3ec0b5232dec2b2b07234c5479eb14d62.
> 
> This FUA bit is set without negotiating the property of the backend
> storage, and it causes boot failure when Windows Server 2025 guest
> boots from vhost-scsi block device with "write through" configured.
> 
> Windows boot Error code is 0xc0000185, which indicates boot file
> corruption or BCD configuration error. Windows Server 2025 boot
> manager opens several Windows boot files and writes data to them,
> OVMF handles these write as cache write. However, with the FUA bit
> set in CDB, the SCSI command fails with the following error.
> 
> Mode Sense Key: EFI_SCSI_SK_ILLEGAL_REQUEST
> Additional Sense Code: EFI_SCSI_ASC_INVALID_FIELD
> 
> Patch 8c654bb3e mentions a possible data loss due to aggressive write
> caching, it is better to fix this through caching writing instead of
> setting FUA forcefully.
> 
> Signed-off-by: Annie Li <annie...@oracle.com>
> ---
> MdePkg/Include/IndustryStandard/Scsi.h | 8 +-------
> MdePkg/Library/UefiScsiLib/UefiScsiLib.c | 14 ++++++--------
> 2 files changed, 7 insertions(+), 15 deletions(-)
> 
> diff --git a/MdePkg/Include/IndustryStandard/Scsi.h
> b/MdePkg/Include/IndustryStandard/Scsi.h
> index be8adca8fc..200f3f4b9a 100644
> --- a/MdePkg/Include/IndustryStandard/Scsi.h
> +++ b/MdePkg/Include/IndustryStandard/Scsi.h
> @@ -1,7 +1,7 @@
> /** @file
> 
> Support for SCSI-2 standard
> 
> 
> - Copyright (c) 2006 - 2020, Intel Corporation. All rights reserved.<BR>
> 
> + Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>
> 
> SPDX-License-Identifier: BSD-2-Clause-Patent
> 
> 
> **/
> 
> @@ -175,12 +175,6 @@
> #define EFI_SCSI_DATA_IN 0
> 
> #define EFI_SCSI_DATA_OUT 1
> 
> 
> -//
> 
> -// SCSI Block Command Cache Control Parameters
> 
> -//
> 
> -#define EFI_SCSI_BLOCK_FUA BIT3 ///< Force Unit Access
> 
> -#define EFI_SCSI_BLOCK_DPO BIT4 ///< Disable Page Out
> 
> -
> 
> //
> 
> // Peripheral Device Type Definitions
> 
> //
> 
> diff --git a/MdePkg/Library/UefiScsiLib/UefiScsiLib.c
> b/MdePkg/Library/UefiScsiLib/UefiScsiLib.c
> index a33cadd716..c075e9bb6d 100644
> --- a/MdePkg/Library/UefiScsiLib/UefiScsiLib.c
> +++ b/MdePkg/Library/UefiScsiLib/UefiScsiLib.c
> @@ -1,7 +1,7 @@
> /** @file
> 
> UEFI SCSI Library implementation
> 
> 
> - Copyright (c) 2006 - 2020, Intel Corporation. All rights reserved.<BR>
> 
> + Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>
> 
> SPDX-License-Identifier: BSD-2-Clause-Patent
> 
> 
> **/
> 
> @@ -1044,16 +1044,15 @@ ScsiWrite10Command (
> ZeroMem (&CommandPacket, sizeof (EFI_SCSI_IO_SCSI_REQUEST_PACKET));
> 
> ZeroMem (Cdb, EFI_SCSI_OP_LENGTH_TEN);
> 
> 
> - CommandPacket.Timeout = Timeout;
> 
> - CommandPacket.OutDataBuffer = DataBuffer;
> 
> - CommandPacket.SenseData = SenseData;
> 
> - CommandPacket.OutTransferLength = *DataLength;
> 
> - CommandPacket.Cdb = Cdb;
> 
> + CommandPacket.Timeout = Timeout;
> 
> + CommandPacket.OutDataBuffer = DataBuffer;
> 
> + CommandPacket.SenseData = SenseData;
> 
> + CommandPacket.OutTransferLength= *DataLength;
> 
> + CommandPacket.Cdb = Cdb;
> 
> //
> 
> // Fill Cdb for Write (10) Command
> 
> //
> 
> Cdb[0] = EFI_SCSI_OP_WRITE10;
> 
> - Cdb[1] = EFI_SCSI_BLOCK_FUA;
> 
> WriteUnaligned32 ((UINT32 *)&Cdb[2], SwapBytes32 (StartLba));
> 
> WriteUnaligned16 ((UINT16 *)&Cdb[7], SwapBytes16 ((UINT16)SectorSize));
> 
> 
> @@ -1252,7 +1251,6 @@ ScsiWrite16Command (
> // Fill Cdb for Write (16) Command
> 
> //
> 
> Cdb[0] = EFI_SCSI_OP_WRITE16;
> 
> - Cdb[1] = EFI_SCSI_BLOCK_FUA;
> 
> WriteUnaligned64 ((UINT64 *)&Cdb[2], SwapBytes64 (StartLba));
> 
> WriteUnaligned32 ((UINT32 *)&Cdb[10], SwapBytes32 (SectorSize));
> 
> 
> --
> 2.43.7
> 
> 
> 
> 
> 





-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#121580): https://edk2.groups.io/g/devel/message/121580
Mute This Topic: https://groups.io/mt/115002117/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-


Reply via email to