]> git.baikalelectronics.ru Git - kernel.git/commit
cxl/mem: Fix register block offset calculation
authorBen Widawsky <ben.widawsky@intel.com>
Thu, 15 Apr 2021 23:26:08 +0000 (16:26 -0700)
committerDan Williams <dan.j.williams@intel.com>
Fri, 16 Apr 2021 02:27:54 +0000 (19:27 -0700)
commit464cdb1873ed188788c1fe8ba2ac3068098ae57e
tree05602b8c26ae0fd91964dbb1ddc55f39cbe9f89f
parent6d88cb375a2e52b6c35d72013f0a9c2a78147cd2
cxl/mem: Fix register block offset calculation

The "Register Offset Low" register of a "DVSEC Register Locator"
contains the 64K aligned offset for the registers along with the BAR
indicator and an id. The implementation was treating the "Register Block
Offset Low" field a value rather than as a pre-aligned component of the
64-bit offset. So, just mask, don't mask and shift (FIELD_GET).

The user visible result of this bug is that the driver fails to bind to
the device after none of the required blocks are found.

This was missed earlier because the primary development done in the QEMU
environment only uses 0 offsets, i.e. 0 shifted is still 0.

Fixes: 9a6716a7448b ("cxl/mem: Find device capabilities")
Reported-by: Vishal Verma <vishal.l.verma@intel.com>
Signed-off-by: Ben Widawsky <ben.widawsky@intel.com>
Link: https://lore.kernel.org/r/20210415232610.603273-1-ben.widawsky@intel.com
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
drivers/cxl/mem.c