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

Add BAM DMUX driver as network interface to the modem #103

Merged
merged 7 commits into from Sep 28, 2020
Merged

Conversation

stephan-gh
Copy link
Member

This adds a new, (imo) mainline-quality driver for the BAM DMUX interface that provides the network interface to the modem on MSM8916 and MSM8974. It replaces the old 20k+ driver I ported from downstream a while ago.

I spent almost the entire last week to write it from scratch. It lacks some performance optimizations of the downstream driver but otherwise it has much better code quality. Overall it seems to work just fine. I have already tested it on:

  • bq-paella
  • samsung-a5ulte
  • samsung-serranovelte

@TravMurav, @Sorixelle Would be great if you could give it a try on wileyfox-cracking/motorola-harpia.

I'm also looking for someone willing to test it on MSM8974. I'm hoping someone will volunteer :)

The instructions for using it are still largely the same, only the kernel config option is different. It's documented in this gist: https://gist.github.com/Minecrell/4cc2bfb9fcae18e294386b0a213907d1

This allows getting the current state reported by a remoteproc
from the SMSM data.
In some configurations, we are required to configure the BAM,
but the BAM clk is managed by a remote processor. It is only turned
on after coordination with the remote processor, and while turned off
accessing the registers results in a bus stall.

Attempt to support this mode by only accessing BAM registers when
a DMA channel is actually requested. Otherwise, keep the BAM in reset.
BAM DMUX is used as network interface to the modem on some older
Qualcomm SoCs like MSM8916 or MSM8974.
BAM DMUX is used as the network interface to the modem.
Add BAM DMUX as network interface to the modem.
Enable BAM DMUX as network interface to the modem.
@z3ntu
Copy link

z3ntu commented Sep 22, 2020

Missing dt bindings for remoteqcom,remote-power-collapse ?

@stephan-gh
Copy link
Member Author

Missing dt bindings for remoteqcom,remote-power-collapse ?

Yes, I did not work on dt bindings at all yet :)

@z3ntu
Copy link

z3ntu commented Sep 22, 2020

image
Works on 8974 👍

@craigcomstock
Copy link

On harpia with this kernel I was able to get ofono working for voice/sms. rmnet0 is present and I can do dhcpcd rmnet0 and get an IP but no connectivity. In dmesg output I see a lot of TX messages but no RX.

I tried ModemManager --debug and mmcli -L and see no modems detected. Any ideas?
mm.log

@stephan-gh
Copy link
Member Author

@craigcomstock

On harpia with this kernel I was able to get ofono working for voice/sms. rmnet0 is present and I can do dhcpcd rmnet0 and get an IP but no connectivity. In dmesg output I see a lot of TX messages but no RX.

You might need to set up the proper APN. @z3ntu wrote on Matrix:

20:40 okay so ./remove-contexts; ./create-internet-context <apn>; ./activate-context 1 was the magic incantation

I tried ModemManager --debug and mmcli -L and see no modems detected. Any ideas?

You need a special patched version of ModemManager from https://gitlab.com/Minecrell/pmaports/-/commits/modemmanager-rpmsg.

@craigcomstock
Copy link

You need a special patched version of ModemManager from https://gitlab.com/Minecrell/pmaports/-/commits/modemmanager-rpmsg.

Actually. Maybe it failed due to ofono being activated. I rebooted and now mmcli -L returns a modem. So I will proceed with these tips as well. I do have the patched ModemManager.

@stephan-gh stephan-gh merged commit 0e99384 into master Sep 28, 2020
@stephan-gh stephan-gh deleted the bam_dmux59 branch September 28, 2020 06:12
@craigcomstock
Copy link

@Minecrell I pulled the firmware from my actual device "modem" partition and then things started working just fine using ModemManager. It definitely did not work with the default firmware in pmos or the firmware I had been using which worked for voice/sms with ofono: https://gitlab.com/unrznbl/vendor_motorola_harpia/-/tree/xt1607-retus-6.0.1. So good job and now I'll try and get MMS working.

Ofono works also. The crux was my firmware. :)

stephan-gh pushed a commit that referenced this pull request May 8, 2022
… lwt hook

xmit_check_hhlen() observes the dst for getting the device hard header
length to make sure a modified packet can fit. When a helper which changes
the dst - such as bpf_skb_set_tunnel_key() - is called as part of the
xmit program the accessed dst is no longer valid.

This leads to the following splat:

 BUG: kernel NULL pointer dereference, address: 00000000000000de
 #PF: supervisor read access in kernel mode
 #PF: error_code(0x0000) - not-present page
 PGD 0 P4D 0
 Oops: 0000 [#1] PREEMPT SMP PTI
 CPU: 0 PID: 798 Comm: ping Not tainted 5.18.0-rc2+ #103
 Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.14.0-2 04/01/2014
 RIP: 0010:bpf_xmit+0xfb/0x17f
 Code: c6 c0 4d cd 8e 48 c7 c7 7d 33 f0 8e e8 42 09 fb ff 48 8b 45 58 48 8b 95 c8 00 00 00 48 2b 95 c0 00 00 00 48 83 e0 fe 48 8b 00 <0f> b7 80 de 00 00 00 39 c2 73 22 29 d0 b9 20 0a 00 00 31 d2 48 89
 RSP: 0018:ffffb148c0bc7b98 EFLAGS: 00010282
 RAX: 0000000000000000 RBX: 0000000000240008 RCX: 0000000000000000
 RDX: 0000000000000010 RSI: 00000000ffffffea RDI: 00000000ffffffff
 RBP: ffff922a828a4e00 R08: ffffffff8f1350e8 R09: 00000000ffffdfff
 R10: ffffffff8f055100 R11: ffffffff8f105100 R12: 0000000000000000
 R13: ffff922a828a4e00 R14: 0000000000000040 R15: 0000000000000000
 FS:  00007f414e8f0080(0000) GS:ffff922afdc00000(0000) knlGS:0000000000000000
 CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
 CR2: 00000000000000de CR3: 0000000002d80006 CR4: 0000000000370ef0
 Call Trace:
  <TASK>
  lwtunnel_xmit.cold+0x71/0xc8
  ip_finish_output2+0x279/0x520
  ? __ip_finish_output.part.0+0x21/0x130

Fix by fetching the device hard header length before running the BPF code.

Fixes: 3a0af8f ("bpf: BPF for lightweight tunnel infrastructure")
Signed-off-by: Eyal Birger <eyal.birger@gmail.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/20220420165219.1755407-1-eyal.birger@gmail.com
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants