mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-08-03 09:23:35 +00:00
DM USB: xHCI: [REVERTME] release memory on port resetting.
There is fd leakage during guest OS rebooting process, and this is a WA patch to fix it. Formal patch will be made later. Tracked-On: #4897 Signed-off-by: Xiaoguang Wu <xiaoguang.wu@intel.com>
This commit is contained in:
parent
1672eca2b9
commit
06d3f4bcb2
@ -1992,6 +1992,7 @@ pci_xhci_cmd_reset_device(struct pci_xhci_vdev *xdev, uint32_t slot)
|
|||||||
pci_xhci_reset_slot(xdev, slot);
|
pci_xhci_reset_slot(xdev, slot);
|
||||||
|
|
||||||
done:
|
done:
|
||||||
|
cmderr = XHCI_TRB_ERROR_SUCCESS;
|
||||||
return cmderr;
|
return cmderr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2064,6 +2065,7 @@ pci_xhci_cmd_address_device(struct pci_xhci_vdev *xdev,
|
|||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
di->slot = slot;
|
||||||
xdev->native_ports[index].state = VPORT_EMULATED;
|
xdev->native_ports[index].state = VPORT_EMULATED;
|
||||||
xdev->devices[rh_port] = dev;
|
xdev->devices[rh_port] = dev;
|
||||||
xdev->ndevices++;
|
xdev->ndevices++;
|
||||||
@ -3795,6 +3797,8 @@ pci_xhci_reset_port(struct pci_xhci_vdev *xdev, int portn, int warm)
|
|||||||
struct usb_native_devinfo *di;
|
struct usb_native_devinfo *di;
|
||||||
int speed, error;
|
int speed, error;
|
||||||
int index;
|
int index;
|
||||||
|
int slot;
|
||||||
|
struct pci_xhci_dev_emu *dev;
|
||||||
|
|
||||||
UPRINTF(LINF, "reset port %d\r\n", portn);
|
UPRINTF(LINF, "reset port %d\r\n", portn);
|
||||||
|
|
||||||
@ -3813,6 +3817,21 @@ pci_xhci_reset_port(struct pci_xhci_vdev *xdev, int portn, int warm)
|
|||||||
if (warm && di->bcd >= 0x300)
|
if (warm && di->bcd >= 0x300)
|
||||||
port->portsc |= XHCI_PS_WRC;
|
port->portsc |= XHCI_PS_WRC;
|
||||||
|
|
||||||
|
slot = di->slot;
|
||||||
|
if (xdev->slot_allocated[slot] && xdev->slots[slot]) {
|
||||||
|
dev = xdev->slots[slot];
|
||||||
|
|
||||||
|
UPRINTF(LWRN, "xgwu reset port %d, dev1 %p, dev2 %p\r\n",
|
||||||
|
portn, dev, xdev->devices[portn]);
|
||||||
|
|
||||||
|
if (dev && xdev->devices[portn] == dev) {
|
||||||
|
pci_xhci_dev_destroy(dev);
|
||||||
|
xdev->devices[portn] = NULL;
|
||||||
|
xdev->slots[slot] = NULL;
|
||||||
|
xdev->ndevices--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ((port->portsc & XHCI_PS_PRC) == 0) {
|
if ((port->portsc & XHCI_PS_PRC) == 0) {
|
||||||
port->portsc |= XHCI_PS_PRC;
|
port->portsc |= XHCI_PS_PRC;
|
||||||
|
|
||||||
|
@ -1094,10 +1094,6 @@ usb_dev_init(void *pdata, char *opt)
|
|||||||
goto errout;
|
goto errout;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (usb_dev_native_toggle_if_drivers(udev, 0) < 0) {
|
|
||||||
UPRINTF(LWRN, "fail to detach interface driver.\r\n");
|
|
||||||
goto errout;
|
|
||||||
}
|
|
||||||
return udev;
|
return udev;
|
||||||
|
|
||||||
errout:
|
errout:
|
||||||
|
@ -188,6 +188,7 @@ struct usb_native_devinfo {
|
|||||||
uint16_t bcd;
|
uint16_t bcd;
|
||||||
uint16_t pid;
|
uint16_t pid;
|
||||||
uint16_t vid;
|
uint16_t vid;
|
||||||
|
uint32_t slot;
|
||||||
enum usb_native_devtype type;
|
enum usb_native_devtype type;
|
||||||
struct usb_devpath path;
|
struct usb_devpath path;
|
||||||
void *priv_data;
|
void *priv_data;
|
||||||
|
Loading…
Reference in New Issue
Block a user