diff options
author | Reza Arbab <arbab@linux.vnet.ibm.com> | 2017-07-31 21:37:01 -0500 |
---|---|---|
committer | Stewart Smith <stewart@linux.vnet.ibm.com> | 2017-08-04 17:13:10 +1000 |
commit | ec27983716d1c9fd72657dc4c74659eded7598ac (patch) | |
tree | c26082c9faf3446370625c23909d5d47b34bc28a | |
parent | e003ad1d7c8717d3d9d6ee40c20a68c1872d4785 (diff) | |
download | blackbird-skiboot-ec27983716d1c9fd72657dc4c74659eded7598ac.tar.gz blackbird-skiboot-ec27983716d1c9fd72657dc4c74659eded7598ac.zip |
npu2: Use read-modify-write in npu2_assign_gmb()
We currently set each half of the GPU memory BAR by OR'ing our half
into what is already there. This allows a possible conflict if Hostboot
or other system boot software has already written to the BAR.
Set each half of the BAR value directly instead of using OR.
Signed-off-by: Reza Arbab <arbab@linux.vnet.ibm.com>
Cc: Alistair Popple <alistair@popple.id.au>
Cc: Andrew Donnellan <andrew.donnellan@au1.ibm.com>
Cc: Frederic Barrat <fbarrat@linux.vnet.ibm.com>
Acked-by: Alistair Popple <alistair@popple.id.au>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
-rw-r--r-- | hw/npu2.c | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -630,14 +630,16 @@ static int npu2_assign_gmb(struct npu2_dev *ndev) mode += ndev->bdfn & 0x7; val = SETFIELD(NPU2_MEM_BAR_MODE, val, mode); - if (NPU2DEV_BRICK(ndev)) - val >>= 32; + reg = NPU2_REG_OFFSET(NPU2_STACK_STCK_0 + NPU2DEV_STACK(ndev), NPU2_BLOCK_SM_0, NPU2_GPU0_MEM_BAR); old_val = npu2_read(p, reg); - val |= old_val; + if (NPU2DEV_BRICK(ndev)) + val = SETFIELD(PPC_BITMASK(32, 63), old_val, val >> 32); + else + val = SETFIELD(PPC_BITMASK(0, 31), old_val, val >> 32); npu2_write(p, reg, val); reg = NPU2_REG_OFFSET(NPU2_STACK_STCK_0 + NPU2DEV_STACK(ndev), |