]> www.infradead.org Git - users/jedix/linux-maple.git/commit
scsi: megaraid_sas: Send SYNCHRONIZE_CACHE for VD to firmware
authorKashyap Desai <kashyap.desai@broadcom.com>
Fri, 21 Oct 2016 13:33:33 +0000 (06:33 -0700)
committerChuck Anderson <chuck.anderson@oracle.com>
Tue, 28 Feb 2017 04:40:09 +0000 (20:40 -0800)
commitb902dd5d6449e5ba0d5b171d09d83c9c593868bb
treede357e6a04e37ae59fac30ab77d4370c49dc3f9a
parent7589e0d742b155bdd91999114c562084b6c47631
scsi: megaraid_sas: Send SYNCHRONIZE_CACHE for VD to firmware

Orabug: 25568930

Until now the megaraid_sas driver has reported successful completion on
SYNCHRONIZE_CACHE commands without sending them down to the controller.
The controller firmware has been responsible for taking care of flushing
disk caches for all drives that belong to a Virtual Disk at the time of
system reboot/shutdown.

There may have been a reason to avoid sending SYNCHRONIZE_CACHE to a VD
in the past but that no longer appears to be valid.

Older versions of MegaRaid firmware (Gen2 and Gen2.5) set the WCE bit
for Virtual Disks but the firmware does not report correct completion
status for a SYNCHRONIZE_CACHE command. As a result, we must use another
method to identify whether it is safe to send the command to the
controller. We use the canHandleSyncCache firmware flag in the scratch
pad register at offset 0xB4.

New SYNCHRONIZE_CACHE behavior:

IF 'JBOD'

Driver sends SYNCHRONIZE_CACHE command to the firmware
Firmware sends SYNCHRONIZE_CACHE to drive
Firmware obtains status from drive and returns same status back to driver

ELSEIF 'VirtualDisk'

IF firmware supports new API bit called canHandleSyncCache
Driver sends SYNCHRONIZE_CACHE command to the firmware
Firmware does not send SYNCHRONIZE_CACHE to drives
Firmware returns SUCCESS
ELSE
Driver does not send SYNCHRONIZE_CACHE command to the firmware
Driver return SUCCESS for that command
ENDIF
ENDIF

[mkp: edited patch description]

Signed-off-by: Kashyap Desai <kashyap.desai@broadcom.com>
Signed-off-by: Sumit Saxena <sumit.saxena@broadcom.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Ewan D. Milne <emilne@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit d0fc91d67c59068ce6d42e41ce66a4c471e5bc74)
Signed-off-by: Brian Maly <brian.maly@oracle.com>
drivers/scsi/megaraid/megaraid_sas.h
drivers/scsi/megaraid/megaraid_sas_base.c
drivers/scsi/megaraid/megaraid_sas_fusion.c