Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F174196104
D60188.id188285.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D60188.id188285.diff
View Options
diff --git a/sys/amd64/vmm/io/ppt.c b/sys/amd64/vmm/io/ppt.c
--- a/sys/amd64/vmm/io/ppt.c
+++ b/sys/amd64/vmm/io/ppt.c
@@ -90,7 +90,7 @@
struct pptdev {
device_t dev;
struct vm *vm; /* owner of this device */
- bool resetting; /* guest FLR in progress */
+ bool resetting; /* reset in progress */
TAILQ_ENTRY(pptdev) next;
struct pptseg mmio[MAX_MMIOSEGS];
struct {
@@ -252,10 +252,10 @@
break;
/*
* Once resetting is set, every exit from ppt_reset_device()
- * reacquires ppt_mtx, clears resetting, and wakes us. The FLR wait
- * itself is bounded.
+ * and ppt_assign_device() reacquires ppt_mtx, clears resetting,
+ * and wakes us. The wait itself is bounded.
*/
- sx_sleep(ppt, &ppt_mtx, 0, "pptflr", 0);
+ sx_sleep(ppt, &ppt_mtx, 0, "pptrst", 0);
}
*pptp = ppt;
@@ -439,20 +439,30 @@
/* Passing NULL requires the device to be unowned. */
error = ppt_find(NULL, bus, slot, func, &ppt);
if (error != 0)
- goto out;
+ goto out_locked;
+
+ ppt->resetting = true;
+ ppt->vm = vm;
+ PPT_UNLOCK();
pci_save_state(ppt->dev);
ppt_pci_reset(ppt->dev);
pci_restore_state(ppt->dev);
+ PPT_LOCK();
+
error = iommu_add_device(vm_iommu_domain(vm), ppt->dev,
pci_get_rid(ppt->dev));
if (error != 0)
- goto out;
- ppt->vm = vm;
+ goto out_reset;
cmd = pci_read_config(ppt->dev, PCIR_COMMAND, 2);
cmd |= PCIM_CMD_BUSMASTEREN | ppt_bar_enables(ppt);
pci_write_config(ppt->dev, PCIR_COMMAND, cmd, 2);
-out:
+out_reset:
+ if (error != 0)
+ ppt->vm = NULL;
+ ppt->resetting = false;
+ wakeup(ppt);
+out_locked:
PPT_UNLOCK();
return (error);
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Oct 2, 7:20 AM (18 h, 23 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
40054671
Default Alt Text
D60188.id188285.diff (1 KB)
Attached To
Mode
D60188: vmm: don't hold the global PPT lock while resetting a device for assignment
Attached
Detach File
Event Timeline
Log In to Comment