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

pm33xx.c: omap_rtc NULL dereferencing fixed #279

Open
wants to merge 65 commits into
base: 5.10
Choose a base branch
from

Conversation

SergeySheleg
Copy link

On some board designs rtc is turned off so rtc node in devicetree has status = "disabled". In this case(according to am33xx_pm_rtc_setup) rtc-only mode is disabled and omap_rtc remains NULL. However, standby mode is still available. Implementation of am33xx_pm_end in vanilla kernel 5.2+ causes NULL dereferencing of omap_rtc for such boards. This patch fixes that.

RobertCNelson and others added 30 commits February 4, 2023 16:38
Signed-off-by: Robert Nelson <[email protected]>
Signed-off-by: Robert Nelson <[email protected]>
Signed-off-by: Robert Nelson <[email protected]>
Signed-off-by: Robert Nelson <[email protected]>
Signed-off-by: Robert Nelson <[email protected]>
Signed-off-by: Robert Nelson <[email protected]>
Signed-off-by: Robert Nelson <[email protected]>
Reference: v5.13.19
Signed-off-by: Robert Nelson <[email protected]>
Reference: v5.13.19
Signed-off-by: Robert Nelson <[email protected]>
Reference: v5.10.162
Signed-off-by: Robert Nelson <[email protected]>
Reference: v5.10.166
Signed-off-by: Robert Nelson <[email protected]>
Reference: v5.19.17
Signed-off-by: Robert Nelson <[email protected]>
Signed-off-by: Robert Nelson <[email protected]>
Reference: v5.10.9
Signed-off-by: Robert Nelson <[email protected]>
v5.10.9-2022_0909

Signed-off-by: Robert Nelson <[email protected]>
…chedule()"

This reverts commit 26c7295.

Signed-off-by: Robert Nelson <[email protected]>
Add a runtime interface to using configfs for generic device tree overlay
usage. With it its possible to use device tree overlays without having
to use a per-platform overlay manager.

Please see Documentation/devicetree/configfs-overlays.txt for more info.

Changes since v6:
- Default groups properties API changed.

Changes since v5:
- New style configfs.

Changes since v4:
- Loading fix for multiple overlays as found out by
  Geert Uytterhoeven <[email protected]>

Changes since v3:
- Fixed compilation on SPARC & Xtensa

