Skip to content

Commit

Permalink
hw/npu2.c: Fix device aperture calculation
Browse files Browse the repository at this point in the history
The POWER9 NPU2 implements an address compression scheme to compress 56-bit P9
physical addresses to 47-bit GPU addresses. System software needs to know both
addresses, unfortunately the calculation of the compressed address was
incorrect. Fix it here.

Signed-off-by: Alistair Popple <alistair@popple.id.au>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
  • Loading branch information
apopple authored and stewartsmith committed Jun 21, 2017
1 parent 73e1e8a commit a2df920
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions hw/npu2.c
Original file line number Diff line number Diff line change
Expand Up @@ -542,8 +542,10 @@ static void npu2_dn_fixup_gmb(struct dt_node *pd_dn, struct npu2_dev *ndev)
assert(mem_dn);
dt_add_property_cells(pd_dn, "memory-region", mem_dn->phandle);

gta = ((gpu_base >> 42) & 0x1) << 41;
gta |= ((gpu_base >> 45) & 0x3) << 42;
/* Coral mode address compression. This is documented in Figure 3.5
* "P9->GPU RA Compression (Coral) of the NPU2 workbook". */
gta = ((gpu_base >> 42) & 0x1) << 42;
gta |= ((gpu_base >> 45) & 0x3) << 43;
gta |= ((gpu_base >> 49) & 0x3) << 45;
gta |= gpu_base & ((1UL << 43) - 1);

Expand Down

0 comments on commit a2df920

Please sign in to comment.