Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge branch 'net-mlx5-support-ptm-on-arm-architecture'

Tariq Toukan says:

====================
net/mlx5: Support PTM on ARM architecture

This series by Carolina refactors mlx5 crosststamp initialization and
enables cross-timestamp support on ARM.
====================

Link: https://patch.msgid.link/20260316133607.8738-1-tariqt@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

+26 -14
+26 -14
drivers/net/ethernet/mellanox/mlx5/core/lib/clock.c
··· 38 38 #include "lib/eq.h" 39 39 #include "en.h" 40 40 #include "clock.h" 41 - #ifdef CONFIG_X86 41 + #if defined(CONFIG_X86) || defined(CONFIG_ARM_ARCH_TIMER) 42 42 #include <linux/timekeeping.h> 43 43 #include <linux/cpufeature.h> 44 - #endif /* CONFIG_X86 */ 44 + #endif /* CONFIG_X86 || CONFIG_ARM_ARCH_TIMER */ 45 45 46 46 #define MLX5_RT_CLOCK_IDENTITY_SIZE MLX5_FLD_SZ_BYTES(mrtcq_reg, rt_clock_identity) 47 47 ··· 229 229 MLX5_REG_MTUTC, 0, 1); 230 230 } 231 231 232 - #ifdef CONFIG_X86 232 + #if defined(CONFIG_X86) || defined(CONFIG_ARM_ARCH_TIMER) 233 233 static bool mlx5_is_ptm_source_time_available(struct mlx5_core_dev *dev) 234 234 { 235 235 u32 out[MLX5_ST_SZ_DW(mtptm_reg)] = {0}; ··· 275 275 host = MLX5_GET64(mtctr_reg, out, first_clock_timestamp); 276 276 *sys_counterval = (struct system_counterval_t) { 277 277 .cycles = host, 278 - .cs_id = CSID_X86_ART, 278 + .cs_id = IS_ENABLED(CONFIG_X86) ? CSID_X86_ART : 279 + CSID_ARM_ARCH_COUNTER, 279 280 .use_nsecs = true, 280 281 }; 281 282 *device = MLX5_GET64(mtctr_reg, out, second_clock_timestamp); ··· 374 373 mlx5_clock_unlock(clock); 375 374 return err; 376 375 } 377 - #endif /* CONFIG_X86 */ 376 + #endif /* CONFIG_X86 || CONFIG_ARM_ARCH_TIMER */ 378 377 379 378 static u64 mlx5_read_time(struct mlx5_core_dev *dev, 380 379 struct ptp_system_timestamp *sts, ··· 1302 1301 min(S32_MAX, 1 << log_max_freq_adjustment); 1303 1302 } 1304 1303 1304 + static void mlx5_init_crosststamp(struct mlx5_core_dev *mdev, 1305 + bool expose_cycles, struct mlx5_clock *clock) 1306 + { 1307 + #if defined(CONFIG_X86) 1308 + if (!boot_cpu_has(X86_FEATURE_ART)) 1309 + return; 1310 + #endif /* CONFIG_X86 */ 1311 + #if defined(CONFIG_X86) || defined(CONFIG_ARM_ARCH_TIMER) 1312 + if (!MLX5_CAP_MCAM_REG3(mdev, mtptm) || 1313 + !MLX5_CAP_MCAM_REG3(mdev, mtctr)) 1314 + return; 1315 + 1316 + clock->ptp_info.getcrosststamp = mlx5_ptp_getcrosststamp; 1317 + if (expose_cycles) 1318 + clock->ptp_info.getcrosscycles = mlx5_ptp_getcrosscycles; 1319 + 1320 + #endif /* CONFIG_X86 || CONFIG_ARM_ARCH_TIMER */ 1321 + } 1322 + 1305 1323 static void mlx5_init_timer_clock(struct mlx5_core_dev *mdev) 1306 1324 { 1307 1325 struct mlx5_clock *clock = mdev->clock; ··· 1335 1315 expose_cycles = !MLX5_CAP_GEN(mdev, disciplined_fr_counter) || 1336 1316 !mlx5_real_time_mode(mdev); 1337 1317 1338 - #ifdef CONFIG_X86 1339 - if (MLX5_CAP_MCAM_REG3(mdev, mtptm) && 1340 - MLX5_CAP_MCAM_REG3(mdev, mtctr) && boot_cpu_has(X86_FEATURE_ART)) { 1341 - clock->ptp_info.getcrosststamp = mlx5_ptp_getcrosststamp; 1342 - if (expose_cycles) 1343 - clock->ptp_info.getcrosscycles = 1344 - mlx5_ptp_getcrosscycles; 1345 - } 1346 - #endif /* CONFIG_X86 */ 1318 + mlx5_init_crosststamp(mdev, expose_cycles, clock); 1347 1319 1348 1320 if (expose_cycles) 1349 1321 clock->ptp_info.getcyclesx64 = mlx5_ptp_getcyclesx;