Merge tag 'gvt-next-fixes-2021-04-21' of https://github.com/intel/gvt-linux into...
[linux-2.6-microblaze.git] / include / linux / soc / marvell / octeontx2 / asm.h
1 /* SPDX-License-Identifier: GPL-2.0-only
2  * Copyright (C) 2020 Marvell.
3  */
4
5 #ifndef __SOC_OTX2_ASM_H
6 #define __SOC_OTX2_ASM_H
7
8 #if defined(CONFIG_ARM64)
9 /*
10  * otx2_lmt_flush is used for LMT store operation.
11  * On octeontx2 platform CPT instruction enqueue and
12  * NIX packet send are only possible via LMTST
13  * operations and it uses LDEOR instruction targeting
14  * the coprocessor address.
15  */
16 #define otx2_lmt_flush(ioaddr)                          \
17 ({                                                      \
18         u64 result = 0;                                 \
19         __asm__ volatile(".cpu  generic+lse\n"          \
20                          "ldeor xzr, %x[rf], [%[rs]]"   \
21                          : [rf]"=r" (result)            \
22                          : [rs]"r" (ioaddr));           \
23         (result);                                       \
24 })
25 #define cn10k_lmt_flush(val, addr)                      \
26 ({                                                      \
27         __asm__ volatile(".cpu  generic+lse\n"          \
28                          "steor %x[rf],[%[rs]]"         \
29                          : [rf]"+r"(val)                \
30                          : [rs]"r"(addr));              \
31 })
32 #else
33 #define otx2_lmt_flush(ioaddr)          ({ 0; })
34 #define cn10k_lmt_flush(val, addr)      ({ addr = val; })
35 #endif
36
37 #endif /* __SOC_OTX2_ASM_H */