[linux-6.6.y] LoongArch Stage Patch Synchronization 260727#2018
[linux-6.6.y] LoongArch Stage Patch Synchronization 260727#2018AaronDot wants to merge 9 commits into
Conversation
commit 90fa028 upstream. Convert the uio_pdrv_genirq driver to use the device_property_* APIs instead of the of_property_* ones. This allows UIO interrupts to be defined via an ACPI overlay using the Device Tree namespace linkage. Signed-off-by: Chris Packham <chris.packham@alliedtelesis.co.nz> Link: https://lore.kernel.org/r/20240408234050.2056374-2-chris.packham@alliedtelesis.co.nz Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
commit 018e982 upstram. When hardware page table walker (PTW) is enabled on LoongArch, the CPU may set _PAGE_DIRTY directly in the page table entry during a write TLB miss, without going through the software TLB store handler. The software TLB store handler (tlbex.S:254) sets both _PAGE_DIRTY and_PAGE_MODIFIED together: ori t0, t0, (_PAGE_VALID | _PAGE_DIRTY | _PAGE_MODIFIED) Since hardware PTW only sets _PAGE_DIRTY, the software-only bit, i.e. _PAGE_MODIFIED is left unchanged. This creates a window where a PTE has _PAGE_DIRTY set (hardware knows the page is dirty) but _PAGE_MODIFIED clear (software is unaware). When fork()/clone() triggers copy-on-write, __copy_present_ptes() calls pte_wrprotect(), which unconditionally clears both the _PAGE_WRITE and _PAGE_DIRTY bits: pte_val(pte) &= ~(_PAGE_WRITE | _PAGE_DIRTY); Since _PAGE_MODIFIED was never set, the dirtiness information is lost completely. Subsequently, when memory pressure triggers page reclaim, page_mkclean() / try_to_unmap() sees the page as clean (i.e. pte_dirty() returns false) and the page may be freed without writeback, causing data corruption. Fix this by propagating the _PAGE_DIRTY bit to the _PAGE_MODIFIED bit in both pte_wrprotect() and pmd_wrprotect() before clearing writeable bits: if (pte_val(pte) & _PAGE_DIRTY) pte_val(pte) |= _PAGE_MODIFIED; The pmd_wrprotect() fix handles the CONFIG_TRANSPARENT_HUGEPAGE case, where pmd entries need the same treatment. This ensures the software dirty tracking bit (checked by pte_dirty() and pmd_dirty(), which read both the _PAGE_DIRTY and _PAGE_MODIFIED bits) is preserved across fork COW write-protection. The issue was found by the LTP madvise09 test case, which exercises page reclaim after "madvise(MADV_FREE), write and fork" operation sequence on private anonymous mappings. Cc: stable@vger.kernel.org Fixes: 09cfefb ("LoongArch: Add memory management") Co-developed-by: Tianyang Zhang <zhangtianyang@loongson.cn> Signed-off-by: Tianyang Zhang <zhangtianyang@loongson.cn> Signed-off-by: Hongchen Zhang <zhanghongchen@loongson.cn> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn> Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
On Loongson LS7A1000/LS7A2000 bridge chipsets, the system may hang at the boot screen (e.g. Kylin logo) due to a deadlock in the HT non-posted (NONPOST) channel. The root cause is a SEQ ID collision: when the CPU issues both SATA register reads and heavy framebuffer writes, they can be assigned the same sequence ID in the NONPOST channel. If the SATA controller concurrently has pending DMA write requests, it can probabilistically block the non-posted channel, creating a deadlock between the two transaction streams. Fix this by adding a PCI final quirk that programs the GPU device BAR base address and mask into chipset registers (0xefdfb000174/170), ensuring proper DMA window configuration and avoiding the deadlock condition. Signed-off-by: Baoqi Zhang <zhangbaoqi@loongson.cn> Signed-off-by: Hongchen Zhang <zhanghongchen@loongson.cn> Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
…r key
init_timer_key() was called with a NULL lock_class_key, which
triggers DEBUG_LOCKS_WARN_ON(!key) in lockdep_init_map_type
when CONFIG_LOCKDEP is enabled.
Fix by providing a local static lock_class_key via init_timer_key()
for kernel >= 4.15, so the custom timer name 'fuxi_phy_link_update_timer'
is preserved; keep the old code path for < 4.15 unchanged.
Fixes: 11c878908ad9 ("net: update yt6801 driver")
Signed-off-by: Xianglai Li <lixianglai@loongson.cn>
Signed-off-by: Hongchen Zhang <zhanghongchen@loongson.cn>
Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
The hwmon_attr.dev_attr struct attribute is dynamically allocated,
so its lockdep key is neither static nor registered via
lockdep_register_key().
lockdep_init_map_type() checks:
!static_obj(lock->key) && !is_dynamic_key(lock->key)
and triggers DEBUG_LOCKS_WARN_ON(1) because both conditions are true.
Fix by calling sysfs_attr_init() before device_create_file() to
point the attribute's key to a static struct lock_class_key.
Fixes: d07bd4fa0db8 ("net: wangxun: Update driver to version 1.3.6.4")
Signed-off-by: Hongchen Zhang <zhanghongchen@loongson.cn>
Signed-off-by: Xianglai Li <lixianglai@loongson.cn>
Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
…tion Add a barrier instruction to ensure data consistency between the CPU and DMA; tests have proven that it can effectively eliminate some sporadic data errors. Signed-off-by: zhangtianyang <zhangtianyang@loongson.cn> Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
Due to a hardware defect, for PCI devices with a reversion ID of 2, the pin sense status must be determined via the ELD. Signed-off-by: Baoqi Zhang <zhangbaoqi@loongson.cn> Signed-off-by: Haowei Zheng <zhenghaowei@loongson.cn> Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
The TPM device (/dev/tpm0) is not created in virtual machines due to CONFIG_TCG_TIS_CORE being built as a module (m) and CONFIG_TCG_TIS being disabled. This resolves the issue of missing /dev/tpm0 in VM environments. Signed-off-by: zhuyunfei <zhuyunfei@loongson.cn> Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
Fix the issue of below: sudo cryptsetup open /dev/sda mydata device-mapper: ioctl: error adding target to table device-mapper: table: 253:0: crypt: Error allocating crypto tfm (-ENOENT) device-mapper: ioctl: error adding target to table Signed-off-by: wanghongliang <wanghongliang@loongson.cn> Signed-off-by: Binbin Zhou <zhoubinbin@loongson.cn>
|
🧙 Sourcery has finished reviewing your pull request! 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.
Hey - I've left some high level feedback:
- In loongson_display_quirk(), consider replacing the hard-coded MMIO addresses (0xefdfb000174/170) with named constants or documented macros and double-checking the BAR size/mask computation (end - start vs end - start + 1) to avoid subtle off-by-one issues when programming the mask.
- In uio_pdrv_genirq_probe(), dev_fwnode(&pdev->dev) can be NULL; using "%pfwP" on a NULL fwnode may produce an unhelpful name, so it would be safer to fall back to dev_name(&pdev->dev) or a static string when node is missing.
- In fxgmac_phy_timer_init(), init_timer_key() is now passed fxgmac_phy_link_poll, but the code still overrides phy_poll_tm.function later with a casted (void *) callback; it would be cleaner and less error-prone either to rely solely on init_timer_key() for the function or to drop the function parameter there to avoid redundant and inconsistent setup.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- In loongson_display_quirk(), consider replacing the hard-coded MMIO addresses (0xefdfb000174/170) with named constants or documented macros and double-checking the BAR size/mask computation (end - start vs end - start + 1) to avoid subtle off-by-one issues when programming the mask.
- In uio_pdrv_genirq_probe(), dev_fwnode(&pdev->dev) can be NULL; using "%pfwP" on a NULL fwnode may produce an unhelpful name, so it would be safer to fall back to dev_name(&pdev->dev) or a static string when node is missing.
- In fxgmac_phy_timer_init(), init_timer_key() is now passed fxgmac_phy_link_poll, but the code still overrides phy_poll_tm.function later with a casted (void *) callback; it would be cleaner and less error-prone either to rely solely on init_timer_key() for the function or to drop the function parameter there to avoid redundant and inconsistent setup.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
There was a problem hiding this comment.
Pull request overview
Synchronizes a set of LoongArch-focused fixes and config updates against the linux-6.6.y tree, including platform quirks (GPU/audio), low-level memory-management fixes, and several driver correctness/lockdep cleanups.
Changes:
- Add Loongson HDMI codec quirks (disable 44.1kHz rates; enable ELD-based jack detection on affected revisions) and plumb ELD-based presence into generic HDA pin-sense handling.
- Add/extend LoongArch PCI display quirks, fix LoongArch page-table write-protect handling, and add a LoongArch barrier in megaraid fusion completion.
- Fix driver lockdep warnings (txgbe sysfs attrs, yt6801 timer lock class) and refresh LoongArch defconfigs.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| sound/pci/hda/patch_hdmi.c | Adds a Loongson HDMI codec patch hook and enables ELD-based jack detection on specific PCI revisions. |
| sound/pci/hda/hda_jack.c | Adjusts generic HDA pin-sense presence handling to optionally derive presence from ELD validity. |
| include/sound/hda_codec.h | Introduces a codec flag to select ELD-based jack detection behavior. |
| drivers/uio/uio_pdrv_genirq.c | Refactors UIO genirq probe path to use firmware-node + device-property APIs. |
| drivers/scsi/megaraid/megaraid_sas_fusion.c | Adds a LoongArch read barrier before reading SMID from reply descriptors. |
| drivers/net/ethernet/wangxun/txgbe/txgbe_sysfs.c | Initializes sysfs attributes before device_create_file() to address lockdep expectations. |
| drivers/net/ethernet/motorcomm/yt6801/fuxi-gmac-phy.c | Updates timer initialization with a dedicated lock class key and callback. |
| arch/loongarch/pci/pci.c | Adds a display-class quirk path for Loongson GPUs (register programming based on BAR sizing/topology). |
| arch/loongarch/include/asm/pgtable.h | Preserves “modified” state when write-protecting dirty PTE/PMD entries. |
| arch/loongarch/configs/loongson3_defconfig | Enables TPM TIS core/TIS built-in and CRYPTO_XTS. |
| arch/loongarch/configs/deepin_loongarch_desktop_defconfig | Enables TPM TIS core/TIS built-in and CRYPTO_XTS. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| /* | ||
| * Due to a hardware defect, for PCI devices with a reversion ID | ||
| * of 2, the pin sense status must be determined via the ELD. | ||
| */ |
| if (codec->bus && codec->bus->pci->revision == 0x2) | ||
| codec->eld_jack_detect = 1; |
| #include <linux/init.h> | ||
| #include <linux/slab.h> | ||
| #include <linux/export.h> | ||
| #include <linux/pci.h> | ||
| #include <sound/core.h> | ||
| #include <sound/control.h> | ||
| #include <sound/jack.h> |
| if (codec->eld_jack_detect) { | ||
| val &= ~AC_PINSENSE_PRESENCE; | ||
| val |= !!(val & AC_PINSENSE_ELDV) << 31; | ||
| } |
| #ifdef CONFIG_LOONGARCH | ||
| __smp_rmb(); | ||
| #endif |
| pdata->expansion.phy_poll_tm.expires = jiffies + HZ / 2; | ||
| pdata->expansion.phy_poll_tm.function = (void *)(fxgmac_phy_link_poll); |
| if (!dev->bus->number) { | ||
| if (!(dev->vendor == PCI_VENDOR_ID_LOONGSON && | ||
| (dev->device == 0x7a15 || dev->device == 0x7a25))) | ||
| return; | ||
| } else { | ||
| while (!pci_is_root_bus(bus->parent)) | ||
| bus = bus->parent; | ||
|
|
||
| /* ensure slot is 7a2000 */ | ||
| if (bus->self->vendor != PCI_VENDOR_ID_LOONGSON || | ||
| bus->self->device < 0x7a39) | ||
| return; | ||
| } |
| max_size = 0; | ||
| for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) { | ||
| if (dev->resource[i].flags & IORESOURCE_MEM) { | ||
| size = dev->resource[i].end - dev->resource[i].start; | ||
| if (size > max_size) { | ||
| max_size = size; | ||
| num = i; | ||
| } | ||
| } | ||
| } | ||
|
|
||
| mask = ~(dev->resource[num].end - dev->resource[num].start); |
Introduction to the patchset:
Patch 1-2: backported from upstream;
Patch 3: Fix LS7A GPU access hang;
Patch 4-5: Fix lockdep WARN in wangxun and yt6801;
Patch 6: Add a barrier to avoid get invalid smid;
Patch 7: Fix Loongson hda sound pin sense status;
Patch 8-9: Update loongarch configs.
Summary by Sourcery
Synchronize LoongArch-specific fixes and config updates, addressing GPU, audio, storage, and networking issues while improving generic device-tree handling on LoongArch.
Bug Fixes:
Enhancements:
Chores: