Message ID | 20180205064626.47818-1-aik@ozlabs.ru |
---|---|
State | Accepted |
Headers | show |
Series | npu2/tce: Fix page size checking | expand |
Good catch! Thanks Alexey. Stewart this should probably go into whatever stable branches we have too. Acked-By: Alistair Popple <alistair@popple.id.au> On Monday, 5 February 2018 5:46:26 PM AEDT Alexey Kardashevskiy wrote: > The page size is encoded in the TVT data [59:63] as @shift+11 but > the tce_kill handler does not do the math right; this fixes it. > > Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru> > --- > hw/npu2.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/hw/npu2.c b/hw/npu2.c > index c88394b..806f848 100644 > --- a/hw/npu2.c > +++ b/hw/npu2.c > @@ -1256,7 +1256,9 @@ static int64_t npu2_tce_kill(struct phb *phb, uint32_t kill_type, > sync(); > switch(kill_type) { > case OPAL_PCI_TCE_KILL_PAGES: > - tce_page_size = GETFIELD(npu->tve_cache[pe_number], NPU2_ATS_IODA_TBL_TVT_PSIZE); > + tce_page_size = 1ULL << ( > + 11 + GETFIELD(npu->tve_cache[pe_number], > + NPU2_ATS_IODA_TBL_TVT_PSIZE)); > if (tce_page_size != tce_size) { > NPU2ERR(npu, "npu2_tce_kill: Unexpected TCE size (got 0x%x expected 0x%x)\n", > tce_size, tce_page_size); >
Alexey Kardashevskiy <aik@ozlabs.ru> writes: > The page size is encoded in the TVT data [59:63] as @shift+11 but > the tce_kill handler does not do the math right; this fixes it. > > Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru> Thanks! Merged to master as of 893660c3e4ee52f5c3cba6e9d72c00d5e3283808. Seeing as we're not really keeping around a 5.9.x anymore for any stable tree, I haven't cherry-picked it back there. Having said that, somebody is going to ask for it now :)
diff --git a/hw/npu2.c b/hw/npu2.c index c88394b..806f848 100644 --- a/hw/npu2.c +++ b/hw/npu2.c @@ -1256,7 +1256,9 @@ static int64_t npu2_tce_kill(struct phb *phb, uint32_t kill_type, sync(); switch(kill_type) { case OPAL_PCI_TCE_KILL_PAGES: - tce_page_size = GETFIELD(npu->tve_cache[pe_number], NPU2_ATS_IODA_TBL_TVT_PSIZE); + tce_page_size = 1ULL << ( + 11 + GETFIELD(npu->tve_cache[pe_number], + NPU2_ATS_IODA_TBL_TVT_PSIZE)); if (tce_page_size != tce_size) { NPU2ERR(npu, "npu2_tce_kill: Unexpected TCE size (got 0x%x expected 0x%x)\n", tce_size, tce_page_size);
The page size is encoded in the TVT data [59:63] as @shift+11 but the tce_kill handler does not do the math right; this fixes it. Signed-off-by: Alexey Kardashevskiy <aik@ozlabs.ru> --- hw/npu2.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)