From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by mx.groups.io with SMTP id smtpd.web12.6736.1604580066081397379 for ; Thu, 05 Nov 2020 04:41:06 -0800 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: intel.com, ip: 192.55.52.43, mailfrom: mateusz.albecki@intel.com) IronPort-SDR: C1bD+h5yxp/RB8QQvtBDaU9uwWSGVYb6eulRpMM768zlrEFKoq9Ev1pZkvdcJ7MEZZCLLi5Q3Y AraeY6dBfUyA== X-IronPort-AV: E=McAfee;i="6000,8403,9795"; a="254080579" X-IronPort-AV: E=Sophos;i="5.77,453,1596524400"; d="scan'208";a="254080579" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 05 Nov 2020 04:41:03 -0800 IronPort-SDR: /Uln/lOExEEVoSThxX0kChGPKGxXF+BSHP/DPxbGuAsCM1pn60AD3tkv4SMtZW4dcglVReBQes 3PfaXA2KsjsQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.77,453,1596524400"; d="scan'208";a="527949560" Received: from gklab-27-32.ger.corp.intel.com ([10.102.28.45]) by fmsmga006.fm.intel.com with ESMTP; 05 Nov 2020 04:41:01 -0800 From: "Albecki, Mateusz" To: devel@edk2.groups.io Cc: Mateusz Albecki , Ray Ni , Hao A Wu Subject: [PATCHv2 0/4] MdeModulePkg/AtaAtapiPassThru: Add SATA error recovery Date: Thu, 5 Nov 2020 13:40:42 +0100 Message-Id: <20201105124046.3744-1-mateusz.albecki@intel.com> X-Mailer: git-send-email 2.14.1.windows.1 To increase boot stability when booting from SATA drives SATA driver should implement the AHCI spec defined port error recovery. This will allow the driver to handle random fails on SATA link. Performed tests on 2 setups. One with AHCI controller booting OS successfully without error recovery(control setup) and other which fails 1 in 5 times(fail setup). Tests performed: 1. Booted control setup to OS successfully. 2. Checked if during normal boot none of the packets is repeated(this came up after previous code version had a bug which repeated each DMA packet 5 times). 3. Booted control setup to OS with simulated errors appearing on first packet of every DMA transaction. 4. Performed extensive tests on fail setup. Fail rate decreased from 20% failure to ~1% failure. 1% failure is observed during OS execution, not BIOS so in a way boot is 100% stable). Change pushed to github: This series: https://github.com/malbecki/edk2/commits/sata_recovery2 Simulated errors: https://github.com/malbecki/edk2/commits/sata_recovery_simulated_error Some more information: For the bug mentioned above in point 2, the discussion can be referred here: https://github.com/malbecki/edk2/commit/9ea81cadf38725e194ec01e0b0c556fd133f3ced#r43226067 For the other discussion we did before this patch, please refer to: https://github.com/malbecki/edk2/commits/sata_recovery For logging here is the example of verbose command log(taken from v1 patch): Starting commmand: ATA COMMAND BLOCK: AtaCommand: 37 AtaFeatures: 0 AtaSectorNumber: 0 AtaCylinderLow: 16 AtaCylinderHigh: 16 AtaDeviceHead: 224 AtaSectorNumberExp: 57 AtaCylinderLowExp: 0 AtaCylinderHighExp: 0 AtaFeaturesExp: 0 AtaSectorCount: 64 AtaSectorCountExp: 0 DMA command failed at retry: 0 DMA retry 1 Starting commmand: ATA COMMAND BLOCK: AtaCommand: 37 AtaFeatures: 0 AtaSectorNumber: 0 AtaCylinderLow: 16 AtaCylinderHigh: 16 AtaDeviceHead: 224 AtaSectorNumberExp: 57 AtaCylinderLowExp: 0 AtaCylinderHighExp: 0 AtaFeaturesExp: 0 AtaSectorCount: 64 AtaSectorCountExp: 0 ATA STATUS BLOCK: AtaStatus: 80 AtaError: 0 DMA retry 0 Changes in v2: - Changed logging per review suggestions - Fixed small issues with commit message Signed-off-by: Mateusz Albecki Cc: Ray Ni Cc: Hao A Wu Mateusz Albecki (4): MdeModulePkg/AtaAtapiPassThru: Check IS to check for command completion MdeModulePkg/AtaAtapiPassThru: Add SATA error recovery flow MdeModulePkg/AtaAtapiPassThru: Restart failed packets MdeModulePkg/AtaAtapiPassThru: Trace ATA packets .../Bus/Ata/AtaAtapiPassThru/AhciMode.c | 799 +++++++++++------- .../Bus/Ata/AtaAtapiPassThru/AhciMode.h | 18 +- 2 files changed, 532 insertions(+), 285 deletions(-) -- 2.28.0.windows.1 --------------------------------------------------------------------- Intel Technology Poland sp. z o.o. ul. Sowackiego 173 | 80-298 Gdask | Sd Rejonowy Gdask Pnoc | VII Wydzia Gospodarczy Krajowego Rejestru Sdowego - KRS 101882 | NIP 957-07-52-316 | Kapita zakadowy 200.000 PLN. Ta wiadomo wraz z zacznikami jest przeznaczona dla okrelonego adresata i moe zawiera informacje poufne. W razie przypadkowego otrzymania tej wiadomoci, prosimy o powiadomienie nadawcy oraz trwae jej usunicie; jakiekolwiek przegldanie lub rozpowszechnianie jest zabronione. This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). If you are not the intended recipient, please contact the sender and delete all copies; any review or distribution by others is strictly prohibited.