]> git.proxmox.com Git - mirror_ubuntu-kernels.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)
commitb21bb4cd1102dd9e24a169d09cf4e6f3c8a46bcf
tree05602b8c26ae0fd91964dbb1ddc55f39cbe9f89f
parent392be0bda730df3c71241b2a16bbecac78ee627d
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: 8adaf747c9f0 ("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