Skip to content

Commit fdbc80b

Browse files
committed
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
2 parents 443d112 + 31b0810 commit fdbc80b

File tree

15 files changed

+75
-21
lines changed

15 files changed

+75
-21
lines changed

drivers/hwtracing/intel_th/pci.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,11 @@ static const struct pci_device_id intel_th_pci_id_table[] = {
268268
PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x7aa6),
269269
.driver_data = (kernel_ulong_t)&intel_th_2x,
270270
},
271+
{
272+
/* Alder Lake-P */
273+
PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x51a6),
274+
.driver_data = (kernel_ulong_t)&intel_th_2x,
275+
},
271276
{
272277
/* Alder Lake CPU */
273278
PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x466f),

drivers/hwtracing/stm/heartbeat.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,16 +64,18 @@ static void stm_heartbeat_unlink(struct stm_source_data *data)
6464

6565
static int stm_heartbeat_init(void)
6666
{
67-
int i, ret = -ENOMEM;
67+
int i, ret;
6868

6969
if (nr_devs < 0 || nr_devs > STM_HEARTBEAT_MAX)
7070
return -EINVAL;
7171

7272
for (i = 0; i < nr_devs; i++) {
7373
stm_heartbeat[i].data.name =
7474
kasprintf(GFP_KERNEL, "heartbeat.%d", i);
75-
if (!stm_heartbeat[i].data.name)
75+
if (!stm_heartbeat[i].data.name) {
76+
ret = -ENOMEM;
7677
goto fail_unregister;
78+
}
7779

7880
stm_heartbeat[i].data.nr_chans = 1;
7981
stm_heartbeat[i].data.link = stm_heartbeat_link;

drivers/misc/cardreader/rtsx_pcr.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1512,6 +1512,7 @@ static int rtsx_pci_probe(struct pci_dev *pcidev,
15121512
struct pcr_handle *handle;
15131513
u32 base, len;
15141514
int ret, i, bar = 0;
1515+
u8 val;
15151516

15161517
dev_dbg(&(pcidev->dev),
15171518
": 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,
15771578
pcr->host_cmds_addr = pcr->rtsx_resv_buf_addr;
15781579
pcr->host_sg_tbl_ptr = pcr->rtsx_resv_buf + HOST_CMDS_BUF_LEN;
15791580
pcr->host_sg_tbl_addr = pcr->rtsx_resv_buf_addr + HOST_CMDS_BUF_LEN;
1580-
1581+
rtsx_pci_read_register(pcr, ASPM_FORCE_CTL, &val);
1582+
if (val & FORCE_ASPM_CTL0 && val & FORCE_ASPM_CTL1)
1583+
pcr->aspm_enabled = false;
1584+
else
1585+
pcr->aspm_enabled = true;
15811586
pcr->card_inserted = 0;
15821587
pcr->card_removed = 0;
15831588
INIT_DELAYED_WORK(&pcr->carddet_work, rtsx_pci_card_detect);

drivers/misc/habanalabs/common/device.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1037,7 +1037,7 @@ int hl_device_reset(struct hl_device *hdev, bool hard_reset,
10371037

10381038
if (hard_reset) {
10391039
/* Release kernel context */
1040-
if (hl_ctx_put(hdev->kernel_ctx) == 1)
1040+
if (hdev->kernel_ctx && hl_ctx_put(hdev->kernel_ctx) == 1)
10411041
hdev->kernel_ctx = NULL;
10421042
hl_vm_fini(hdev);
10431043
hl_mmu_fini(hdev);
@@ -1487,6 +1487,15 @@ void hl_device_fini(struct hl_device *hdev)
14871487
}
14881488
}
14891489

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);
1498+
14901499
/* Mark device as disabled */
14911500
hdev->disabled = true;
14921501

drivers/misc/habanalabs/common/firmware_if.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,10 @@ int hl_fw_cpucp_pci_counters_get(struct hl_device *hdev,
402402
}
403403
counters->rx_throughput = result;
404404

405+
memset(&pkt, 0, sizeof(pkt));
406+
pkt.ctl = cpu_to_le32(CPUCP_PACKET_PCIE_THROUGHPUT_GET <<
407+
CPUCP_PKT_CTL_OPCODE_SHIFT);
408+
405409
/* Fetch PCI tx counter */
406410
pkt.index = cpu_to_le32(cpucp_pcie_throughput_tx);
407411
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,
414418
counters->tx_throughput = result;
415419

416420
/* Fetch PCI replay counter */
421+
memset(&pkt, 0, sizeof(pkt));
417422
pkt.ctl = cpu_to_le32(CPUCP_PACKET_PCIE_REPLAY_CNT_GET <<
418423
CPUCP_PKT_CTL_OPCODE_SHIFT);
419424

drivers/misc/habanalabs/common/habanalabs.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2182,6 +2182,7 @@ void hl_mmu_v1_set_funcs(struct hl_device *hdev, struct hl_mmu_funcs *mmu);
21822182
int hl_mmu_va_to_pa(struct hl_ctx *ctx, u64 virt_addr, u64 *phys_addr);
21832183
int hl_mmu_get_tlb_info(struct hl_ctx *ctx, u64 virt_addr,
21842184
struct hl_mmu_hop_info *hops);
2185+
bool hl_is_dram_va(struct hl_device *hdev, u64 virt_addr);
21852186

21862187
int hl_fw_load_fw_to_device(struct hl_device *hdev, const char *fw_name,
21872188
void __iomem *dst, u32 src_offset, u32 size);

drivers/misc/habanalabs/common/habanalabs_ioctl.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,8 @@ static int hw_idle(struct hl_device *hdev, struct hl_info_args *args)
133133

134134
hw_idle.is_idle = hdev->asic_funcs->is_device_idle(hdev,
135135
&hw_idle.busy_engines_mask_ext, NULL);
136+
hw_idle.busy_engines_mask =
137+
lower_32_bits(hw_idle.busy_engines_mask_ext);
136138

137139
return copy_to_user(out, &hw_idle,
138140
min((size_t) max_size, sizeof(hw_idle))) ? -EFAULT : 0;

drivers/misc/habanalabs/common/memory.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -886,8 +886,10 @@ static void unmap_phys_pg_pack(struct hl_ctx *ctx, u64 vaddr,
886886
{
887887
struct hl_device *hdev = ctx->hdev;
888888
u64 next_vaddr, i;
889+
bool is_host_addr;
889890
u32 page_size;
890891

892+
is_host_addr = !hl_is_dram_va(hdev, vaddr);
891893
page_size = phys_pg_pack->page_size;
892894
next_vaddr = vaddr;
893895

@@ -900,9 +902,13 @@ static void unmap_phys_pg_pack(struct hl_ctx *ctx, u64 vaddr,
900902
/*
901903
* unmapping on Palladium can be really long, so avoid a CPU
902904
* soft lockup bug by sleeping a little between unmapping pages
905+
*
906+
* In addition, when unmapping host memory we pass through
907+
* the Linux kernel to unpin the pages and that takes a long
908+
* time. Therefore, sleep every 32K pages to avoid soft lockup
903909
*/
904-
if (hdev->pldm)
905-
usleep_range(500, 1000);
910+
if (hdev->pldm || (is_host_addr && (i & 0x7FFF) == 0))
911+
usleep_range(50, 200);
906912
}
907913
}
908914

drivers/misc/habanalabs/common/mmu.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
#include "habanalabs.h"
1111

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)
1313
{
1414
struct asic_fixed_properties *prop = &hdev->asic_prop;
1515

@@ -156,7 +156,7 @@ int hl_mmu_unmap_page(struct hl_ctx *ctx, u64 virt_addr, u32 page_size,
156156
if (!hdev->mmu_enable)
157157
return 0;
158158

159-
is_dram_addr = is_dram_va(hdev, virt_addr);
159+
is_dram_addr = hl_is_dram_va(hdev, virt_addr);
160160

161161
if (is_dram_addr)
162162
mmu_prop = &prop->dmmu;
@@ -236,7 +236,7 @@ int hl_mmu_map_page(struct hl_ctx *ctx, u64 virt_addr, u64 phys_addr,
236236
if (!hdev->mmu_enable)
237237
return 0;
238238

239-
is_dram_addr = is_dram_va(hdev, virt_addr);
239+
is_dram_addr = hl_is_dram_va(hdev, virt_addr);
240240

241241
if (is_dram_addr)
242242
mmu_prop = &prop->dmmu;

drivers/misc/habanalabs/common/mmu_v1.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -467,8 +467,16 @@ static void hl_mmu_v1_fini(struct hl_device *hdev)
467467
{
468468
/* MMU H/W fini was already done in device hw_fini() */
469469

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;
472480
}
473481

474482
/**

0 commit comments

Comments
 (0)