Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tpart_vec returns 1s for non-existent partitions using Tegra TX2 processor #81

Open
jmpallotta opened this issue Nov 27, 2019 · 5 comments

Comments

@jmpallotta
Copy link
Contributor

In switchtec_ntb_init_sndev, tpart_vec reads 0x0000FFFFFFFFFFE for partition 0 in a 2 partition configuration (2 NT endpoints). It seems as though the driver is expecting it to read 0x2. When 0x0000FFFFFFFFFFFE is read, the init fails the following check.

if (__ffs64(tpart_vec) != (fls64(tpart_vec) - 1)) {
  dev_err(&sndev->stdev->dev,
    "ntb driver only supports 1 pair of 1-1 ntb mapping\n");
  return -ENODEV;
}

I suggest the following modification to tpart_vec. This would use the ep_map register to mask the valid bits within tpart_vec.

    part_map = ioread64(&sndev->mmio_ntb->ep_map);
    tpart_vec = ioread32(&sndev->mmio_ntb->ntp_info[self].target_part_high);
    tpart_vec <<= 32;
    tpart_vec |= ioread32(&sndev->mmio_ntb->ntp_info[self].target_part_low);
    tpart_vec &= part_map;
@lsgunth
Copy link
Collaborator

lsgunth commented Nov 27, 2019

I wonder if this is a firmware bug. Doesn't seem like tpart_vec should be returning with other bits set. I suspect the bug is new seeing otherwise it would have never worked at all.

But masking it in software seems like a good workaround. Again, a patch would be appreciated.

@jmpallotta
Copy link
Contributor Author

Patch is attached. Based upon latest on master branch.

tpart_vec_mask.patch.txt

@lsgunth
Copy link
Collaborator

lsgunth commented Nov 27, 2019

Um, can you do it in git? And submit a PR?

@jmpallotta
Copy link
Contributor Author

How do I get permission to push to the repository? When I try to push a new branch, I get "permission denied". Sorry, this is the first time that I have contributed to this project and not sure how it works.

@lsgunth
Copy link
Collaborator

lsgunth commented Dec 2, 2019

You need to create a fork and push to it. Once you have a branch there you can submit a pull request back to our tree. See this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants