Commit e9a9970b authored by Russ Weight's avatar Russ Weight Committed by Moritz Fischer

fpga: dfl: Avoid reads to AFU CSRs during enumeration

CSR address space for Accelerator Functional Units (AFU) is not available
during the early Device Feature List (DFL) enumeration. Early access
to this space results in invalid data and port errors. This change adds
a condition to prevent an early read from the AFU CSR space.

Fixes: 1604986c ("fpga: dfl: expose feature revision from struct dfl_device")
Cc: stable@vger.kernel.org
Signed-off-by: default avatarRuss Weight <russell.h.weight@intel.com>
Signed-off-by: default avatarMoritz Fischer <mdf@kernel.org>
parent a1e44708
...@@ -1019,16 +1019,18 @@ create_feature_instance(struct build_feature_devs_info *binfo, ...@@ -1019,16 +1019,18 @@ create_feature_instance(struct build_feature_devs_info *binfo,
{ {
unsigned int irq_base, nr_irqs; unsigned int irq_base, nr_irqs;
struct dfl_feature_info *finfo; struct dfl_feature_info *finfo;
u8 revision = 0;
int ret; int ret;
u8 revision;
u64 v; u64 v;
if (fid != FEATURE_ID_AFU) {
v = readq(binfo->ioaddr + ofst); v = readq(binfo->ioaddr + ofst);
revision = FIELD_GET(DFH_REVISION, v); revision = FIELD_GET(DFH_REVISION, v);
/* read feature size and id if inputs are invalid */ /* read feature size and id if inputs are invalid */
size = size ? size : feature_size(v); size = size ? size : feature_size(v);
fid = fid ? fid : feature_id(v); fid = fid ? fid : feature_id(v);
}
if (binfo->len - ofst < size) if (binfo->len - ofst < size)
return -EINVAL; return -EINVAL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment