aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/arch/powerpc/lib/code-patching.c
diff options
context:
space:
mode:
authorLeon Romanovsky <leonro@nvidia.com>2021-10-21 08:27:39 +0300
committerLeon Romanovsky <leonro@nvidia.com>2021-10-21 08:27:39 +0300
commit60dd57c7479418e2bc902143eb46a2fdcfeecbbb (patch)
treeab6005faf6076a4c93fdfbcdccc1ff4bc044c8ec /arch/powerpc/lib/code-patching.c
parentnet/mlx5: Add priorities for counters in RDMA namespaces (diff)
parentRDMA/mlx5: Attach ndescs to mlx5_ib_mkey (diff)
downloadwireguard-linux-60dd57c7479418e2bc902143eb46a2fdcfeecbbb.tar.xz
wireguard-linux-60dd57c7479418e2bc902143eb46a2fdcfeecbbb.zip
Merge brank 'mlx5_mkey' into rdma.git for-next
A small series to clean up the mlx5 mkey code across the mlx5_core and InfiniBand. * branch 'mlx5_mkey': RDMA/mlx5: Attach ndescs to mlx5_ib_mkey RDMA/mlx5: Move struct mlx5_core_mkey to mlx5_ib RDMA/mlx5: Replace struct mlx5_core_mkey by u32 key RDMA/mlx5: Remove pd from struct mlx5_core_mkey RDMA/mlx5: Remove size from struct mlx5_core_mkey RDMA/mlx5: Remove iova from struct mlx5_core_mkey Signed-off-by: Leon Romanovsky <leonro@nvidia.com>
Diffstat (limited to 'arch/powerpc/lib/code-patching.c')
-rw-r--r--arch/powerpc/lib/code-patching.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/arch/powerpc/lib/code-patching.c b/arch/powerpc/lib/code-patching.c
index f9a3019e37b4..c5ed98823835 100644
--- a/arch/powerpc/lib/code-patching.c
+++ b/arch/powerpc/lib/code-patching.c
@@ -228,6 +228,11 @@ bool is_offset_in_branch_range(long offset)
return (offset >= -0x2000000 && offset <= 0x1fffffc && !(offset & 0x3));
}
+bool is_offset_in_cond_branch_range(long offset)
+{
+ return offset >= -0x8000 && offset <= 0x7fff && !(offset & 0x3);
+}
+
/*
* Helper to check if a given instruction is a conditional branch
* Derived from the conditional checks in analyse_instr()
@@ -280,7 +285,7 @@ int create_cond_branch(struct ppc_inst *instr, const u32 *addr,
offset = offset - (unsigned long)addr;
/* Check we can represent the target in the instruction format */
- if (offset < -0x8000 || offset > 0x7FFF || offset & 0x3)
+ if (!is_offset_in_cond_branch_range(offset))
return 1;
/* Mask out the flags and target, so they don't step on each other. */