Make RPi.GPIO work on arm64

Bug #1814118 reported by Dave Jones on 2019-01-31
12
This bug affects 1 person
Affects Status Importance Assigned to Milestone
rpi.gpio (Ubuntu)
Low
Unassigned
Bionic
Medium
Unassigned
Cosmic
Low
Unassigned

Bug Description

[Impact]

 * RPi.GPIO currently does not work under arm64 kernels, simply due to hardware revision detection being slightly different.
 * The patched version operates as expected under both armhf and arm64 kernels by querying /proc/device-tree/system/linux,revision (a file that exists on modern armhf and arm64 kernels), falling back to /proc/cpuinfo (the former detection method, primarily to continue supporting any older armhf kernels).
 * This will also bump the version from 0.6.3 to 0.6.5 on bionic/cosmic. This fixes several nasty bugs around PWM handling and event detection. These issues didn't affect short-term experimentation with the library, but do affect long-running deployments (memory leak in PWM allocation, and a race-condition in setting up pin event detection).

[Test Case]

 * On an arm64 kernel:
 * Install present version of python3-rpi.gpio (0.6.3-1ubuntu4)
 * Under python3 "from RPi import GPIO"
 * Present version returns RuntimeError: This module can only be run on a Raspberry Pi
 * Upgrade to proposed version (0.6.5-1ubuntu1)
 * Under python3 "from RPi import GPIO"
 * This should succeed
 * Run test cases under test/ (note: external wiring/components required; check source header for requirements)
 * Repeat procedure with armhf kernel to ensure no regression

[Regression Potential]

 * On armhf kernels: low; the existing detection pathway is maintained for ancient kernels lacking /proc/device-tree/system/linux but modern armhf kernels appear to have this file anyway and work with the new detection code. The new version is also operating happily upstream in Raspbian stretch.
 * On arm64 kernels: none; the existing version simply fails to import anyway

Changed in rpi.gpio (Ubuntu):
importance: Undecided → Low
Łukasz Zemczak (sil2100) wrote :

The package looks good and I guess I'll just sponsor it as is. For a moment I was wondering about proposing a small change to the relevant patch: since currently when we're able to open /proc/device-tree/system/linux,revision but are not able to read the contents, the patch forces an error. Was thinking that maybe we should fall-back to the cpuinfo check in this case as well. But then, I suppose that if the linux,revision is openable but unreadable, that's actually a bug and maybe one should actually error out. Besides, this might make the code less clean as for handling an edge-case. Might be worth considering, but I now lean towards just releasing this to disco as-is.

Łukasz Zemczak (sil2100) wrote :

Sponsored.

Changed in rpi.gpio (Ubuntu):
status: New → Fix Committed
Dave Jones (waveform) on 2019-03-14
description: updated
Dave Jones (waveform) wrote :

SRU: debdiff from current bionic (0.6.3-1ubuntu5) to disco (0.6.5-1ubuntu1) attached.

Simon Quigley (tsimonq2) wrote :

Subscribing Łukasz, he sponsored this the last time and is also on the SRU Team (so he can examine its suitability for a stable release).

Thanks for your work on this!

Changed in rpi.gpio (Ubuntu Bionic):
importance: Undecided → Low
Changed in rpi.gpio (Ubuntu Cosmic):
importance: Undecided → Low
Changed in rpi.gpio (Ubuntu):
status: Fix Committed → Fix Released
Changed in rpi.gpio (Ubuntu Bionic):
importance: Low → Medium
Changed in rpi.gpio (Ubuntu Cosmic):
status: New → Won't Fix
Changed in rpi.gpio (Ubuntu Bionic):
status: New → In Progress
Łukasz Zemczak (sil2100) wrote :

I have sponsored the backport to bionic, since even though this is certainly not a priority, we do support arm64 on Pi3 officially for this series - so it would be good to have things working there.

I'm setting the cosmic task as invalid because we do not provide cosmic arm64 pi3 images (at all).

Hello Dave, or anyone else affected,

Accepted rpi.gpio into bionic-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/rpi.gpio/0.6.5-1ubuntu0.18.04.1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested and change the tag from verification-needed-bionic to verification-done-bionic. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-bionic. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in rpi.gpio (Ubuntu Bionic):
status: In Progress → Fix Committed
tags: added: verification-needed verification-needed-bionic

The fix for this bug has been awaiting testing feedback in the -proposed repository for bionic for more than 90 days. Please test this fix and update the bug appropriately with the results. In the event that the fix for this bug is still not verified 15 days from now, the package will be removed from the -proposed repository.

tags: added: removal-candidate
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers