Commit Graph

27 Commits

Author SHA1 Message Date
Tuomas Katila
df83e1bb7c fpga: fix codeql issues
Signed-off-by: Tuomas Katila <tuomas.katila@intel.com>
2023-12-05 16:13:37 +02:00
Mikko Ylinen
8f28a7b836 fpga: fix integer type conversion error reported by CodeQL
to address:
"Incorrect conversion of an unsigned 32-bit integer from to a lower bit
size type int without an upper bound check."

Signed-off-by: Mikko Ylinen <mikko.ylinen@intel.com>
2023-12-04 14:41:17 +02:00
Mikko Ylinen
f208a74f85 fpga/bitstream: use consts as much as possible
Signed-off-by: Mikko Ylinen <mikko.ylinen@intel.com>
2023-11-04 09:04:28 +02:00
Hyeongju Johannes Lee
c60a3afb26 fpga: fix naked return error from linter
golangci-lint version < v1.53.0 used nakedret linter that did not check
return values in conditionals. That got changed in v1.53.0 and some
of our code starts failing because of naked returns from conditionals.

Update the code to get nakedret linter passing.

Signed-off-by: Hyeongju Johannes Lee <hyeongju.lee@intel.com>
2023-07-20 10:17:08 +03:00
Mikko Ylinen
642c4f7b59 build: move to Go 1.19 and golangci-lint 1.48 because of that
Signed-off-by: Mikko Ylinen <mikko.ylinen@intel.com>
2022-08-15 10:13:37 +03:00
Ed Bartosh
cec004c398 lint: enable wsl check
Fixes: #392

Signed-off-by: Ed Bartosh <eduard.bartosh@intel.com>
2021-12-17 11:48:48 +02:00
Ed Bartosh
80829f72b1 ci: improve golangci job
- used the same go version as for the project build
- used verbose output
- fixed gofmt check failures

Signed-off-by: Ed Bartosh <eduard.bartosh@intel.com>
2021-11-13 00:32:25 +02:00
Hyeongju Johannes Lee
8fc5df7e37 Add govet-fieldalignment
Add govet-fieldalignment to .golangci.yml
Fix errors that come from adding govet-fieldalignment
- by reordering the fields of structs
- by putting nolint:govet annotations

Signed-off-by: Hyeongju Johannes Lee <hyeongju.lee@intel.com>
2021-09-20 20:59:04 +03:00
Mikko Ylinen
facb4214a2 tree-wide: drop deprecated io/ioutil
Go 1.16 release notes announced the deprecation of io/ioutil [1]. It's easy
for us to move to use what is was recommended so just do it.

[1] https://golang.org/doc/go1.16#ioutil

Signed-off-by: Mikko Ylinen <mikko.ylinen@intel.com>
2021-06-02 13:41:15 +03:00
Mikko Ylinen
e22cefe7a6 pkg/fpga: detect driver attached to a PCI device
Signed-off-by: Mikko Ylinen <mikko.ylinen@intel.com>
2021-04-23 13:38:23 +03:00
Ryan Raasch
25ef46072c Remove vendor PCI check, check only pci class 2021-04-22 11:25:51 +02:00
Ed Bartosh
2c73e2a0b3 fpga: move GetAPIVersion call out of NewPort and NewFME
This call is implemented by calling ioctl, which raises
"open /dev/intel-fpga-port.X: operation not permitted" error
when called inside unprivileged container.

This breaks FPGA plugin.

Calling this API from fpga_tool is still OK, so
moving calls there should fix the issue.

Signed-off-by: Ed Bartosh <eduard.bartosh@intel.com>
2020-11-10 16:44:20 +02:00
Alexander Kanevskiy
d340ce45a7 Fix FPGA DFL Release/Assign ioctl numbers
Using now correct IOCTLs for upstream DFL drivers.
2020-10-26 13:57:28 +02:00
Alexander Kanevskiy
c74cb563dc Implemented SR-IOV Release/Assign ioctl
fpgatool now able to prepare FME via kernel ioctl to release and
assign ports for SR-IOV configurations.
2020-09-02 18:16:53 +03:00
Dmitry Rozhkov
be713f1c8b lint: enable errcheck 2020-08-28 16:14:14 +03:00
Mikko Ylinen
cd068c797a ci: update tool versions
Signed-off-by: Mikko Ylinen <mikko.ylinen@intel.com>
2020-08-21 17:04:04 +03:00
Dmitry Rozhkov
6f59b868d5 convert syscall.Errno to conventional error 2020-06-18 16:52:18 +03:00
Dmitry Rozhkov
70f862f2aa add golangci linter
In this initial commit the following checks are disabled due to
excessive amount of changes required:
- dupl (duplicate code)
- funlen (function length)
- goerr113 (errors handling expressions)
- gomnd (magic numbers)
- gosec (security)
- nakedret (naked returns)
- wsl (forces to use empty lines)
- errcheck (checking for unchecked errors)
- staticcheck (static analysis)
2020-06-08 14:01:13 +03:00
Dmitry Rozhkov
99fcb69d33 fpga: compress fpga AF resource names 2020-04-29 11:59:50 +03:00
Ed Bartosh
f31946bb98 bitstream: increased test coverage 2020-03-20 11:18:05 +02:00
Ed Bartosh
f5754f490e bitstream: remove unused code 2020-03-19 18:33:58 +02:00
Dmitry Rozhkov
456c8f3ff1 fpga: fix stutter reported by golint 2020-01-30 15:17:27 +02:00
Dmitry Rozhkov
3a845cfe15 fpga: rename files to make them linux-only 2020-01-29 17:17:06 +02:00
Alexander Kanevskiy
2430e204d5 fpga_tool: UX improvements
- user readable output for fpgainfo/fmeinfo/portinfo commands
- new commands: list, list-fme, list-port
- new -q flag to suppres headers, progress and too verbose messages
- install command will now fail if destination file already exist
- new --force flag: allows overwrite files in install command
- removed development and debug output
2019-08-25 02:37:07 +03:00
Alexander Kanevskiy
71bb38f496 Implemented native FPGA flashing
Removed dependency to OPAE libraries
2019-08-25 02:37:01 +03:00
Ed Bartosh
de9df8373e fpga_plugin: support in-tree kernel driver
Extended fpga plugin to support both in-tree(DFL) and
out-of-tree (OPAE) kernel drivers.

- fpga_crihook: move JSON parsing to separate functions
- decreased cyclomatic complexity of the CRI hook main() function
- increased readability
- increased test coverage

Signed-off-by: Ed Bartosh <eduard.bartosh@intel.com>
2019-08-24 18:27:15 +03:00
Alexander Kanevskiy
186ec6613c FPGA: migrate to ClearLinux environment
- Migrate to OPAE 1.3.2
- Build all the tools from the source
- ignore files in workspace
- minimal fpga_tool utility to check gbs/aocx file parsing and flashing
- implemented kernel IOCTL based flashing of bitstreams
- add PCI and sysfs functions
2019-08-24 02:55:19 +03:00