Commit fdbc80bd authored by Linus Torvalds's avatar Linus Torvalds

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
parents 443d1129 31b08106
...@@ -268,6 +268,11 @@ static const struct pci_device_id intel_th_pci_id_table[] = { ...@@ -268,6 +268,11 @@ static const struct pci_device_id intel_th_pci_id_table[] = {
PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x7aa6), PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x7aa6),
.driver_data = (kernel_ulong_t)&intel_th_2x, .driver_data = (kernel_ulong_t)&intel_th_2x,
}, },
{
/* Alder Lake-P */
PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x51a6),
.driver_data = (kernel_ulong_t)&intel_th_2x,
},
{ {
/* Alder Lake CPU */ /* Alder Lake CPU */
PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x466f), PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x466f),
......
...@@ -64,7 +64,7 @@ static void stm_heartbeat_unlink(struct stm_source_data *data) ...@@ -64,7 +64,7 @@ static void stm_heartbeat_unlink(struct stm_source_data *data)
static int stm_heartbeat_init(void) static int stm_heartbeat_init(void)
{ {
int i, ret = -ENOMEM; int i, ret;
if (nr_devs < 0 || nr_devs > STM_HEARTBEAT_MAX) if (nr_devs < 0 || nr_devs > STM_HEARTBEAT_MAX)
return -EINVAL; return -EINVAL;
...@@ -72,8 +72,10 @@ static int stm_heartbeat_init(void) ...@@ -72,8 +72,10 @@ static int stm_heartbeat_init(void)
for (i = 0; i < nr_devs; i++) { for (i = 0; i < nr_devs; i++) {
stm_heartbeat[i].data.name = stm_heartbeat[i].data.name =
kasprintf(GFP_KERNEL, "heartbeat.%d", i); kasprintf(GFP_KERNEL, "heartbeat.%d", i);
if (!stm_heartbeat[i].data.name) if (!stm_heartbeat[i].data.name) {
ret = -ENOMEM;
goto fail_unregister; goto fail_unregister;
}
stm_heartbeat[i].data.nr_chans = 1; stm_heartbeat[i].data.nr_chans = 1;
stm_heartbeat[i].data.link = stm_heartbeat_link; stm_heartbeat[i].data.link = stm_heartbeat_link;
......
...@@ -1512,6 +1512,7 @@ static int rtsx_pci_probe(struct pci_dev *pcidev, ...@@ -1512,6 +1512,7 @@ static int rtsx_pci_probe(struct pci_dev *pcidev,
struct pcr_handle *handle; struct pcr_handle *handle;
u32 base, len; u32 base, len;
int ret, i, bar = 0; int ret, i, bar = 0;
u8 val;
dev_dbg(&(pcidev->dev), dev_dbg(&(pcidev->dev),
": Realtek PCI-E Card Reader found at %s [%04x:%04x] (rev %x)\n", ": Realtek PCI-E Card Reader found at %s [%04x:%04x] (rev %x)\n",
...@@ -1577,7 +1578,11 @@ static int rtsx_pci_probe(struct pci_dev *pcidev, ...@@ -1577,7 +1578,11 @@ static int rtsx_pci_probe(struct pci_dev *pcidev,
pcr->host_cmds_addr = pcr->rtsx_resv_buf_addr; pcr->host_cmds_addr = pcr->rtsx_resv_buf_addr;
pcr->host_sg_tbl_ptr = pcr->rtsx_resv_buf + HOST_CMDS_BUF_LEN; pcr->host_sg_tbl_ptr = pcr->rtsx_resv_buf + HOST_CMDS_BUF_LEN;
pcr->host_sg_tbl_addr = pcr->rtsx_resv_buf_addr + HOST_CMDS_BUF_LEN; pcr->host_sg_tbl_addr = pcr->rtsx_resv_buf_addr + HOST_CMDS_BUF_LEN;
rtsx_pci_read_register(pcr, ASPM_FORCE_CTL, &val);
if (val & FORCE_ASPM_CTL0 && val & FORCE_ASPM_CTL1)
pcr->aspm_enabled = false;
else
pcr->aspm_enabled = true;
pcr->card_inserted = 0; pcr->card_inserted = 0;
pcr->card_removed = 0; pcr->card_removed = 0;
INIT_DELAYED_WORK(&pcr->carddet_work, rtsx_pci_card_detect); INIT_DELAYED_WORK(&pcr->carddet_work, rtsx_pci_card_detect);
......
...@@ -1037,7 +1037,7 @@ int hl_device_reset(struct hl_device *hdev, bool hard_reset, ...@@ -1037,7 +1037,7 @@ int hl_device_reset(struct hl_device *hdev, bool hard_reset,
if (hard_reset) { if (hard_reset) {
/* Release kernel context */ /* Release kernel context */
if (hl_ctx_put(hdev->kernel_ctx) == 1) if (hdev->kernel_ctx && hl_ctx_put(hdev->kernel_ctx) == 1)
hdev->kernel_ctx = NULL; hdev->kernel_ctx = NULL;
hl_vm_fini(hdev); hl_vm_fini(hdev);
hl_mmu_fini(hdev); hl_mmu_fini(hdev);
...@@ -1487,6 +1487,15 @@ void hl_device_fini(struct hl_device *hdev) ...@@ -1487,6 +1487,15 @@ void hl_device_fini(struct hl_device *hdev)
} }
} }
/* Disable PCI access from device F/W so it won't send us additional
* interrupts. We disable MSI/MSI-X at the halt_engines function and we
* can't have the F/W sending us interrupts after that. We need to
* disable the access here because if the device is marked disable, the
* message won't be send. Also, in case of heartbeat, the device CPU is
* marked as disable so this message won't be sent
*/
hl_fw_send_pci_access_msg(hdev, CPUCP_PACKET_DISABLE_PCI_ACCESS);
/* Mark device as disabled */ /* Mark device as disabled */
hdev->disabled = true; hdev->disabled = true;
......
...@@ -402,6 +402,10 @@ int hl_fw_cpucp_pci_counters_get(struct hl_device *hdev, ...@@ -402,6 +402,10 @@ int hl_fw_cpucp_pci_counters_get(struct hl_device *hdev,
} }
counters->rx_throughput = result; counters->rx_throughput = result;
memset(&pkt, 0, sizeof(pkt));
pkt.ctl = cpu_to_le32(CPUCP_PACKET_PCIE_THROUGHPUT_GET <<
CPUCP_PKT_CTL_OPCODE_SHIFT);
/* Fetch PCI tx counter */ /* Fetch PCI tx counter */
pkt.index = cpu_to_le32(cpucp_pcie_throughput_tx); pkt.index = cpu_to_le32(cpucp_pcie_throughput_tx);
rc = hdev->asic_funcs->send_cpu_message(hdev, (u32 *) &pkt, sizeof(pkt), rc = hdev->asic_funcs->send_cpu_message(hdev, (u32 *) &pkt, sizeof(pkt),
...@@ -414,6 +418,7 @@ int hl_fw_cpucp_pci_counters_get(struct hl_device *hdev, ...@@ -414,6 +418,7 @@ int hl_fw_cpucp_pci_counters_get(struct hl_device *hdev,
counters->tx_throughput = result; counters->tx_throughput = result;
/* Fetch PCI replay counter */ /* Fetch PCI replay counter */
memset(&pkt, 0, sizeof(pkt));
pkt.ctl = cpu_to_le32(CPUCP_PACKET_PCIE_REPLAY_CNT_GET << pkt.ctl = cpu_to_le32(CPUCP_PACKET_PCIE_REPLAY_CNT_GET <<
CPUCP_PKT_CTL_OPCODE_SHIFT); CPUCP_PKT_CTL_OPCODE_SHIFT);
......
...@@ -2182,6 +2182,7 @@ void hl_mmu_v1_set_funcs(struct hl_device *hdev, struct hl_mmu_funcs *mmu); ...@@ -2182,6 +2182,7 @@ void hl_mmu_v1_set_funcs(struct hl_device *hdev, struct hl_mmu_funcs *mmu);
int hl_mmu_va_to_pa(struct hl_ctx *ctx, u64 virt_addr, u64 *phys_addr); int hl_mmu_va_to_pa(struct hl_ctx *ctx, u64 virt_addr, u64 *phys_addr);
int hl_mmu_get_tlb_info(struct hl_ctx *ctx, u64 virt_addr, int hl_mmu_get_tlb_info(struct hl_ctx *ctx, u64 virt_addr,
struct hl_mmu_hop_info *hops); struct hl_mmu_hop_info *hops);
bool hl_is_dram_va(struct hl_device *hdev, u64 virt_addr);
int hl_fw_load_fw_to_device(struct hl_device *hdev, const char *fw_name, int hl_fw_load_fw_to_device(struct hl_device *hdev, const char *fw_name,
void __iomem *dst, u32 src_offset, u32 size); void __iomem *dst, u32 src_offset, u32 size);
......
...@@ -133,6 +133,8 @@ static int hw_idle(struct hl_device *hdev, struct hl_info_args *args) ...@@ -133,6 +133,8 @@ static int hw_idle(struct hl_device *hdev, struct hl_info_args *args)
hw_idle.is_idle = hdev->asic_funcs->is_device_idle(hdev, hw_idle.is_idle = hdev->asic_funcs->is_device_idle(hdev,
&hw_idle.busy_engines_mask_ext, NULL); &hw_idle.busy_engines_mask_ext, NULL);
hw_idle.busy_engines_mask =
lower_32_bits(hw_idle.busy_engines_mask_ext);
return copy_to_user(out, &hw_idle, return copy_to_user(out, &hw_idle,
min((size_t) max_size, sizeof(hw_idle))) ? -EFAULT : 0; min((size_t) max_size, sizeof(hw_idle))) ? -EFAULT : 0;
......
...@@ -886,8 +886,10 @@ static void unmap_phys_pg_pack(struct hl_ctx *ctx, u64 vaddr, ...@@ -886,8 +886,10 @@ static void unmap_phys_pg_pack(struct hl_ctx *ctx, u64 vaddr,
{ {
struct hl_device *hdev = ctx->hdev; struct hl_device *hdev = ctx->hdev;
u64 next_vaddr, i; u64 next_vaddr, i;
bool is_host_addr;
u32 page_size; u32 page_size;
is_host_addr = !hl_is_dram_va(hdev, vaddr);
page_size = phys_pg_pack->page_size; page_size = phys_pg_pack->page_size;
next_vaddr = vaddr; next_vaddr = vaddr;
...@@ -900,9 +902,13 @@ static void unmap_phys_pg_pack(struct hl_ctx *ctx, u64 vaddr, ...@@ -900,9 +902,13 @@ static void unmap_phys_pg_pack(struct hl_ctx *ctx, u64 vaddr,
/* /*
* unmapping on Palladium can be really long, so avoid a CPU * unmapping on Palladium can be really long, so avoid a CPU
* soft lockup bug by sleeping a little between unmapping pages * soft lockup bug by sleeping a little between unmapping pages
*
* In addition, when unmapping host memory we pass through
* the Linux kernel to unpin the pages and that takes a long
* time. Therefore, sleep every 32K pages to avoid soft lockup
*/ */
if (hdev->pldm) if (hdev->pldm || (is_host_addr && (i & 0x7FFF) == 0))
usleep_range(500, 1000); usleep_range(50, 200);
} }
} }
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
#include "habanalabs.h" #include "habanalabs.h"
static bool is_dram_va(struct hl_device *hdev, u64 virt_addr) bool hl_is_dram_va(struct hl_device *hdev, u64 virt_addr)
{ {
struct asic_fixed_properties *prop = &hdev->asic_prop; struct asic_fixed_properties *prop = &hdev->asic_prop;
...@@ -156,7 +156,7 @@ int hl_mmu_unmap_page(struct hl_ctx *ctx, u64 virt_addr, u32 page_size, ...@@ -156,7 +156,7 @@ int hl_mmu_unmap_page(struct hl_ctx *ctx, u64 virt_addr, u32 page_size,
if (!hdev->mmu_enable) if (!hdev->mmu_enable)
return 0; return 0;
is_dram_addr = is_dram_va(hdev, virt_addr); is_dram_addr = hl_is_dram_va(hdev, virt_addr);
if (is_dram_addr) if (is_dram_addr)
mmu_prop = &prop->dmmu; mmu_prop = &prop->dmmu;
...@@ -236,7 +236,7 @@ int hl_mmu_map_page(struct hl_ctx *ctx, u64 virt_addr, u64 phys_addr, ...@@ -236,7 +236,7 @@ int hl_mmu_map_page(struct hl_ctx *ctx, u64 virt_addr, u64 phys_addr,
if (!hdev->mmu_enable) if (!hdev->mmu_enable)
return 0; return 0;
is_dram_addr = is_dram_va(hdev, virt_addr); is_dram_addr = hl_is_dram_va(hdev, virt_addr);
if (is_dram_addr) if (is_dram_addr)
mmu_prop = &prop->dmmu; mmu_prop = &prop->dmmu;
......
...@@ -467,8 +467,16 @@ static void hl_mmu_v1_fini(struct hl_device *hdev) ...@@ -467,8 +467,16 @@ static void hl_mmu_v1_fini(struct hl_device *hdev)
{ {
/* MMU H/W fini was already done in device hw_fini() */ /* MMU H/W fini was already done in device hw_fini() */
kvfree(hdev->mmu_priv.dr.mmu_shadow_hop0); if (!ZERO_OR_NULL_PTR(hdev->mmu_priv.hr.mmu_shadow_hop0)) {
gen_pool_destroy(hdev->mmu_priv.dr.mmu_pgt_pool); kvfree(hdev->mmu_priv.dr.mmu_shadow_hop0);
gen_pool_destroy(hdev->mmu_priv.dr.mmu_pgt_pool);
}
/* Make sure that if we arrive here again without init was called we
* won't cause kernel panic. This can happen for example if we fail
* during hard reset code at certain points
*/
hdev->mmu_priv.dr.mmu_shadow_hop0 = NULL;
} }
/** /**
......
...@@ -4002,7 +4002,8 @@ static int gaudi_cb_mmap(struct hl_device *hdev, struct vm_area_struct *vma, ...@@ -4002,7 +4002,8 @@ static int gaudi_cb_mmap(struct hl_device *hdev, struct vm_area_struct *vma,
vma->vm_flags |= VM_IO | VM_PFNMAP | VM_DONTEXPAND | VM_DONTDUMP | vma->vm_flags |= VM_IO | VM_PFNMAP | VM_DONTEXPAND | VM_DONTDUMP |
VM_DONTCOPY | VM_NORESERVE; VM_DONTCOPY | VM_NORESERVE;
rc = dma_mmap_coherent(hdev->dev, vma, cpu_addr, dma_addr, size); rc = dma_mmap_coherent(hdev->dev, vma, cpu_addr,
(dma_addr - HOST_PHYS_BASE), size);
if (rc) if (rc)
dev_err(hdev->dev, "dma_mmap_coherent error %d", rc); dev_err(hdev->dev, "dma_mmap_coherent error %d", rc);
......
...@@ -2719,7 +2719,8 @@ static int goya_cb_mmap(struct hl_device *hdev, struct vm_area_struct *vma, ...@@ -2719,7 +2719,8 @@ static int goya_cb_mmap(struct hl_device *hdev, struct vm_area_struct *vma,
vma->vm_flags |= VM_IO | VM_PFNMAP | VM_DONTEXPAND | VM_DONTDUMP | vma->vm_flags |= VM_IO | VM_PFNMAP | VM_DONTEXPAND | VM_DONTDUMP |
VM_DONTCOPY | VM_NORESERVE; VM_DONTCOPY | VM_NORESERVE;
rc = dma_mmap_coherent(hdev->dev, vma, cpu_addr, dma_addr, size); rc = dma_mmap_coherent(hdev->dev, vma, cpu_addr,
(dma_addr - HOST_PHYS_BASE), size);
if (rc) if (rc)
dev_err(hdev->dev, "dma_mmap_coherent error %d", rc); dev_err(hdev->dev, "dma_mmap_coherent error %d", rc);
......
# SPDX-License-Identifier: GPL-2.0 # SPDX-License-Identifier: GPL-2.0
obj-y += phy-ingenic-usb.o obj-$(CONFIG_PHY_INGENIC_USB) += phy-ingenic-usb.o
...@@ -49,7 +49,9 @@ config PHY_MTK_HDMI ...@@ -49,7 +49,9 @@ config PHY_MTK_HDMI
config PHY_MTK_MIPI_DSI config PHY_MTK_MIPI_DSI
tristate "MediaTek MIPI-DSI Driver" tristate "MediaTek MIPI-DSI Driver"
depends on ARCH_MEDIATEK && OF depends on ARCH_MEDIATEK || COMPILE_TEST
depends on COMMON_CLK
depends on OF
select GENERIC_PHY select GENERIC_PHY
help help
Support MIPI DSI for Mediatek SoCs. Support MIPI DSI for Mediatek SoCs.
...@@ -662,35 +662,42 @@ static int cpcap_usb_phy_probe(struct platform_device *pdev) ...@@ -662,35 +662,42 @@ static int cpcap_usb_phy_probe(struct platform_device *pdev)
generic_phy = devm_phy_create(ddata->dev, NULL, &ops); generic_phy = devm_phy_create(ddata->dev, NULL, &ops);
if (IS_ERR(generic_phy)) { if (IS_ERR(generic_phy)) {
error = PTR_ERR(generic_phy); error = PTR_ERR(generic_phy);
return PTR_ERR(generic_phy); goto out_reg_disable;
} }
phy_set_drvdata(generic_phy, ddata); phy_set_drvdata(generic_phy, ddata);
phy_provider = devm_of_phy_provider_register(ddata->dev, phy_provider = devm_of_phy_provider_register(ddata->dev,
of_phy_simple_xlate); of_phy_simple_xlate);
if (IS_ERR(phy_provider)) if (IS_ERR(phy_provider)) {
return PTR_ERR(phy_provider); error = PTR_ERR(phy_provider);
goto out_reg_disable;
}
error = cpcap_usb_init_optional_pins(ddata); error = cpcap_usb_init_optional_pins(ddata);
if (error) if (error)
return error; goto out_reg_disable;
cpcap_usb_init_optional_gpios(ddata); cpcap_usb_init_optional_gpios(ddata);
error = cpcap_usb_init_iio(ddata); error = cpcap_usb_init_iio(ddata);
if (error) if (error)
return error; goto out_reg_disable;
error = cpcap_usb_init_interrupts(pdev, ddata); error = cpcap_usb_init_interrupts(pdev, ddata);
if (error) if (error)
return error; goto out_reg_disable;
usb_add_phy_dev(&ddata->phy); usb_add_phy_dev(&ddata->phy);
atomic_set(&ddata->active, 1); atomic_set(&ddata->active, 1);
schedule_delayed_work(&ddata->detect_work, msecs_to_jiffies(1)); schedule_delayed_work(&ddata->detect_work, msecs_to_jiffies(1));
return 0; return 0;
out_reg_disable:
regulator_disable(ddata->vusb);
return error;
} }
static int cpcap_usb_phy_remove(struct platform_device *pdev) static int cpcap_usb_phy_remove(struct platform_device *pdev)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment