scsi: cxlflash: Avoid clobbering context control register value
authorMatthew R. Ochs <mrochs@linux.vnet.ibm.com>
Mon, 26 Mar 2018 16:30:22 +0000 (11:30 -0500)
committerMartin K. Petersen <martin.petersen@oracle.com>
Wed, 18 Apr 2018 23:32:47 +0000 (19:32 -0400)
commit465891fe9237b02f8d0fd26448f733fae7236f4a
tree042d237bc668e607643d373756cb815d5f5208e6
parente11e0ff8705000f4ca67878d6209bec16927ee0d
scsi: cxlflash: Avoid clobbering context control register value

The SISLite specification originally defined the context control register with
a single field of bits to represent the LISN and also stipulated that the
register reset value be 0. The cxlflash driver took advantage of this when
programming the LISN for the master contexts via an unconditional write - no
other bits were preserved.

When unmap support was added, SISLite was updated to define bit 0 of the
context control register as a way for the AFU to notify the context owner that
unmap operations were supported. Thus the assumptions under which the register
is setup changed and the existing unconditional write is clobbering the unmap
state for master contexts. This is presently not an issue due to the order in
which the context control register is programmed in relation to the unmap bit
being queried but should be addressed to avoid a future regression in the
event this code is moved elsewhere.

To remedy this issue, preserve the bits when programming the LISN field in the
context control register. Since the LISN will now be programmed using a read
value, assert that the initial state of the LISN field is as described in
SISLite (0).

Signed-off-by: Matthew R. Ochs <mrochs@linux.vnet.ibm.com>
Signed-off-by: Uma Krishnan <ukrishn@linux.vnet.ibm.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/cxlflash/main.c
drivers/scsi/cxlflash/sislite.h