-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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
Handle probe dependencies and hard errors better #6645
Conversation
platform_set_drvdata(pdev, fw); | ||
} else { | ||
kfree(fw); | ||
platform_set_drvdata(pdev, ERR_PTR(-ENOENT)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We do dereference this in rp1_firmware_remove
(without a check).
I'm not sure if that can happen, but looks like a potential pitfall.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Testing the obvious fix has uncovered some deficiencies in the end-of-life code. Thank goodness for runtime overlays.
If the RP1 firmware has reported an error then return that from the PIO probe function, otherwise defer the probing. Link: raspberrypi#6642 Signed-off-by: Phil Elwell <[email protected]>
To avoid pointless retries, let the probe function succeed if the firmware interface is configured correctly but the firmware is incompatible. The value of the private drvdata field holds the outcome. Link: raspberrypi#6642 Signed-off-by: Phil Elwell <[email protected]>
The of_xlate method saves the calculated event mask in the con_priv field. It also rejects subsequent attempt to use that channel because the mask is non-zero, which causes a repeated instantiation of a client driver to fail. The of_xlate method is not meant to be a point of resource acquisition. Leave the con_priv initialisation, but drop the test that it was previously zero. Signed-off-by: Phil Elwell <[email protected]>
With the latest updates, the rp1 firmware driver and pio driver can be repeatedly instantiated and removed with no crashes or obvious leaks. |
See: raspberrypi/linux#6636 kernel: misc: rp1-pio: SM_CONFIG_XFER32 = larger DMA bufs See: raspberrypi/linux#6640 kernel: Handle probe dependencies and hard errors better See: raspberrypi/linux#6645 kernel: spi: dw: Wait for idle after TX See: raspberrypi/linux#6646 See: raspberrypi/linux#6649
See: raspberrypi/linux#6636 kernel: misc: rp1-pio: SM_CONFIG_XFER32 = larger DMA bufs See: raspberrypi/linux#6640 kernel: Handle probe dependencies and hard errors better See: raspberrypi/linux#6645 kernel: spi: dw: Wait for idle after TX See: raspberrypi/linux#6646 See: raspberrypi/linux#6649
#6642 is a report of intermittent failures for the PIO driver to contact the firmware. These failures can be traced to the failure of PIO driver to distinguish hard errors and transient failures. The commits in this PR fix the PIO driver in this regard, but also improve the firmware driver to avoid pointless retries in the event that the firmware is not compatible.