Giter Club home page Giter Club logo

Comments (10)

andre-richter avatar andre-richter commented on July 18, 2024

Interesting use case. One question: If you are unsure if the Vendor:Device device lives at the supplied domain address, why not parse the whole PCIe tree first to find it, and use the result to bind it with the current algorithm?

from vfio-pci-bind.

ljm42 avatar ljm42 commented on July 18, 2024

The difficulty is if you have two pieces of the same hardware, they will share the Vendor:Device code.

For instance, my motherboard has two Intel nics:

#lspci -n -d 8086:1533
02:00.0 0200: 8086:1533 (rev 03)
03:00.0 0200: 8086:1533 (rev 03)

(each with their own IOMMU group) so I need the pci address to distinguish them.

I thought about switching it and making the Vendor:Device be the required field and Domain:Bus:Device.Function be optional, but that would be a pretty invasive change and I didn't want to break backward compatibility.

Hmm... I suppose we don't have to break backward compatibility since we have regexes that can distinguish which parameter is which. It wouldn't be that invasive either... if you pass in just a Vendor:Device code we could use lcpci to determine the Domain:Bus:Device.Function and then the script can continue.

I'll take a crack at that.

The question is what should happen if you just pass a Vendor:Device code and there are multiple results:

  1. bind the first one
  2. loop through and bind them all
  3. throw an error and require you to specify a pci address too

I think I'll go with option 3.

from vfio-pci-bind.

andre-richter avatar andre-richter commented on July 18, 2024

Hmm... I suppose we don't have to break backward compatibility since we have regexes that can distinguish which parameter is which. It wouldn't be that invasive either... if you pass in just a Vendor:Device code we could use lcpci to determine the Domain:Bus:Device.Function and then the script can continue.

Should work. B:D.F and Vendor:Device can be distinguished fast through the "." character.

I'll take a crack at that.

The question is what should happen if you just pass a Vendor:Device code and there are multiple results:

1. bind the first one

2. loop through and bind them all

3. throw an error and require you to specify a pci address too

I think I'll go with option 3.

Agree with 3.

By the way, are you planning on keeping the Ruby script in sync too?

from vfio-pci-bind.

ljm42 avatar ljm42 commented on July 18, 2024

I like this!

  • If the user has a single Vendor:Device, they can provide that and it will be bound regardless of how the PCI address might change
  • If they have multiple Vendor:Devices, they can provide the Domain:Bus:Device.Function for the one they want to bind
  • For backwards compatibility, they can also provide a Domain:Bus:Device.Function to bind

What do you think, do you see any issues?

I'm sorry that I have no experience with Ruby, are you up for syncing the changes there?

from vfio-pci-bind.

andre-richter avatar andre-richter commented on July 18, 2024

Actually, I think the ruby user base for this script would be very minimal. We can just delete it for now and see if someone complains.

Would be great if you can add that to your PR please?

from vfio-pci-bind.

ljm42 avatar ljm42 commented on July 18, 2024

Sure thing. I also added more detail to the readme

from vfio-pci-bind.

andre-richter avatar andre-richter commented on July 18, 2024

Awesome, thanks, is this complete and tested from your side now? I won’t have time to test it myself the next few days. But if you say it’s good to go I’ll just merge it πŸ‘

from vfio-pci-bind.

ljm42 avatar ljm42 commented on July 18, 2024

I believe this is good to go. But I have limited hardware to test on, I don't mind waiting until you've had a chance to smoke test it.

from vfio-pci-bind.

andre-richter avatar andre-richter commented on July 18, 2024

Thanks for all your work! Merged it πŸ‘

from vfio-pci-bind.

ljm42 avatar ljm42 commented on July 18, 2024

Great! Thanks!

from vfio-pci-bind.

Related Issues (4)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.