fpga: dfl: Avoid reads to AFU CSRs during enumeration
Subsystems (3)
PATCH 1/1 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.
dfl_device")
Cc: [email protected]
--- drivers/fpga/dfl.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-)
drivers/fpga/dfl.c +8 -6
@@ -1019,16 +1019,18 @@ create_feature_instance(struct build_feature_devs_info *binfo, {unsigned int irq_base, nr_irqs;struct dfl_feature_info *finfo; +u8 revision =0 ;int ret; -u8 revision;u64 v; - v =readq (binfo->ioaddr + ofst); - revision =FIELD_GET (DFH_REVISION , v); +if (fid !=FEATURE_ID_AFU ) { + v =readq (binfo->ioaddr + ofst); + revision =FIELD_GET (DFH_REVISION , v); -/* read feature size and id if inputs are invalid */ - size = size ? size :feature_size (v); - fid = fid ? fid :feature_id (v); +/* read feature size and id if inputs are invalid */ + size = size ? size :feature_size (v); + fid = fid ? fid :feature_id (v); + }if (binfo->len - ofst < size)return -EINVAL ;
Signature · 1 line
2.25.1
Moritz Fischer
maintainerQuoted 9 lines · Russ Weight
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.
Signed-off-by Russ Weight <[email protected]>Fixes 23bcda750558 ("fpga: dfl: expose feature revision from struct
dfl_device")
Did you mean:
And for future please don't line break those, or we'll get yelled at :)
I can locally fix it up, no need to resubmit
- Moritz
Quoted 6 lines · Moritz Fischer
Quoted 5 lines · Russ Weight
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.
Quoted 7 lines
Quoted 4 lines
Signed-off-by Russ Weight <[email protected]>Fixes 23bcda750558 ("fpga: dfl: expose feature revision from struct
dfl_device")Did you mean:
Fixes 1604986c3e6b ("fpga: dfl: expose feature revision from struct dfl_device")
Oops - I must have been looking at the wrong branch. Yes - you have the correct commit ID
Quoted 2 lines
And for future please don't line break those, or we'll get yelled at :)
Got it.
Thanks!
- Russ
Quoted 4 lines
I can locally fix it up, no need to resubmit
- Moritz
Moritz Fischer
maintainerQuoted 15 lines · Russ Weight
Quoted 6 lines · Moritz Fischer
Quoted 5 lines · Russ Weight
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.
Quoted 7 lines
Quoted 4 lines
Signed-off-by Russ Weight <[email protected]>Fixes 23bcda750558 ("fpga: dfl: expose feature revision from struct
dfl_device")Did you mean:
Fixes 1604986c3e6b ("fpga: dfl: expose feature revision from struct dfl_device")
Quoted 13 lines
Oops - I must have been looking at the wrong branch. Yes - you have the correct commit ID
Quoted 2 lines
And for future please don't line break those, or we'll get yelled at :)
Got it.
Thanks!
- RussQuoted 4 lines
I can locally fix it up, no need to resubmit
- Moritz
Applied w/changes to fixes,
- Moritz
Quoted 18 lines · Moritz Fischer
Quoted 17 lines · Russ Weight
Quoted 6 lines · Moritz Fischer
Quoted 5 lines · Russ Weight
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.
Quoted 7 lines
Quoted 4 lines
Signed-off-by Russ Weight <[email protected]>Fixes 23bcda750558 ("fpga: dfl: expose feature revision from struct
dfl_device")Did you mean:
Fixes 1604986c3e6b ("fpga: dfl: expose feature revision from struct dfl_device")Oops - I must have been looking at the wrong branch. Yes - you have the correct commit ID
Quoted 1 line
And for future please don't line break those, or we'll get yelled at :)
Quoted 8 lines
Quoted 7 lines
Got it.
Thanks!
- RussQuoted 3 lines
I can locally fix it up, no need to resubmit
- Moritz
Applied w/changes to fixes,
Can a signed-off tag still be added?
There was also a suggestion the the variable v could be declared within the scope of the "if" statement instead of being declared at function scope. I haven't seen that done much (at all?) in kernel code.
- Russ
Quoted 2 lines
- Moritz
Greg KH
maintainerQuoted 9 lines · Russ Weight
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.
Signed-off-by Russ Weight <[email protected]>Fixes 23bcda750558 ("fpga: dfl: expose feature revision from struct
dfl_device")
Nit, please keep this all on one line or our tools will complain about it when we commit it to our trees :(
thanks,
greg k-h
Moritz Fischer
maintainerQuoted 6 lines · Greg KH
Quoted 5 lines · Russ Weight
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.
Quoted 7 lines
Quoted 4 lines
Signed-off-by Russ Weight <[email protected]>Fixes 23bcda750558 ("fpga: dfl: expose feature revision from struct
dfl_device")Nit, please keep this all on one line or our tools will complain about it when we commit it to our trees :(
I had caught that and fixed it when applying :)
Thanks,
Moritz