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

pcidev: On arm64 we are not getting a valid BAR0 address #136

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

martijnberger
Copy link

It seems that there is some code to work around a possible bug in
old versions of libpci. This trusts libpci if it is new enough

Change-Id: I8bd32c6344b0831a949c3853abeb84905420922a
Signed-off-by: Martijn Berger martijn.berger@gmail.com

Copy link
Contributor

@dhendrix dhendrix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! There seems to be a typo, but otherwise the patch looks pretty good.

It would be nice if we can add some context. The original workaround was added in 4059598 and cited libpci 2.2.8 as a problematic version. However I took a quick look at it and am not sure where the issue got fixed... pci_generic_fill_info() in libpci seems to be basically unchanged since 2.2.8. Did you have a chance to look into it deeper?

programmer.h Outdated Show resolved Hide resolved

/* Don't use dev->base_addr[x] (as value for 'bar'), won't work on older libpci. */
addr = pci_read_long(dev, bar);
if (PCI_LIB_VERSION >= 0x030500 && bar_number > -1) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any particular reason to choose 3.5.0?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, just that on my platform ( arm64) , that was the lowest version i tried.

@martijnberger
Copy link
Author

Another way way that I can see is to only do this on ARM64.
The main problem here seems to be that the 32 bit BAR address is actually 64 bits to the host as a result of how the memory is layed out.

I was looking into how lspci did come up with the correct value.

It seems that there is some code to work around a possible bug in
old versions of libpci. This trusts libpci if it is new enough

Change-Id: I8bd32c6344b0831a949c3853abeb84905420922a
Signed-off-by: Martijn Berger <martijn.berger@gmail.com>
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

Successfully merging this pull request may close these issues.

None yet

2 participants