Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sysfs error unhandled in fpgasupdate #3139

Open
ifkato opened this issue Jul 26, 2024 · 1 comment
Open

sysfs error unhandled in fpgasupdate #3139

ifkato opened this issue Jul 26, 2024 · 1 comment
Assignees

Comments

@ifkato
Copy link

ifkato commented Jul 26, 2024

Some sysfs objects of the dfl/intel-m10bmc driver can return -EINVAL when read.
In this case, reading the fpga_boot_page file results in -EINVAL if PMCI_CONFIGED bit of the PMCI CSR M10BMC_PMCI_FPGA_CONF_STS word is 0.
(i.e. the FPGA failed to be configured from FLASH, but is configured from JTAG.)

https://github.com/OFS/linux-dfl/blob/6b0d820d436dda1e5949205a8f081fe0360c8430/drivers/fpga/intel-m10-bmc-sec-update.c#L1105

sysfs_node#value() method opens and reads the fpga_boot_page file.
It handles and raises IOError.
It does not handle OSError from -EINVAL.

@property
def value(self):
"""value Read the value of a sysfs attribute
Returns: The string returned (trimmed of whitespace) from reading the
attribute.
Raises:
IOError: If an IOError is caught while attempting to open the path
object represented by this node.
Note:
Attempting to get a value from a sysfs path that is a directory
will result in an IOError being raised.
"""
try:
with self._open('r') as fd:
return fd.read().strip()
except IOError as err:
self.log.exception('error opening: %s - %s', self.sysfs_path, err)
raise

fpgasupdate calls sysfs_node#value() without handling OSError or IOError, so it crashes if the FPGA is configured from JTAG.

LOG.debug ("Boot page value: %s\n", boot_page.value)

To fix this, some error handling needs to be implemented, either in sysfs_node class or fpgasupdate.py.

@nathanborak
Copy link

Hello @ifkato, issue was forwarded to engineering team.

@pcolberg pcolberg self-assigned this Oct 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants