diff mbox series

[1/2] libpdbg: Fix address translation for p9 chiplet

Message ID 20200306045516.382647-1-amitay@ozlabs.org
State Accepted
Headers show
Series [1/2] libpdbg: Fix address translation for p9 chiplet | expand

Checks

Context Check Description
snowpatch_ozlabs/apply_patch fail Failed to apply to any branch
snowpatch_ozlabs/apply_patch warning Failed to apply on branch master (8b4611b5d8e7e2279fe4aa80c892fcfe10aa398d)

Commit Message

Amitay Isaacs March 6, 2020, 4:55 a.m. UTC
Signed-off-by: Amitay Isaacs <amitay@ozlabs.org>
---
 libpdbg/p9chip.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Alistair Popple March 10, 2020, 5:51 a.m. UTC | #1
On Friday, 6 March 2020 3:55:15 PM AEDT Amitay Isaacs wrote:
> Signed-off-by: Amitay Isaacs <amitay@ozlabs.org>
> ---
>  libpdbg/p9chip.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/libpdbg/p9chip.c b/libpdbg/p9chip.c
> index da7ed00..c82f00e 100644
> --- a/libpdbg/p9chip.c
> +++ b/libpdbg/p9chip.c
> @@ -599,7 +599,7 @@ static int p9_chiplet_probe(struct pdbg_target *target)
> 
>  static uint64_t p9_chiplet_translate(struct pdbg_target *target, uint64_t
> addr) {
> -	return addr + pdbg_target_address(target, NULL);
> +	return (addr & 0xc0ffffff) + pdbg_target_address(target, NULL);

Any reason you didn't use 0xffffffffc0ffffff to match what p9_scom_addr.H does? Not 
sure if any of the other bits are used in this context, but it wouldn't be the 
first time we have been burnt with mismatched address translation.

- Alistair

>  }
> 
>  static struct chiplet p9_chiplet = {
Amitay Isaacs March 10, 2020, 6:10 a.m. UTC | #2
On Tue, 2020-03-10 at 16:51 +1100, Alistair Popple wrote:
> On Friday, 6 March 2020 3:55:15 PM AEDT Amitay Isaacs wrote:
> > Signed-off-by: Amitay Isaacs <amitay@ozlabs.org>
> > ---
> >  libpdbg/p9chip.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/libpdbg/p9chip.c b/libpdbg/p9chip.c
> > index da7ed00..c82f00e 100644
> > --- a/libpdbg/p9chip.c
> > +++ b/libpdbg/p9chip.c
> > @@ -599,7 +599,7 @@ static int p9_chiplet_probe(struct pdbg_target
> > *target)
> > 
> >  static uint64_t p9_chiplet_translate(struct pdbg_target *target,
> > uint64_t
> > addr) {
> > -	return addr + pdbg_target_address(target, NULL);
> > +	return (addr & 0xc0ffffff) + pdbg_target_address(target, NULL);
> 
> Any reason you didn't use 0xffffffffc0ffffff to match what
> p9_scom_addr.H does? Not 
> sure if any of the other bits are used in this context, but it
> wouldn't be the 
> first time we have been burnt with mismatched address translation.

Well our tests only used the addresses up to 0xffffffff and nothing
beyond that.  And up to those addressess the 32-bit mask was good
enough.  I was trying to figure out how the addressing worked, but
figured out the mask by trial and error. :-)

Let's use the 64-bit mask as is supposed to be.

> 
> - Alistair
> 
> >  }
> > 
> >  static struct chiplet p9_chiplet = {
> 
> 
> 

Amitay.
diff mbox series

Patch

diff --git a/libpdbg/p9chip.c b/libpdbg/p9chip.c
index da7ed00..c82f00e 100644
--- a/libpdbg/p9chip.c
+++ b/libpdbg/p9chip.c
@@ -599,7 +599,7 @@  static int p9_chiplet_probe(struct pdbg_target *target)
 
 static uint64_t p9_chiplet_translate(struct pdbg_target *target, uint64_t addr)
 {
-	return addr + pdbg_target_address(target, NULL);
+	return (addr & 0xc0ffffff) + pdbg_target_address(target, NULL);
 }
 
 static struct chiplet p9_chiplet = {