lkml.org 
[lkml]   [2022]   [Oct]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[RFC PATCH 1/2] nospec: Add a generic barrier_nospec()
Date
barrier_nospec() is a speculation barrier with an arch dependent
implementation. Architectures that don't need a speculation barrier
shouldn't have to define an arch specific version.

To be able to use barrier_nospec() in non-architecture code add a
generic version that does nothing. Architectures needing speculation
barrier can override the generic version in their asm/barrier.h.

Signed-off-by: Pawan Gupta <pawan.kumar.gupta@linux.intel.com>
---
include/linux/nospec.h | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/include/linux/nospec.h b/include/linux/nospec.h
index c1e79f72cd89..60e040a5df27 100644
--- a/include/linux/nospec.h
+++ b/include/linux/nospec.h
@@ -60,6 +60,10 @@ static inline unsigned long array_index_mask_nospec(unsigned long index,
(typeof(_i)) (_i & _mask); \
})

+#ifndef barrier_nospec
+#define barrier_nospec() do { } while (0)
+#endif
+
/* Speculation control prctl */
int arch_prctl_spec_ctrl_get(struct task_struct *task, unsigned long which);
int arch_prctl_spec_ctrl_set(struct task_struct *task, unsigned long which,
--
2.37.3
\
 
 \ /
  Last update: 2022-10-25 02:35    [W:0.216 / U:0.648 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site