msm8953-mainline / linux

Linux mainline kernel with WIP patches for msm8953 devices
Other
111 stars 59 forks source link

IPA v2 for 6.3.0/ipa #102

Closed spasswolf closed 7 months ago

spasswolf commented 1 year ago

/Here are the patches for IPA v2 rebased to branch 6.3.0/ipa (starting from commit dbfb5bd9330eeba18015dc821f885163813c0058) (created with git format-patch): 0001-Initial-port-of-the-IPAv2-driver-from-6.1.0-to-6.3.0.patch.txt 0002-Next-part-of-the-IPA-v2-commit.patch.txt 0003-Next-commit-of-the-IPA-v2-port-there-are-still-issue.patch.txt 0004-Fixed-the-issues-with-the-entry-size-by-reintroducin.patch.txt 0005-Rest-of-the-port-of-IPA-v2-and-compile-fixes-of-the-.patch.txt 0006-Add-devicetree-support-for-ipa-and-ipa_bam-and-enabl.patch.txt 0007-Rename-header-file.patch.txt 0008-Add-modem_route_count-to-IPA-v2-data.patch.txt 0009-Added-filter_support-true-to-two-channels-to-stop-IP.patch.txt 0010-This-bit-in-the-ROUTE-register-exists-only-for-IPA-v.patch.txt This does not belong here but I have it in my branch to avoid the cache errors 0011-Add-i-d-cache-size-properties-to-the-CPU-nodes-cache.patch.txt 0012-ipa_firmware_loader-can-handle-the-IPA-v2-case-witho.patch.txt These patches seem to initialize IPA v2 correctly on a fairphone-fp3 (running standard debian sid). There are still some issues appearing in dmesg (venus clk getting stuck at off, pclk0_clk_src: rcg didn't update its configuration. ) but these may have other causes. This patch fixes a hang on shutdown, that occured because IPA v2 does not have hashed tables. 0013-Hashed-tables-are-only-present-on-IPA-v3.patch.txt

z3ntu commented 1 year ago

@alikates ?

alikates commented 1 year ago

I don't have much time available until the end of june.

Btw i've seen the some of the patches but don't look like they will be accepted upstream. Also, @spasswolf please instead of erasing all previous development history, try to create fixup commits for the original code instead. That way we can better track what you changed and if something else needs to be discussed.

CC: @SirSireesh @Tooniis

spasswolf commented 1 year ago

I did not erase the history, instead I ignored it and did the patch by hand from a diff created by git diff 6.3.0/ipa origin/msm8953-6.1.0/ipa which resulted in much more work than cherry-picking the commits. Here is the cherry-picked version: 0001-TODO-net-ipa-Add-IPA-v2.-register-definitions.patch.txt 0002-net-ipa-Move-GSI-specific-functions-to-an-ops-struct.patch.txt 0003-net-ipa-Move-gsi_channel_tre_max-definition-to-gsi_p.patch.txt 0004-net-ipa-gsi.h-Rename-gsi-to-ipa_dma.patch.txt 0005-net-ipa-gsi_private.h-Rename-gsi-to-ipa_dma.patch.txt 0006-net-ipa-gsi_trans-Rename-gsi-to-ipa_dma.patch.txt 0007-net-ipa-Add-timeout-for-ipa_cmd_pipeline_clear_wait.patch.txt 0008-net-ipa-Add-support-for-using-BAM-as-a-DMA-transport.patch.txt 0009-TODO-net-ipa-Add-support-for-IPA-v2.x-commands-and-t.patch.txt 0010-FIXME-net-ipa-Add-support-for-IPA-v2.x-endpoints.patch.txt 0011-net-ipa-Add-support-for-IPA-v2.x-memory-map.patch.txt 0012-FIXME-net-ipa-Add-support-for-IPA-v2.x-in-the-driver.patch.txt 0013-net-ipa-Add-support-for-IPA-v2-microcontroller.patch.txt 0014-net-ipa-Add-IPA-v2.6L-initialization-sequence-suppor.patch.txt 0015-net-ipa-Add-support-for-IPA-v2-validation.patch.txt 0016-net-ipa-Add-hw-config-describing-IPA-v2.x-hardware.patch.txt 0017-net-ipa-Set-invalid-regions-for-2.6L-as-not-required.patch.txt 0018-net-ipa-Enable-support-for-IPA-v2.patch.txt 0019-dt-bindings-net-qcom-ipa-Add-support-for-MSM8953-and.patch.txt 0020-arm64-dts-qcom-msm8996-Add-IPA.patch.txt 0021-arm64-dts-qcom-msm8996-xiaomi-common-Enable-IPA.patch.txt 0022-WIP-net-ipa-Add-IPA-v2.-opcodes.patch.txt 0023-WIP-net-ipa-Skip-entire-unprocessed-packets-rather-t.patch.txt 0024-WIP-net-ipa-Remove-pad_align-from-IPA-v2.-AP_LAN_RX-.patch.txt 0025-arm64-dts-qcom-msm8953-add-IPA-and-IPA_BAM-nodes.patch.txt 0026-Enable-the-modem-on-the-fairphone-fp3.patch.txt 0027-Add-modem_route_count-to-IPA-v2-data.patch.txt The compile fixes in the next patch should probably be incorporated into the previous commits: 0028-This-is-a-patch-fixes-a-lot-of-compile-time-issues-a.patch.txt The interrupt code needs more work: 0029-This-extends-the-version-checks-in-ipa_interrupt.c-t.patch.txt This does not really belong here, but I want to avoid those warnings 0030-Add-i-d-cache-size-properties-to-the-CPU-nodes-cache.patch.txt 0031-Fixed-memory-initialisation.patch.txt Now ipa initializes but again it hangs when shutting down. This fixes the hang on shutdown (found that by using netconsole) 0001-This-fixes-a-NULL-pointer-dereference-which-caused-t.patch.txt

alikates commented 1 year ago

Thank you! Can you also add the commits to a branch and change the PR branch to it?

Tooniis commented 1 year ago

Wouldn't it be better to rebase on torvalds/master or even linux-next/master? 6.3.0 is already getting old.

spasswolf commented 1 year ago

linux-next/master is missing other things needed on msm8953, iommu, gpu_iommu, wlan (may or may not be related to iommu), display (at least for fairphone-fp3), compatible=qcom,msm8953-alt-mss-pil for modem. The last time I tried a vanilla kernel (6.3.0) on the fairphone-fp3 all that worked was booting and usb networking (via cdc_ether), so I could connect via ssh.

Edit: I'm currently doing a v3 for IPA v3 on 6.3.0, with the aim of getting all the compile fixes into the original commits.

spasswolf commented 1 year ago

Wouldn't it be better to rebase on torvalds/master or even linux-next/master? 6.3.0 is already getting old.

As getting the GPU to run on linux-next wasn't too difficult (details), I'll give IPA v2 on linux-next a try (this will need compatible=qcom,msm8953-alt-mss-pil for modem to test SMS functionality).

Edit: Wlan and modem seem to be ok, on to IPA ...

spasswolf commented 1 year ago

IPA v2 is now running on linux-next-20230616, modem is found and SMS works (calls probably too, if the fairphone-fp3 had working audio).

z3ntu commented 1 year ago

Does mobile data also work with that? I haven't had a look at the patches yet but would be nice if they could go upstream - or at least some more simple refactoring to make things easier for IPAv2

CC @alexelder (upstream IPA maintainer)

spasswolf commented 1 year ago

I've got a prepaid mobile connection which needs to be reloaded before I can test mobile data, so this will have to wait until tomorrow. For now I've created an issue to collect the patches: https://github.com/msm8953-mainline/linux/issues/107

Tooniis commented 1 year ago

Tested on msm8996. Connects to network and gets an IP address assigned but no data goes through, so nothing changed so far.

spasswolf commented 1 year ago

When I enable mobile data (which works in ubuntu touch) (by clicking a thing on the gnome panel ...) I get a network interface:

qmapmux0.0: flags=65<UP,RUNNING>  mtu 1496
        inet 10.211.0.224  netmask 255.255.255.192
        unspec 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00  txqueuelen 1000  (UNSPEC)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 94  bytes 6112 (5.9 KiB)
        TX errors 0  dropped 0 overruns 0  c

route shows (I disable WLAN for this test)

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         _gateway        0.0.0.0         UG    1050   0        0 qmapmux0.0
10.0.0.0        0.0.0.0         255.0.0.0       U     0      0        0 usb0
10.211.0.192    0.0.0.0         255.255.255.192 U     1050   0        0 qmapmux0.0

but I can't ping anything (always 100% packet loss) cat /proc/net/dev shows

Inter-|   Receive                                                |  Transmit
 face |bytes    packets errs drop fifo frame compressed multicast|bytes    packets errs drop fifo colls carrier compressed
    lo:   20610     227    0    0    0     0          0         0    20610     227    0    0    0     0       0          0
dummy0:       0       0    0    0    0     0          0         0        0       0    0    0    0     0       0          0
  sit0:       0       0    0    0    0     0          0         0        0       0    0    0    0     0       0          0
  usb0:  152846    2191    0    0    0     0          0         0   332812    2038    0    0    0     0       0          0
rmnet_ipa0:       0       0    0    0    0     0          0         0     8136     117    0   14    0     0       0          0
 wlan0:  162543     343    0    0    0     0          0         0    22499     189    0    0    0     0       0          0
qmapmux0.0:       0       0    0    0    0     0          0         0     7784     113    0    0    0     0       0          0

So qmapmux0.0 counts transmitted packets (from the ping attempts), but does not receive anything. Perhaps we need actual IPA routing functionality to use mobile data?

Edit: For comparison, this is the output of route in ubuntu touch with enable mobile data:

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         10.210.47.54    0.0.0.0         UG    700    0        0 rmnet_data0
10.210.47.54    *               255.255.255.255 UH    700    0        0 rmnet_data0

And this of cat /proc/net/dev:

$ cat /proc/net/dev
Inter-|   Receive                                                |  Transmit
 face |bytes    packets errs drop fifo frame compressed multicast|bytes    packets errs drop fifo colls carrier compressed
rmnet_data5:       0       0    0    0    0     0          0         0        0       0    0    0    0     0       0          0
rmnet_data2:       0       0    0    0    0     0          0         0        0       0    0    0    0     0       0          0
rmnet_data1: 172228238  181745    0    0    0     0          0         0 18468702  124897    0    0    0     0       0          0
ip6_vti0:       0       0    0    0    0     0          0         0        0       0    0    0    0     0       0          0
r_rmnet_data3:       0       0    0    0    0     0          0         0        0       0    0    0    0     0       0          0
ip_vti0:       0       0    0    0    0     0          0         0        0       0    0    0    0     0       0          0
r_rmnet_data4:       0       0    0    0    0     0          0         0        0       0    0    0    0     0       0          0
ip6tnl0:       0       0    0    0    0     0          0         0        0       0    0    0    0     0       0          0
rmnet_data0: 53983568   66037    0    0    0     0          0         0  7441745   53526    0    0    0     0       0          0
r_rmnet_data6:       0       0    0    0    0     0          0         0        0       0    0    0    0     0       0          0
r_rmnet_data5:       0       0    0    0    0     0          0         0        0       0    0    0    0     0       0          0
rmnet_data3:       0       0    0    0    0     0          0         0        0       0    0    0    0     0       0          0
rmnet_data7:       0       0    0    0    0     0          0         0        0       0    0    0    0     0       0          0
r_rmnet_data8:       0       0    0    0    0     0          0         0        0       0    0    0    0     0       0          0
dummy0:       0       0    0    0    0     0          0         0        0       0    0    0    0     0       0          0
r_rmnet_data0:       0       0    0    0    0     0          0         0        0       0    0    0    0     0       0          0
rmnet_data6:       0       0    0    0    0     0          0         0        0       0    0    0    0     0       0          0
rmnet_data4:       0       0    0    0    0     0          0         0        0       0    0    0    0     0       0          0
rmnet_ipa0: 229185190  120566    0    0    0     0          0         0 27337831  178423    0    0    0     0       0          0
r_rmnet_data1:       0       0    0    0    0     0          0         0        0       0    0    0    0     0       0          0
    lo:  967570   10811    0    0    0     0          0         0   967570   10811    0    0    0     0       0          0
  p2p0:       0       0    0    0    0     0          0         0        0       0    0    0    0     0       0          0
r_rmnet_data2:       0       0    0    0    0     0          0         0        0       0    0    0    0     0       0          0
 wlan0: 53574389   72970    0    0    0     0          0         0  7675045   50760    0    0    0     0       0          0
  sit0:       0       0    0    0    0     0          0         0        0       0    0    0    0     0       0          0
r_rmnet_data7:       0       0    0    0    0     0          0         0        0       0    0    0    0     0       0          0
barni2000 commented 7 months ago

I think it should be closed now because of ipa2-lite.