Skip to content

Commit ecc26ba

Browse files
committed
Merge branch 'thermal-intel'
Merge updates of Intel thermal drivers for 7.1: - Replace cpumask_weight() in intel_hfi_offline() with cpumask_empty() which is generally more efficient (Yury Norov) - Add support for reading DDR data rate from PCI config space on Nova Lake platforms to the int340x thermal driver (Srinivas Pandruvada) * thermal-intel: thermal: intel: hfi: use cpumask_empty() in intel_hfi_offline() thermal: intel: int340x: Read DDR data rate for Nova Lake
2 parents d33e89d + d8d3e49 commit ecc26ba

2 files changed

Lines changed: 21 additions & 6 deletions

File tree

drivers/thermal/intel/int340x_thermal/processor_thermal_rfim.c

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -402,17 +402,31 @@ static ssize_t rfi_restriction_show(struct device *dev,
402402
return sysfs_emit(buf, "%llu\n", resp);
403403
}
404404

405+
/* ddr_data_rate */
406+
static const struct mmio_reg nvl_ddr_data_rate_reg = { 1, 0xE0, 10, 0x3FF, 2};
407+
408+
static const struct mmio_reg *ddr_data_rate_reg;
409+
405410
static ssize_t ddr_data_rate_show(struct device *dev,
406411
struct device_attribute *attr,
407412
char *buf)
408413
{
409-
u16 id = 0x0107;
410414
u64 resp;
411-
int ret;
412415

413-
ret = processor_thermal_send_mbox_read_cmd(to_pci_dev(dev), id, &resp);
414-
if (ret)
415-
return ret;
416+
if (ddr_data_rate_reg) {
417+
u16 reg_val;
418+
419+
pci_read_config_word(to_pci_dev(dev), ddr_data_rate_reg->offset, &reg_val);
420+
resp = (reg_val >> ddr_data_rate_reg->shift) & ddr_data_rate_reg->mask;
421+
resp = (resp * 3333) / 100;
422+
} else {
423+
const u16 id = 0x0107;
424+
int ret;
425+
426+
ret = processor_thermal_send_mbox_read_cmd(to_pci_dev(dev), id, &resp);
427+
if (ret)
428+
return ret;
429+
}
416430

417431
return sysfs_emit(buf, "%llu\n", resp);
418432
}
@@ -461,6 +475,7 @@ int proc_thermal_rfim_add(struct pci_dev *pdev, struct proc_thermal_device *proc
461475
case PCI_DEVICE_ID_INTEL_NVL_H_THERMAL:
462476
case PCI_DEVICE_ID_INTEL_NVL_S_THERMAL:
463477
dlvr_mmio_regs_table = nvl_dlvr_mmio_regs;
478+
ddr_data_rate_reg = &nvl_ddr_data_rate_reg;
464479
break;
465480
default:
466481
dlvr_mmio_regs_table = dlvr_mmio_regs;

drivers/thermal/intel/intel_hfi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,7 @@ void intel_hfi_offline(unsigned int cpu)
526526
mutex_lock(&hfi_instance_lock);
527527
cpumask_clear_cpu(cpu, hfi_instance->cpus);
528528

529-
if (!cpumask_weight(hfi_instance->cpus))
529+
if (cpumask_empty(hfi_instance->cpus))
530530
hfi_disable();
531531

532532
mutex_unlock(&hfi_instance_lock);

0 commit comments

Comments
 (0)