-
Notifications
You must be signed in to change notification settings - Fork 105
[linux-6.6.y]Loongarch driver fixes and backport #674
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
[linux-6.6.y]Loongarch driver fixes and backport #674
Conversation
ACPI HID for Loongson SE is "LOONG0011", for Loongson SDF is "LOON0012". And cleanned up coding style. Moved SE header file form arch/loongarch/include/asm to include/soc/loongson. Signed-off-by: Zhao Qunqin <[email protected]> Signed-off-by: Binbin Zhou <[email protected]>
commit 3784950 upstream. Loongson's HDA devices do not support TCSEL functionality. Signed-off-by: Qunqin Zhao <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Takashi Iwai <[email protected]> Signed-off-by: Binbin Zhou <[email protected]>
commit b62a030 upstream. SMT cores and their sibling cores share the same L1 and L2 private caches (of course last level cache is also shared), so correct the cacheinfo sharing information to let shared_cpu_map correctly reflect this relationship. Below is the output of "lscpu" on Loongson-3A6000 (4 cores, 8 threads). 1. Before patch: L1d: 512 KiB (8 instances) L1i: 512 KiB (8 instances) L2: 2 MiB (8 instances) L3: 16 MiB (1 instance) 2. After patch: L1d: 256 KiB (4 instances) L1i: 256 KiB (4 instances) L2: 1 MiB (4 instances) L3: 16 MiB (1 instance) Reported-by: Chao Li <[email protected]> Signed-off-by: Juxin Gao <[email protected]> Signed-off-by: Huacai Chen <[email protected]> Signed-off-by: Binbin Zhou <[email protected]>
When CONFIG_CMA_SIZE_MBYTES is not zero and its value is small, error log appear in dmesg as following: [12689.920994][ T2178] cma: cma_alloc: reserved: alloc failed, req-size: 4 pages, ret: -12 [12689.934128][ T2178] cma: cma_alloc: reserved: alloc failed, req-size: 4 pages, ret: -12 So set CONFIG_CMA_SIZE_MBYTES to 0 to hide the error log. Signed-off-by: Ming Wang <[email protected]> Signed-off-by: Hongchen Zhang <[email protected]> Signed-off-by: Binbin Zhou <[email protected]>
new_rcp->recipe_bitmap was written to as if it were an aligned bitmap. It is an 8-byte array, but aligned only to 4. Use put_unaligned to set its value. Additionally, values in ice commands are typically in little-endian. I assume the recipe bitmap should be too, so use the *_le64 conversion. I don't have a big-endian system with ice to test this. I tested that the driver does not crash when probing on aarch64 anymore, which is good enough for me. I don't know if the LAG feature actually works. This is what the crash looked like without the fix: [ 17.599009] Unable to handle kernel paging request at virtual address ffff07ff9c6dc004 [ 17.599011] Mem abort info: [ 17.599011] ESR = 0x0000000096000021 [ 17.599012] EC = 0x25: DABT (current EL), IL = 32 bits [ 17.599013] SET = 0, FnV = 0 [ 17.599014] EA = 0, S1PTW = 0 [ 17.599014] FSC = 0x21: alignment fault [ 17.599015] Data abort info: [ 17.599016] ISV = 0, ISS = 0x00000021, ISS2 = 0x00000000 [ 17.599016] CM = 0, WnR = 0, TnD = 0, TagAccess = 0 [ 17.599017] GCS = 0, Overlay = 0, DirtyBit = 0, Xs = 0 [ 17.599019] swapper pgtable: 4k pages, 48-bit VAs, pgdp=0000080dd6bd0000 [ 17.599020] [ffff07ff9c6dc004] pgd=1800083fffacf003, p4d=1800083fffacf003, pud=1800083ffface003, pmd=1800083fff9ea003, pte=006808001c6dcf07 [ 17.599025] Internal error: Oops: 0000000096000021 [deepin-community#1] SMP [ 17.599027] Modules linked in: crct10dif_ce ghash_ce sha2_ce sha256_arm64 mlx5_core sha1_ce sbsa_gwdt ice(+) nvme nvme_core mlxfw igb tls nvme_common psample i2c_algo_bit gnss pci_hyperv_intf i2c_designware_platform i2c_designware_core xgene_hwmon dm_mirror dm_region_hash dm_log dm_mod [ 17.599043] CPU: 0 PID: 18 Comm: kworker/0:1 Not tainted 5.14.0-407.el9.aarch64 deepin-community#1 [ 17.599044] Hardware name: GIGABYTE R272-P31-00/MP32-AR1-00, BIOS F31L (SCP: 2.10.20220531) 09/29/2022 [ 17.599046] Workqueue: events work_for_cpu_fn [ 17.599051] pstate: 60400009 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--) [ 17.599053] pc : ice_create_lag_recipe.constprop.0+0xbc/0x11c [ice] [ 17.599091] lr : ice_create_lag_recipe.constprop.0+0x54/0x11c [ice] [ 17.599121] sp : ffff8000084a3c50 [ 17.599122] x29: ffff8000084a3c50 x28: ffffabc4a6790f00 x27: ffffabc4a6200fa0 [ 17.599124] x26: ffff07ff809e5c34 x25: ffff083e5f41980d x24: ffff07ff8610a0c0 [ 17.599126] x23: 0000000000000000 x22: ffff07ff9fe894c0 x21: ffff07ffb771a460 [ 17.599128] x20: ffff07ff9c6dc000 x19: 0000000000000000 x18: 0000000000000014 [ 17.599130] x17: 00000000c3142fa2 x16: 000000007e77e163 x15: 0000000018c66856 [ 17.599132] x14: 00000000b8afd426 x13: 000000007e8b3b19 x12: 000000004a34fdf7 [ 17.599134] x11: 00000000a7cb2fcc x10: 00000000ffffff8a x9 : 0000000000000000 [ 17.599136] x8 : 0000002000000005 x7 : 0000000000000001 x6 : ffffabc487a054d8 [ 17.599138] x5 : ffff07ff9c6dc004 x4 : 000000000000000a x3 : 0000000000000000 [ 17.599140] x2 : 0000000000000000 x1 : 0000000000000400 x0 : ffff07ff9c6dc004 [ 17.599142] Call trace: [ 17.599143] ice_create_lag_recipe.constprop.0+0xbc/0x11c [ice] [ 17.599172] ice_init_lag+0xcc/0x22c [ice] [ 17.599201] ice_init_features+0x160/0x2b4 [ice] [ 17.599230] ice_probe+0x2d0/0x30c [ice] [ 17.599258] local_pci_probe+0x58/0xb0 [ 17.599262] work_for_cpu_fn+0x20/0x30 [ 17.599264] process_one_work+0x1e4/0x4c0 [ 17.599266] worker_thread+0x220/0x450 [ 17.599268] kthread+0xe8/0xf4 [ 17.599270] ret_from_fork+0x10/0x20 [ 17.599273] Code: 380044a4 f800429f 8b000ca0 d503201f (f821301f) [ 17.599274] ---[ end trace 168d79e2ecf9f7e3 ]--- [ 17.599275] Kernel panic - not syncing: Oops: Fatal exception [ 17.893321] SMP: stopping secondary CPUs [ 17.897374] Kernel Offset: 0x2bc49c400000 from 0xffff800008000000 [ 17.903453] PHYS_OFFSET: 0x80000000 [ 17.906928] CPU features: 0x0,00000001,70028143,1041720b [ 17.912226] Memory Limit: none [ 17.915268] ---[ end Kernel panic - not syncing: Oops: Fatal exception ]--- Link: https://lore.kernel.org/all/[email protected]/ Fixes: 1e0f988 ("ice: Flesh out implementation of support for SRIOV on bonded interface") Signed-off-by: Michal Schmidt <[email protected]> Signed-off-by: Hongchen Zhang <[email protected]> Signed-off-by: Binbin Zhou <[email protected]>
There are suspend, resume and suspend before hibernation, Loongson need to wait until the previous resume is completely over before the last suspending. Otherwise, it may cause S4 suspend failure in Loongson platform. Signed-off-by: Zhao Qunqin <[email protected]> Signed-off-by: Binbin Zhou <[email protected]>
Reviewer's Guide by SourceryThis pull request includes several driver fixes and backports for the Loongarch architecture. It introduces ACPI support for the Loongson SE driver, backports changes from upstream, and addresses driver-related issues. The changes span across different drivers including Sequence diagram for sending a request to the SEsequenceDiagram
participant CPU
participant loongson_se
participant sub-dev
CPU->>loongson_se: se_send_request(req)
activate loongson_se
loongson_se->>loongson_se: se_writel(req->u.data[i], SE_DATA_S + i * 4)
loongson_se->>loongson_se: se_writel(req->int_bit, SE_L2SINT_SET)
loop until status & req->int_bit
loongson_se->>loongson_se: readl_relaxed_poll_timeout_atomic
end
loongson_se->>sub-dev: Command
deactivate loongson_se
Sequence diagram for receiving a response from the SEsequenceDiagram
participant CPU
participant loongson_se
participant sub-dev
CPU->>loongson_se: se_get_response(res)
activate loongson_se
alt se_readl(SE_S2LINT_STAT) & res->int_bit
loop i < ARRAY_SIZE(res->u.data)
loongson_se->>loongson_se: res->u.data[i] = se_readl(SE_DATA_L + i * 4)
end
loongson_se->>loongson_se: se_writel(res->int_bit, SE_S2LINT_CL)
loongson_se-->>CPU: Response
else Interrupt not received
loongson_se-->>CPU: -EBUSY
end
deactivate loongson_se
Updated class diagram for loongson_se and lsse_chclassDiagram
class loongson_se {
-void *base
-dma_addr_t mem_addr
-unsigned long *mem_map
-int mem_map_pages
-void *smsg
-void *rmsg
-struct completion cmd_completion
-struct lsse_ch chs[SE_CH_MAX]
}
class lsse_ch {
-struct loongson_se *se
-int id
-u32 int_bit
-void *data_buffer
-dma_addr_t data_addr
-int data_size
-void *smsg
-void *rmsg
-int msg_size
-void (*complete)(struct lsse_ch *se_ch)
-void *priv
}
loongson_se -- lsse_ch : contains
note for loongson_se "Represents the Loongson SE device and its resources."
note for lsse_ch "Represents a channel within the Loongson SE device."
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Hi @AaronDot. Thanks for your PR. I'm waiting for a deepin-community member to verify that this patch is reasonable to test. If it is, they should reply with Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @AaronDot - I've reviewed your changes - here's some feedback:
Overall Comments:
- It looks like the driver is being converted to use standard kernel conventions, which is good.
- Consider using devm_bitmap_alloc instead of bitmap_zalloc to have the bitmap automatically freed on driver removal.
Here's what I looked at during the review
- 🟡 General issues: 3 issues found
- 🟢 Security: all looks good
- 🟢 Testing: all looks good
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
| * DMA | | IRQ | ||
| * v v | ||
| * +-----------------------------------+ | ||
| * | Loongson Security Module | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question (performance): Revisit the use of HZ for timeout.
Switching from msecs_to_jiffies(0x1000) (approximately 1000ms) to HZ may yield a different timeout duration on some platforms. Confirm that this shorter timeout is intentional and sufficient for the SE command completion.
| int err; | ||
|
|
||
| spin_lock_irqsave(&se->se_ch->ch_lock, flag); | ||
| spin_lock_irq(&se->se_ch->ch_lock); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question (bug_risk): Use of spin_lock_irq without saving flags.
Switching to spin_lock_irq may be acceptable if it is guaranteed that the calling context already has appropriate interrupt settings. Confirm that IRQ state restoration is not needed in this context.
| #ifdef CONFIG_LOONGARCH | ||
| mdelay(1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
question (performance): Added delay in btusb suspend on Loongarch.
The 1ms delay introduced for Loongarch platforms appears intended to allow hardware settling. Confirm that this delay is sufficient and does not adversely affect system suspend latency across all targeted devices.
|
/ok-to-test |
|
1.drivers/char: add ACPI firmware support for Loongson SE driver |
1fbe04f
into
deepin-community:linux-6.6.y
deepin pr auto review代码审查意见:
以上是代码审查意见,希望能够帮助到您。 |
Introduction to the patchset:
Patch-1: ACPI support for LoongArch SE driver, which was an absence from the previous patchset.
Patch 2-3: backported from upstream
Patch 4-6: related driver fixes