Merge tag 'char-misc-5.11-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc

Pull char/misc driver fixes from Greg KH:
"Here are some small char/misc driver fixes for 5.11-rc5:

- habanalabs driver fixes

- phy driver fixes

- hwtracing driver fixes

- rtsx cardreader driver fix

All of these have been in linux-next with no reported issues"

* tag 'char-misc-5.11-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc:
misc: rtsx: init value of aspm_enabled
habanalabs: disable FW events on device removal
habanalabs: fix backward compatibility of idle check
habanalabs: zero pci counters packet before submit to FW
intel_th: pci: Add Alder Lake-P support
stm class: Fix module init return on allocation failure
habanalabs: prevent soft lockup during unmap
habanalabs: fix reset process in case of failures
habanalabs: fix dma_addr passed to dma_mmap_coherent
phy: mediatek: allow compile-testing the dsi phy
phy: cpcap-usb: Fix warning for missing regulator_disable
PHY: Ingenic: fix unconditional build of phy-ingenic-usb

Changed files
+75 -21
drivers
hwtracing
intel_th
stm
misc
phy
ingenic
mediatek
motorola
+5
drivers/hwtracing/intel_th/pci.c
··· 269 269 .driver_data = (kernel_ulong_t)&intel_th_2x, 270 270 }, 271 271 { 272 + /* Alder Lake-P */ 273 + PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x51a6), 274 + .driver_data = (kernel_ulong_t)&intel_th_2x, 275 + }, 276 + { 272 277 /* Alder Lake CPU */ 273 278 PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x466f), 274 279 .driver_data = (kernel_ulong_t)&intel_th_2x,
+4 -2
drivers/hwtracing/stm/heartbeat.c
··· 64 64 65 65 static int stm_heartbeat_init(void) 66 66 { 67 - int i, ret = -ENOMEM; 67 + int i, ret; 68 68 69 69 if (nr_devs < 0 || nr_devs > STM_HEARTBEAT_MAX) 70 70 return -EINVAL; ··· 72 72 for (i = 0; i < nr_devs; i++) { 73 73 stm_heartbeat[i].data.name = 74 74 kasprintf(GFP_KERNEL, "heartbeat.%d", i); 75 - if (!stm_heartbeat[i].data.name) 75 + if (!stm_heartbeat[i].data.name) { 76 + ret = -ENOMEM; 76 77 goto fail_unregister; 78 + } 77 79 78 80 stm_heartbeat[i].data.nr_chans = 1; 79 81 stm_heartbeat[i].data.link = stm_heartbeat_link;
+6 -1
drivers/misc/cardreader/rtsx_pcr.c
··· 1512 1512 struct pcr_handle *handle; 1513 1513 u32 base, len; 1514 1514 int ret, i, bar = 0; 1515 + u8 val; 1515 1516 1516 1517 dev_dbg(&(pcidev->dev), 1517 1518 ": Realtek PCI-E Card Reader found at %s [%04x:%04x] (rev %x)\n", ··· 1578 1577 pcr->host_cmds_addr = pcr->rtsx_resv_buf_addr; 1579 1578 pcr->host_sg_tbl_ptr = pcr->rtsx_resv_buf + HOST_CMDS_BUF_LEN; 1580 1579 pcr->host_sg_tbl_addr = pcr->rtsx_resv_buf_addr + HOST_CMDS_BUF_LEN; 1581 - 1580 + rtsx_pci_read_register(pcr, ASPM_FORCE_CTL, &val); 1581 + if (val & FORCE_ASPM_CTL0 && val & FORCE_ASPM_CTL1) 1582 + pcr->aspm_enabled = false; 1583 + else 1584 + pcr->aspm_enabled = true; 1582 1585 pcr->card_inserted = 0; 1583 1586 pcr->card_removed = 0; 1584 1587 INIT_DELAYED_WORK(&pcr->carddet_work, rtsx_pci_card_detect);
+10 -1
drivers/misc/habanalabs/common/device.c
··· 1037 1037 1038 1038 if (hard_reset) { 1039 1039 /* Release kernel context */ 1040 - if (hl_ctx_put(hdev->kernel_ctx) == 1) 1040 + if (hdev->kernel_ctx && hl_ctx_put(hdev->kernel_ctx) == 1) 1041 1041 hdev->kernel_ctx = NULL; 1042 1042 hl_vm_fini(hdev); 1043 1043 hl_mmu_fini(hdev); ··· 1486 1486 return; 1487 1487 } 1488 1488 } 1489 + 1490 + /* Disable PCI access from device F/W so it won't send us additional 1491 + * interrupts. We disable MSI/MSI-X at the halt_engines function and we 1492 + * can't have the F/W sending us interrupts after that. We need to 1493 + * disable the access here because if the device is marked disable, the 1494 + * message won't be send. Also, in case of heartbeat, the device CPU is 1495 + * marked as disable so this message won't be sent 1496 + */ 1497 + hl_fw_send_pci_access_msg(hdev, CPUCP_PACKET_DISABLE_PCI_ACCESS); 1489 1498 1490 1499 /* Mark device as disabled */ 1491 1500 hdev->disabled = true;
+5
drivers/misc/habanalabs/common/firmware_if.c
··· 402 402 } 403 403 counters->rx_throughput = result; 404 404 405 + memset(&pkt, 0, sizeof(pkt)); 406 + pkt.ctl = cpu_to_le32(CPUCP_PACKET_PCIE_THROUGHPUT_GET << 407 + CPUCP_PKT_CTL_OPCODE_SHIFT); 408 + 405 409 /* Fetch PCI tx counter */ 406 410 pkt.index = cpu_to_le32(cpucp_pcie_throughput_tx); 407 411 rc = hdev->asic_funcs->send_cpu_message(hdev, (u32 *) &pkt, sizeof(pkt), ··· 418 414 counters->tx_throughput = result; 419 415 420 416 /* Fetch PCI replay counter */ 417 + memset(&pkt, 0, sizeof(pkt)); 421 418 pkt.ctl = cpu_to_le32(CPUCP_PACKET_PCIE_REPLAY_CNT_GET << 422 419 CPUCP_PKT_CTL_OPCODE_SHIFT); 423 420
+1
drivers/misc/habanalabs/common/habanalabs.h
··· 2182 2182 int hl_mmu_va_to_pa(struct hl_ctx *ctx, u64 virt_addr, u64 *phys_addr); 2183 2183 int hl_mmu_get_tlb_info(struct hl_ctx *ctx, u64 virt_addr, 2184 2184 struct hl_mmu_hop_info *hops); 2185 + bool hl_is_dram_va(struct hl_device *hdev, u64 virt_addr); 2185 2186 2186 2187 int hl_fw_load_fw_to_device(struct hl_device *hdev, const char *fw_name, 2187 2188 void __iomem *dst, u32 src_offset, u32 size);
+2
drivers/misc/habanalabs/common/habanalabs_ioctl.c
··· 133 133 134 134 hw_idle.is_idle = hdev->asic_funcs->is_device_idle(hdev, 135 135 &hw_idle.busy_engines_mask_ext, NULL); 136 + hw_idle.busy_engines_mask = 137 + lower_32_bits(hw_idle.busy_engines_mask_ext); 136 138 137 139 return copy_to_user(out, &hw_idle, 138 140 min((size_t) max_size, sizeof(hw_idle))) ? -EFAULT : 0;
+8 -2
drivers/misc/habanalabs/common/memory.c
··· 886 886 { 887 887 struct hl_device *hdev = ctx->hdev; 888 888 u64 next_vaddr, i; 889 + bool is_host_addr; 889 890 u32 page_size; 890 891 892 + is_host_addr = !hl_is_dram_va(hdev, vaddr); 891 893 page_size = phys_pg_pack->page_size; 892 894 next_vaddr = vaddr; 893 895 ··· 902 900 /* 903 901 * unmapping on Palladium can be really long, so avoid a CPU 904 902 * soft lockup bug by sleeping a little between unmapping pages 903 + * 904 + * In addition, when unmapping host memory we pass through 905 + * the Linux kernel to unpin the pages and that takes a long 906 + * time. Therefore, sleep every 32K pages to avoid soft lockup 905 907 */ 906 - if (hdev->pldm) 907 - usleep_range(500, 1000); 908 + if (hdev->pldm || (is_host_addr && (i & 0x7FFF) == 0)) 909 + usleep_range(50, 200); 908 910 } 909 911 } 910 912
+3 -3
drivers/misc/habanalabs/common/mmu.c
··· 9 9 10 10 #include "habanalabs.h" 11 11 12 - static bool is_dram_va(struct hl_device *hdev, u64 virt_addr) 12 + bool hl_is_dram_va(struct hl_device *hdev, u64 virt_addr) 13 13 { 14 14 struct asic_fixed_properties *prop = &hdev->asic_prop; 15 15 ··· 156 156 if (!hdev->mmu_enable) 157 157 return 0; 158 158 159 - is_dram_addr = is_dram_va(hdev, virt_addr); 159 + is_dram_addr = hl_is_dram_va(hdev, virt_addr); 160 160 161 161 if (is_dram_addr) 162 162 mmu_prop = &prop->dmmu; ··· 236 236 if (!hdev->mmu_enable) 237 237 return 0; 238 238 239 - is_dram_addr = is_dram_va(hdev, virt_addr); 239 + is_dram_addr = hl_is_dram_va(hdev, virt_addr); 240 240 241 241 if (is_dram_addr) 242 242 mmu_prop = &prop->dmmu;
+10 -2
drivers/misc/habanalabs/common/mmu_v1.c
··· 467 467 { 468 468 /* MMU H/W fini was already done in device hw_fini() */ 469 469 470 - kvfree(hdev->mmu_priv.dr.mmu_shadow_hop0); 471 - gen_pool_destroy(hdev->mmu_priv.dr.mmu_pgt_pool); 470 + if (!ZERO_OR_NULL_PTR(hdev->mmu_priv.hr.mmu_shadow_hop0)) { 471 + kvfree(hdev->mmu_priv.dr.mmu_shadow_hop0); 472 + gen_pool_destroy(hdev->mmu_priv.dr.mmu_pgt_pool); 473 + } 474 + 475 + /* Make sure that if we arrive here again without init was called we 476 + * won't cause kernel panic. This can happen for example if we fail 477 + * during hard reset code at certain points 478 + */ 479 + hdev->mmu_priv.dr.mmu_shadow_hop0 = NULL; 472 480 } 473 481 474 482 /**
+2 -1
drivers/misc/habanalabs/gaudi/gaudi.c
··· 4002 4002 vma->vm_flags |= VM_IO | VM_PFNMAP | VM_DONTEXPAND | VM_DONTDUMP | 4003 4003 VM_DONTCOPY | VM_NORESERVE; 4004 4004 4005 - rc = dma_mmap_coherent(hdev->dev, vma, cpu_addr, dma_addr, size); 4005 + rc = dma_mmap_coherent(hdev->dev, vma, cpu_addr, 4006 + (dma_addr - HOST_PHYS_BASE), size); 4006 4007 if (rc) 4007 4008 dev_err(hdev->dev, "dma_mmap_coherent error %d", rc); 4008 4009
+2 -1
drivers/misc/habanalabs/goya/goya.c
··· 2719 2719 vma->vm_flags |= VM_IO | VM_PFNMAP | VM_DONTEXPAND | VM_DONTDUMP | 2720 2720 VM_DONTCOPY | VM_NORESERVE; 2721 2721 2722 - rc = dma_mmap_coherent(hdev->dev, vma, cpu_addr, dma_addr, size); 2722 + rc = dma_mmap_coherent(hdev->dev, vma, cpu_addr, 2723 + (dma_addr - HOST_PHYS_BASE), size); 2723 2724 if (rc) 2724 2725 dev_err(hdev->dev, "dma_mmap_coherent error %d", rc); 2725 2726
+1 -1
drivers/phy/ingenic/Makefile
··· 1 1 # SPDX-License-Identifier: GPL-2.0 2 - obj-y += phy-ingenic-usb.o 2 + obj-$(CONFIG_PHY_INGENIC_USB) += phy-ingenic-usb.o
+3 -1
drivers/phy/mediatek/Kconfig
··· 49 49 50 50 config PHY_MTK_MIPI_DSI 51 51 tristate "MediaTek MIPI-DSI Driver" 52 - depends on ARCH_MEDIATEK && OF 52 + depends on ARCH_MEDIATEK || COMPILE_TEST 53 + depends on COMMON_CLK 54 + depends on OF 53 55 select GENERIC_PHY 54 56 help 55 57 Support MIPI DSI for Mediatek SoCs.
+13 -6
drivers/phy/motorola/phy-cpcap-usb.c
··· 662 662 generic_phy = devm_phy_create(ddata->dev, NULL, &ops); 663 663 if (IS_ERR(generic_phy)) { 664 664 error = PTR_ERR(generic_phy); 665 - return PTR_ERR(generic_phy); 665 + goto out_reg_disable; 666 666 } 667 667 668 668 phy_set_drvdata(generic_phy, ddata); 669 669 670 670 phy_provider = devm_of_phy_provider_register(ddata->dev, 671 671 of_phy_simple_xlate); 672 - if (IS_ERR(phy_provider)) 673 - return PTR_ERR(phy_provider); 672 + if (IS_ERR(phy_provider)) { 673 + error = PTR_ERR(phy_provider); 674 + goto out_reg_disable; 675 + } 674 676 675 677 error = cpcap_usb_init_optional_pins(ddata); 676 678 if (error) 677 - return error; 679 + goto out_reg_disable; 678 680 679 681 cpcap_usb_init_optional_gpios(ddata); 680 682 681 683 error = cpcap_usb_init_iio(ddata); 682 684 if (error) 683 - return error; 685 + goto out_reg_disable; 684 686 685 687 error = cpcap_usb_init_interrupts(pdev, ddata); 686 688 if (error) 687 - return error; 689 + goto out_reg_disable; 688 690 689 691 usb_add_phy_dev(&ddata->phy); 690 692 atomic_set(&ddata->active, 1); 691 693 schedule_delayed_work(&ddata->detect_work, msecs_to_jiffies(1)); 692 694 693 695 return 0; 696 + 697 + out_reg_disable: 698 + regulator_disable(ddata->vusb); 699 + 700 + return error; 694 701 } 695 702 696 703 static int cpcap_usb_phy_remove(struct platform_device *pdev)