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

BCM2711 - Upstream Linux 5.5 backport #3385

Merged
merged 16 commits into from
Jan 17, 2020

Conversation

lategoodbye
Copy link
Contributor

@lategoodbye lategoodbye commented Dec 27, 2019

This pull requests tries to reduce the delta between downstream and current upstream development. Since Linux 5.4 LTS has been released i don't see any point to backport 5.5 changes into 4.19.

In short the PR contain the following 5.5 changes:

  • BCM2711 board support
  • timer cleanup
  • U-Boot fix
  • Backport of Bluetooth, GENET, RNG

Unfortunately there is no complete backward compatibility of GENET, since the PHY mode was wrong before.

This PR doesn't contain all 5.5 DTS changes:

  • generic pinctrl (fundamental change which might break some overlays)
  • HDMI (might break graphics)
  • CMA fix (breaks Kodi, needs to be investigated further)

I tried to keep the changes as minimal as possible.

This PR has been tested with bcm2711_defconfig.

@popcornmix
Copy link
Collaborator

ARM: dts: bcm2711: force CMA into first GB of memory stops kodi (installed from raspberry pi repo) from working.
It fails with:

DRM_IOCTL_MODE_CREATE_DUMB failed: Cannot allocate memory
Failed to create scanout resource
DRM_IOCTL_MODE_CREATE_DUMB failed: Cannot allocate memory
Failed to create scanout resource
terminate called after throwing an instance of 'std::runtime_error'
  what():  eglSwapBuffers failed

@lategoodbye
Copy link
Contributor Author

@popcornmix Thanks for testing. I can drop this patch, but this needs to be investigated further.

@vianpl Any ideas?

@lategoodbye
Copy link
Contributor Author

I dropped the CMA fix and updated the initial comment.

@vianpl
Copy link
Contributor

vianpl commented Jan 3, 2020

Here's my guess. By configuring CMA in the device tree the kernel stops reacting to the command line options. I bet the Kodi install is updating the CMA size trough the kernel command line, which is not being taken into account. The only way to do it after this patch is by using overlays.

@popcornmix
Copy link
Collaborator

With cma not in cmdline.txt and without the cma patch:

[    0.000000] cma: Reserved 256 MiB at 0x000000001bc00000

With cma=512M in cmdline.txt and without the cma patch:

[    0.000000] cma: Reserved 512 MiB at 0x000000000bc00000

with cma not in cmdline.txt and the cma patch:

[    0.000000] Reserved memory: created CMA memory pool at 0x0000000029c00000, size 32 MiB

With cma=512M in cmdline.txt and the cma patch:

[    0.000000] Reserved memory: created CMA memory pool at 0x0000000029c00000, size 32 MiB

All these have the vc4-fkms-v3d overlay which attempts to increase CMA to 256M (@pelwell can confirm but I think the overlay ends up modifying the cmdline kernel sees).
But we only ever get 32M of CMA with the patch.

So should cma=<> on cmdline still work? Is there a way to make it do so?

@vianpl
Copy link
Contributor

vianpl commented Jan 3, 2020

With cma not in cmdline.txt and without the cma patch:

[    0.000000] cma: Reserved 256 MiB at 0x000000001bc00000

With cma=512M in cmdline.txt and without the cma patch:

[    0.000000] cma: Reserved 512 MiB at 0x000000000bc00000

with cma not in cmdline.txt and the cma patch:

[    0.000000] Reserved memory: created CMA memory pool at 0x0000000029c00000, size 32 MiB

With cma=512M in cmdline.txt and the cma patch:

[    0.000000] Reserved memory: created CMA memory pool at 0x0000000029c00000, size 32 MiB

This is the behavior I observed upstream. I double checked the code, command line is explicitly ignored.

All these have the vc4-fkms-v3d overlay which attempts to increase CMA to 256M (@pelwell can confirm but I think the overlay ends up modifying the cmdline kernel sees).
But we only ever get 32M of CMA with the patch.

I think the overlay could be easily updated to work with the new CMA setup. We'd just need to update the size property in the CMA node instead of altering the command line.

So should cma=<> on cmdline still work? Is there a way to make it do so?

Well I guess this is something we should discuss with people upstream. I'd say the command line should take precedence to the DTB. At least for it's size. But I guess we'd have to investigate further. There are not so many users of DTB defined CMAs, so we might be the first with such needs.

@pelwell
Copy link
Contributor

pelwell commented Jan 3, 2020

I'd be happy with a DTB-only solution - patching the command line from an overlay always seemed a bit ugly.

@vianpl
Copy link
Contributor

vianpl commented Jan 3, 2020

@pelwell I'm still on holidays until the 7th, but if you can wait until then I'll be happy to have a got at it.

@popcornmix
Copy link
Collaborator

I'd be happy with a DTB-only solution - patching the command line from an overlay always seemed a bit ugly.

As long as there's an easy way for users to adjust it. The HEVC V4L2 driver for example wants a lot of CMA to play 10bit 4K video (256M is not enough), and we have examples of high CMA settings causing kernel allocation failures, so we can't just unconditionally set it high.

A config.txt setting that causes firmware to adjust cma value in DTB should be okay if cmdline.txt solution isn't possible.

@pelwell
Copy link
Contributor

pelwell commented Jan 3, 2020

I'd make it a dtparam.

@popcornmix popcornmix force-pushed the rpi-5.4.y branch 2 times, most recently from 75bb710 to 53c77f0 Compare January 6, 2020 12:41
@vianpl
Copy link
Contributor

vianpl commented Jan 9, 2020

I've been working on the following small series to address the CMA issue. See the first two patches here: https://github.com/vianpl/linux/commits/bcm283x-cma-unification.

With the DT patch it'll be trivial to update all overlays that change CMA sizes. And if the cmdline/DT precendence patch doesn't make it we can always create an extra overlay to edit CMA sizes trough a dtparam.

Will this overall approach be acceptable to you?

@pelwell
Copy link
Contributor

pelwell commented Jan 10, 2020

I've commented on one of the patches, but to summarise: I'm happy with it, but I'd like a label on the linux,cma node for overlays (or aliases) to target.

@lategoodbye lategoodbye changed the title RFC: BCM2711 - Upstream Linux 5.5 backport BCM2711 - Upstream Linux 5.5 backport Jan 11, 2020
@lategoodbye
Copy link
Contributor Author

Since i dropped the CMA patch, this could be a separate pull request. This pull request is rebased now.

@popcornmix
Copy link
Collaborator

The patches (excluding CMA one) seemed fine in my limited testing, so no objections.

This reverts commit adac895, because this
issue is already addressed by commit 19ec6bb.

Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
commit 4b2d246 upstream.

The fixed clocks doesn't form some kind of bus. So let's remove it.
This fixes the follow DT schema warnings:

clocks: clock@3:reg:0: [3] is too short
clocks: clock@4:reg:0: [4] is too short
clocks: $nodename:0: 'clocks' does not match '^(bus|soc|axi|ahb|apb)(@[0-9a-f]+)?$'
clocks: #size-cells:0:0: 0 is not one of [1, 2]
clocks: 'ranges' is a required property
clock@3: 'reg' does not match any of the regexes: 'pinctrl-[0-9]+'
clock@4: 'reg' does not match any of the regexes: 'pinctrl-[0-9]+'

Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
During Raspberry Pi 4 upstream discussion Tim Gover confirmed that the
system timer also exists on BCM2711. So move it back to bcm283x.dtsi and
overwrite the interrupt definition in bcm2838.dtsi.

Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
According to Eric Anholt the pixelvalves doesn't exists on BCM2711.
So move it to bcm2835-common.dtsi.

Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
We need to declare the proper device type, otherwise U-Boot won't boot
with this devicetree. While we are this let the bootloader set the actual
memory size.

Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
The CYW43455 on the Raspberry Pi 4 doesn't use an external pin as lower
power clock anymore. So drop the GPIO clock from pinctrl. While we are at
this add the missing declaration of hardware flow control.

Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
According to devicetree specification the node name should describe
the general class of device like ethernet or interrupt-controller.

Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
The intc label isn't defined in bcm283x.dtsi, so we cannot use it there.
So move it to bcm2835-common.dtsi.

Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
After moving bcm2835-system-timer to bcm283x.dtsi there is no need for
the always-on for armv7-timer anymore.

Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
This adds the missing support for the PHY mode RGMII_RXID.
It's necessary for the Raspberry Pi 4.

Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
This backport all genet differences (different compatible, right PHY mode,
board specific stuff) from upstream.

Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
Make the BCM2711 a different machine, but keep it in board_bcm2835.

Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
commit 0f95b09 upstream.

BCM2711 features a RNG200 hardware random number generator block.
So make the driver available.

Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
Signed-off-by: Stephen Brennan <stephen@brennan.io>
Reviewed-by: Matthias Brugger <mbrugger@suse.com>
Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This adds the ability to use the RNG with an upstream kernel.
Keep the old one for backward compatibility.

Signed-off-by: Stefan Wahren <wahrenst@gmx.net>
@lategoodbye
Copy link
Contributor Author

Pull request rebased

@lategoodbye
Copy link
Contributor Author

@pelwell Are there any objections with this pull request?

@pelwell
Copy link
Contributor

pelwell commented Jan 17, 2020

I'm just giving it a quick smoke test prior to merging.

@pelwell
Copy link
Contributor

pelwell commented Jan 17, 2020

Note to self: If you ever experiment with different armstubs, be sure to delete them before regression testing.

@pelwell pelwell merged commit 436302f into raspberrypi:rpi-5.4.y Jan 17, 2020
@lategoodbye
Copy link
Contributor Author

Thanks

@lategoodbye lategoodbye deleted the rpi-5.4-rpi4-backport branch February 11, 2020 19:43
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.

4 participants