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

Add PCI BDF and ACS information to switchtec status command #25

Merged
merged 6 commits into from
Sep 10, 2018

Conversation

lsgunth
Copy link
Collaborator

@lsgunth lsgunth commented Jun 28, 2018

Hi,

For the P2P applications we are working on it is useful to quickly know the ACS status for all the dowstream ports (DSPs). We're also working on a patchset for the Linux kernel to disable ACS for a set of DSPs using a command line parameter. For this, it is useful to know the BDF for the DSP that we need to disable ACS for. It's also recommended to use a BDF path to address a device which is more stable to renumbering concerns (see the Linux pathset for more information).

Patch 1 and 2 in this series add the port's BDF and BDF path to the status structure. Patch 3 prints this information in the 'switchtec status' command. Patch 4 and 5 are to parse the PCI configuration structure to obtain the ACS register for the port and the final patch prints that information in switchtec status.

This patchset passes Travis.

Thanks,

Logan

This is the BDF of the port not the device (which was there previously)

Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
The Bus-Device-Function path is another way of representing the PCI
address of a device. Instead of using the full BDF of the device,
use the BDF of a base device followed by a path of device and functions.

This is similar to the "device scope" structure in the Intel VT-d
spec, Section 8.3.1. It will also be useful for specifying the
switch ports on the command line to disable ACS in the system.

Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
Also, add a verbose flag which, when set, the BDF path is also displayed.

Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
This will be used to print the ACS control register in the switchtec
status command.

Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
In order to print the ACS register in the status flag we parse
the PCI config space when get_devices is called. The config space
is parsed for each down stream port.

Note: the config space can only be read with root priviliges so
the acs_ctrl field will be set to -1 if we were unable to read or
parse the config space for any reason.

Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
If available, print the ACS information for each port in the status
command.

Also, add a verbose flag. If given, the ACS information is printed
similar to lspci, if not it just states whether P2P is direct or
redirected.

Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
@lsgunth
Copy link
Collaborator Author

lsgunth commented Jul 13, 2018

I've rebased the commits onto the latest devel branch to satisfy the conflict. But it's been two weeks since I submitted this and haven't heard anything. Can you guys please review and let me know?

Thanks

Logan

@ghost ghost assigned ghost and unassigned ghost Jul 15, 2018
Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

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

Hi Logan,
I tested your patches. I found two issues.

(1) switchtec-user get incorrect port count. To fix it, The line 326 (lib/switchtec.c, Function switchtec_status() ) should be a break. And we should add another check.

  •   if ((ports[i].phys_port_id == 0) && (i != 0)) 
    
  •   	break; 
    

(2) switchtec-user does not show the BDF and ACS information of cascaded Switchtec. I attached a picture.
bdf_acs_info

@ghost
Copy link

ghost commented Jul 15, 2018

For the first issue. I reopen the pull request. #23

@ghost
Copy link

ghost commented Jul 15, 2018

For issue 2. my test setup is
Host <- -> (Port 40, partition 0) PSX-1 (Port 24, partition 1) <- -> (Port 32, partition 1) PSX-1

@lsgunth
Copy link
Collaborator Author

lsgunth commented Jul 15, 2018

As you point out, issue 1 is unrelated to this patch set.

Issue 2 isn't fixable. We can only print the ACS information for ports attached to the current host. We can't do so (and really have no interest in doing so) for ports in another partition attached to a different host.

@sbates130272
Copy link
Collaborator

Since this PR is now approved can it be pulled into this repo? I have some other PRs in progress that depend on this. Thanks!

@wesleywesley
Copy link
Contributor

@sbates130272
We will hold this pull request until the recent SW release at the end of Aug.

@wesleywesley wesleywesley merged commit a62575e into Microsemi:devel Sep 10, 2018
@lsgunth lsgunth deleted the status_acs branch March 1, 2019 18:33
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.

3 participants