Commit d1cae69
nvme_vfio: fix first vfio-pci bind failure by using driver_override
The old bind_vfio_pci() used new_id + bind to attach a device to
vfio-pci. Writing to new_id triggers auto-probe which races with
the subsequent bind write, causing EBUSY on the first attempt.
The second attempt succeeds because setup_vfio_binding() sees the
device already bound to vfio-pci from the auto-probe.
Switch to driver_override + drivers_probe which is the recommended
kernel mechanism for targeted device-driver binding:
- No auto-probe race: drivers_probe is a single synchronous operation
- Device-scoped: only affects the specific PCI device, not all devices
with the same vendor:device ID
- Simpler: no need to read vendor/device IDs from sysfs
Signed-off-by: Ming Lei <ming.lei@redhat.com>1 parent 204e5b3 commit d1cae69
1 file changed
Lines changed: 20 additions & 54 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
520 | 520 | | |
521 | 521 | | |
522 | 522 | | |
523 | | - | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
524 | 530 | | |
525 | 531 | | |
526 | | - | |
527 | | - | |
| 532 | + | |
528 | 533 | | |
529 | 534 | | |
530 | | - | |
| 535 | + | |
531 | 536 | | |
532 | | - | |
533 | | - | |
| 537 | + | |
| 538 | + | |
534 | 539 | | |
535 | | - | |
| 540 | + | |
536 | 541 | | |
537 | 542 | | |
538 | | - | |
539 | | - | |
| 543 | + | |
| 544 | + | |
540 | 545 | | |
541 | 546 | | |
542 | 547 | | |
543 | 548 | | |
544 | | - | |
545 | 549 | | |
546 | | - | |
547 | | - | |
548 | | - | |
| 550 | + | |
| 551 | + | |
549 | 552 | | |
550 | | - | |
| 553 | + | |
551 | 554 | | |
552 | 555 | | |
553 | | - | |
554 | | - | |
| 556 | + | |
| 557 | + | |
555 | 558 | | |
556 | 559 | | |
557 | 560 | | |
558 | 561 | | |
559 | | - | |
560 | | - | |
561 | | - | |
562 | | - | |
563 | | - | |
564 | | - | |
565 | | - | |
566 | | - | |
567 | | - | |
568 | | - | |
569 | | - | |
570 | | - | |
571 | | - | |
572 | | - | |
573 | | - | |
574 | | - | |
575 | | - | |
576 | | - | |
577 | | - | |
578 | | - | |
579 | | - | |
580 | | - | |
581 | | - | |
582 | | - | |
583 | | - | |
584 | | - | |
585 | | - | |
586 | | - | |
587 | | - | |
588 | | - | |
589 | | - | |
590 | | - | |
591 | | - | |
592 | | - | |
593 | | - | |
594 | | - | |
595 | | - | |
596 | 562 | | |
597 | | - | |
| 563 | + | |
598 | 564 | | |
599 | 565 | | |
600 | 566 | | |
| |||
0 commit comments