Changes since v2:
- Removed ifdef CONFIG_OF_OVERLAY (since for now it's required)
- Created a documentation entry
- Slight rewording in Kconfig

Changes since v1:
- of_resolve() -> of_resolve_phandles().

Signed-off-by: Pantelis Antoniou <[email protected]>
[geert: Use %zu to format size_t]
[geert: Rebase to v4.15-rc1]
[geert: Make cfs_overlay_item_dtbo_{read,write}() and
	of_cfs_overlay_group static]
[geert: Let OF_CONFIGFS select OF_FLATTREE to fix sparc all*config]
[geert: Spelling/grammar s/rationalle of/rationale for/]
[geert: Rebase on top of commit 39a751a ("of: change overlay apply input data from unflattened to FDT")
Signed-off-by: Geert Uytterhoeven <[email protected]>
We are going to need the overlays to appear on sysfs with runtime
global properties (like master enable) so turn them into kobjects.

They have to be in sysfs so that people can have information about the
overlays applied in the system, i.e. where their targets are and whether
removal is possible. In a future more attributes can be added
in a backwards compatible manner.

Signed-off-by: Pantelis Antoniou <[email protected]>
[geert: Rebase to v4.15-rc1]
[Fengguang Wu: Make overlay_changeset_release() static]
[geert: Rebase on top of commit 39a751a ("of: change overlay apply input data from unflattened to FDT")
Signed-off-by: Geert Uytterhoeven <[email protected]>
A throw once master enable switch to protect against any
further overlay applications if the administrator desires so.

A kernel command line option is provided as well.

Signed-off-by: Pantelis Antoniou <[email protected]>
Documentation ABI entry for overlays sysfs entries.

Signed-off-by: Pantelis Antoniou <[email protected]>
Document the of_overlay_disable parameter.

Signed-off-by: Pantelis Antoniou <[email protected]>
willeccles and others added 27 commits February 4, 2023 16:38
When CONFIG_PM is not enabled, the function
davinci_mdio_update_dt_from_phymask is not defined. This patch fixes
this so that the build does not fail with CONFIG_PM disabled.

Signed-off-by: Will Eccles <[email protected]>
------=_Part_422_1349561576.1515022447432
Content-Type: text/plain; charset="UTF-8"

Hello all,

The TI touch screen driver does not work _right_ with the libts-bin package
in the jessie image.

$ cat /etc/dogtag
BeagleBoard.org Debian Image 2018-01-01

$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 8.10 (jessie)
Release:        8.10
Codename:       jessie

$ dpkg -l | grep  libts-bin
ii  libts-bin                             1.14-1rcnee0~jessie+20171122
                      armhf        touch screen library utilities

$ sudo ts_calibrate
ts_setup: No such file or directory

It is possible to make it work by setting the TSLIB_TSDEVICE environment
variable:

$ sudo su
# export TSLIB_TSDEVICE=/dev/input/event2
# ts_calibrate

But, that's a bit of a pain since the environment variable always needs to
be set in order to use the touchscreen.

It appears that this version of the utilities uses the INPUT_PROP_DIRECT
propbit to automatically detect which /dev/input/event device is the
touchscreen.

It looks like the following is the only change needed to make it work.

Unfortunately, I don't have currently have a way to build a custom kernel
for the BeagleBone in order to test it. If there is anyone that could I
would
appreciate it.

Regards,
Hartley
Authors:
Pantelis Antoniou <[email protected]>
Charles Steinkuehler <[email protected]>
Jason Kridner <[email protected]>
Robert Nelson <[email protected]>
Tobias Müller <[email protected]>
Matthijs van Duin <[email protected]>

This patch was derived from 19 commits:
https://github.com/RobertCNelson/linux-dev/tree/35e301ae8436e9f56f65bf1a7440021eda42f948/patches/drivers/ti/gpio

Signed-off-by: Robert Nelson <[email protected]>
Authors:
Pantelis Antoniou <[email protected]>
Charles Steinkuehler <[email protected]>
Jason Kridner <[email protected]>
Robert Nelson <[email protected]>
Tobias Müller <[email protected]>
Matthijs van Duin <[email protected]>

This patch was derived from 19 commits:
https://github.com/RobertCNelson/linux-dev/tree/35e301ae8436e9f56f65bf1a7440021eda42f948/patches/drivers/ti/gpio

Signed-off-by: Robert Nelson <[email protected]>
… find a better way to share gpio...

Signed-off-by: Robert Nelson <[email protected]>
#<Daulity> is there a kernel option to not reset gpio state at linux boot ?
#<zmatt> Daulity: the kernel does not reset any gpio unless explicitly requested to by a driver
#<zmatt> though by default if cape-universal is enabled then a gpio-of-helper device gets set up which configures all gpios as input... though that is normally the state they are in anyway after reset
#<zmatt> Daulity: why? are you setting gpios in u-boot?
#<Daulity> yes u-boot sets a few gpio's before it boots the kernel they get reset to a certain state not certain if u-boot or linux kernel
#<Daulity> was just wondering
#<zmatt> the annoying bit is that this isn't really fixable by applying an overlay on top of cape-universal due the the limitations of overlays and the fact that status="disabled"; doesn't work on individual gpios of a gpio-of-helper device node
#<zmatt> so your options are to modify the cape-universal overlay or disable cape-universal entirely and use an overlay to declare/export gpios (with initialization of your choice)
#<Daulity> i see
#<zmatt> (or fix the gpio-of-helper drivers to respect the status property of individual gpios... which is probably a 2-line patch)
#<zmatt> *driver
#<zmatt> interesting, if CONFIG_OF_KOBJ=n then nodes with non-okay status property don't even get deserialized, however in practice CONFIG_OF_KOBJ is always y (specifically, it is only n in kernels that lack sysfs support)
#<zmatt> yeah it's definitely a 2-line fix
#<zmatt> https://pastebin.com/f8V8pz1V
#<Daulity> thanks :)
#<zmatt> rcn-ee: can you include that patch?  that way overlays can disable cape-universal's gpio export for individual gpios used by the overlay
#<zmatt> e.g. &ocp { cape-universal { P9_14 { status = "disabled"; }; }; };
#<zmatt> Daulity: you can use that in an overlay and then if you still want the gpio exported you can just declare your own gpio-of-helper ... unfortunately it doesn't support exporting a gpio without initializing it, but at least you can choose *how* to initialize it (input, output-low, output-high) and whether or not linux userspace is allowed to change the direction of the gpio

Signed-off-by: Robert Nelson <[email protected]>
Signed-off-by: Robert Nelson <[email protected]>
Taken from commit 8e407b62f2ed89fe41c40a976669df1693cf7027
in https://github.com/boundarydevices/linux-imx6.

    cfg80211: Using new wiphy flag WIPHY_FLAG_DFS_OFFLOAD
    When flag WIPHY_FLAG_DFS_OFFLOAD is defined, the driver would handle
    all the DFS related operations. Therefore the kernel needs to ignore
    the DFS state that it uses to block the userspace calls to the
    driver through cfg8021 APIs. Also it should treat the userspace
    calls to start radar detection as a no-op.

Ref: BSP-65
Signed-off-by: Paul Barker <[email protected]>
Taken from commit 8e407b62f2ed89fe41c40a976669df1693cf7027
in https://github.com/boundarydevices/linux-imx6.

Ref: BSP-65
Signed-off-by: Paul Barker <[email protected]>
Taken from commit 8e407b62f2ed89fe41c40a976669df1693cf7027
in https://github.com/boundarydevices/linux-imx6.

Ref: BSP-65
Signed-off-by: Paul Barker <[email protected]>
already default on BBB/X15, just calculated on every bootup

Signed-off-by: Robert Nelson <[email protected]>
"uio" for generic use
"ti,pruss-shmem" for backwards compatibility

the of_id module parameter is still supported to add another id
GCC 11 on ARM now complains like the following when trying to determine if
an arch is supported. Presumably because it enforces the default option
'--with-float=hard' which GCC 10 didn't do?

  $ arm-linux-gnueabihf-gcc-11 -march=armv7-a -c -x c /dev/null
  cc1: error: ‘-mfloat-abi=hard’: selected architecture lacks an FPU

Due to that, the kernel build system selects the wrong compiler options
which throws errros like this during the build:

  /tmp/ccrHfZPj.s: Assembler messages:
  /tmp/ccrHfZPj.s:116: Error: selected processor does not support `dmb ish' in ARM mode
  /tmp/ccrHfZPj.s:150: Error: selected processor does not support `isb ' in ARM mode
  /tmp/ccrHfZPj.s:160: Error: selected processor does not support `mrrc p15,1,r4,r5,c14' in ARM mode
  /tmp/ccrHfZPj.s:245: Error: selected processor does not support `dmb ish' in ARM mode
  /tmp/ccrHfZPj.s:503: Error: selected processor does not support `dmb ish' in ARM mode
  /tmp/ccrHfZPj.s:527: Error: selected processor does not support `dmb ish' in ARM mode
  /tmp/ccrHfZPj.s:698: Error: selected processor does not support `dmb ish' in ARM mode
  /tmp/ccrHfZPj.s:731: Error: selected processor does not support `isb ' in ARM mode

Fix that by adding '-msoft-float' to KBUILD_CFLAGS before the definition of
the 'arch-$(CONFIG_CPU_<foo>)' instruction selection macros.

Signed-off-by: Juerg Haefliger <[email protected]>
Reference: v5.19.17
Signed-off-by: Robert Nelson <[email protected]>
Signed-off-by: Robert Nelson <[email protected]>
On some board designs rtc is turned off so rtc node in devicetree has status = "disabled". In this case(according to am33xx_pm_rtc_setup) rtc-only mode is disabled and omap_rtc remains NULL. However, standby mode is still available. Implementation of am33xx_pm_end in vanilla kernel 5.2+ causes NULL dereferencing of omap_rtc for such boards. This patch fixes that.
@RobertCNelson
Copy link
Member

Thanks @SergeySheleg ! Ps, have you posted for upstream, just want to document the patch for our side. ;)

Regards,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants