genode/repos/dde_linux/patches/usb_host_mem.patch

494 lines
16 KiB
Diff

diff --git a/drivers/usb/core/config.c b/drivers/usb/core/config.c
index c821b4b..5accd4d 100644
--- a/drivers/usb/core/config.c
+++ b/drivers/usb/core/config.c
@@ -706,7 +706,7 @@ static int usb_parse_configuration(struct usb_device *dev, int cfgidx,
}
len = sizeof(*intfc) + sizeof(struct usb_host_interface) * j;
- config->intf_cache[i] = intfc = kzalloc(len, GFP_KERNEL);
+ config->intf_cache[i] = intfc = kzalloc(len, GFP_LX_DMA);
if (!intfc)
return -ENOMEM;
kref_init(&intfc->ref);
@@ -817,16 +817,16 @@ int usb_get_configuration(struct usb_device *dev)
}
length = ncfg * sizeof(struct usb_host_config);
- dev->config = kzalloc(length, GFP_KERNEL);
+ dev->config = kzalloc(length, GFP_LX_DMA);
if (!dev->config)
goto err2;
length = ncfg * sizeof(char *);
- dev->rawdescriptors = kzalloc(length, GFP_KERNEL);
+ dev->rawdescriptors = kzalloc(length, GFP_LX_DMA);
if (!dev->rawdescriptors)
goto err2;
- desc = kmalloc(USB_DT_CONFIG_SIZE, GFP_KERNEL);
+ desc = kmalloc(USB_DT_CONFIG_SIZE, GFP_LX_DMA);
if (!desc)
goto err2;
@@ -855,7 +855,7 @@ int usb_get_configuration(struct usb_device *dev)
USB_DT_CONFIG_SIZE);
/* Now that we know the length, get the whole thing */
- bigbuffer = kmalloc(length, GFP_KERNEL);
+ bigbuffer = kmalloc(length, GFP_LX_DMA);
if (!bigbuffer) {
result = -ENOMEM;
goto err;
@@ -928,7 +928,7 @@ int usb_get_bos_descriptor(struct usb_device *dev)
__u8 cap_type;
int ret;
- bos = kzalloc(sizeof(struct usb_bos_descriptor), GFP_KERNEL);
+ bos = kzalloc(sizeof(struct usb_bos_descriptor), GFP_LX_DMA);
if (!bos)
return -ENOMEM;
@@ -949,12 +949,12 @@ int usb_get_bos_descriptor(struct usb_device *dev)
if (total_len < length)
return -EINVAL;
- dev->bos = kzalloc(sizeof(struct usb_host_bos), GFP_KERNEL);
+ dev->bos = kzalloc(sizeof(struct usb_host_bos), GFP_LX_DMA);
if (!dev->bos)
return -ENOMEM;
/* Now let's get the whole BOS descriptor set */
- buffer = kzalloc(total_len, GFP_KERNEL);
+ buffer = kzalloc(total_len, GFP_LX_DMA);
if (!buffer) {
ret = -ENOMEM;
goto err;
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
index fc32391..919c9e9 100644
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -507,7 +507,7 @@ static int rh_call_control (struct usb_hcd *hcd, struct urb *urb)
* USB hub descriptor.
*/
tbuf_size = max_t(u16, sizeof(struct usb_hub_descriptor), wLength);
- tbuf = kzalloc(tbuf_size, GFP_KERNEL);
+ tbuf = kzalloc(tbuf_size, GFP_LX_DMA);
if (!tbuf) {
status = -ENOMEM;
goto err_alloc;
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c
index c5c1f6c..5bd400f 100644
--- a/drivers/usb/core/hub.c
+++ b/drivers/usb/core/hub.c
@@ -706,7 +706,7 @@ resubmit:
if (hub->quiescing)
return;
- status = usb_submit_urb(hub->urb, GFP_ATOMIC);
+ status = usb_submit_urb(hub->urb, GFP_LX_DMA);
if (status != 0 && status != -ENODEV && status != -EPERM)
dev_err(hub->intfdev, "resubmit --> %d\n", status);
}
@@ -1310,20 +1310,20 @@ static int hub_configure(struct usb_hub *hub,
unsigned full_load;
unsigned maxchild;
- hub->buffer = kmalloc(sizeof(*hub->buffer), GFP_KERNEL);
+ hub->buffer = kmalloc(sizeof(*hub->buffer), GFP_LX_DMA);
if (!hub->buffer) {
ret = -ENOMEM;
goto fail;
}
- hub->status = kmalloc(sizeof(*hub->status), GFP_KERNEL);
+ hub->status = kmalloc(sizeof(*hub->status), GFP_LX_DMA);
if (!hub->status) {
ret = -ENOMEM;
goto fail;
}
mutex_init(&hub->status_mutex);
- hub->descriptor = kzalloc(sizeof(*hub->descriptor), GFP_KERNEL);
+ hub->descriptor = kzalloc(sizeof(*hub->descriptor), GFP_LX_DMA);
if (!hub->descriptor) {
ret = -ENOMEM;
goto fail;
@@ -1565,7 +1565,7 @@ static int hub_configure(struct usb_hub *hub,
if (maxp > sizeof(*hub->buffer))
maxp = sizeof(*hub->buffer);
- hub->urb = usb_alloc_urb(0, GFP_KERNEL);
+ hub->urb = usb_alloc_urb(0, GFP_LX_DMA);
if (!hub->urb) {
ret = -ENOMEM;
goto fail;
@@ -4713,7 +4713,7 @@ check_highspeed(struct usb_hub *hub, struct usb_device *udev, int port1)
if (udev->quirks & USB_QUIRK_DEVICE_QUALIFIER)
return;
- qual = kmalloc(sizeof *qual, GFP_KERNEL);
+ qual = kmalloc(sizeof *qual, GFP_LX_DMA);
if (qual == NULL)
return;
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c
index b3f98e0..3442858 100644
--- a/drivers/usb/core/message.c
+++ b/drivers/usb/core/message.c
@@ -237,7 +237,7 @@ int usb_bulk_msg(struct usb_device *usb_dev, unsigned int pipe,
if (!ep || len < 0)
return -EINVAL;
- urb = usb_alloc_urb(0, GFP_KERNEL);
+ urb = usb_alloc_urb(0, GFP_LX_DMA);
if (!urb)
return -ENOMEM;
@@ -990,7 +989,7 @@ int usb_get_status(struct usb_device *dev, int recip, int type, int target,
return -EINVAL;
}
- status = kmalloc(length, GFP_KERNEL);
+ status = kmalloc(length, GFP_LX_DMA);
if (!status)
return -ENOMEM;
@@ -2084,7 +2083,7 @@ int usb_driver_set_configuration(struct usb_device *udev, int config)
{
struct set_config_request *req;
- req = kmalloc(sizeof(*req), GFP_KERNEL);
+ req = kmalloc(sizeof(*req), GFP_LX_DMA);
if (!req)
return -ENOMEM;
req->udev = udev;
diff --git a/drivers/usb/host/ehci-hub.c b/drivers/usb/host/ehci-hub.c
index 0a84661..f427b75 100644
--- a/drivers/usb/host/ehci-hub.c
+++ b/drivers/usb/host/ehci-hub.c
@@ -749,7 +749,7 @@ static struct urb *request_single_step_set_feature_urb(
struct usb_hcd *hcd = bus_to_hcd(udev->bus);
struct usb_host_endpoint *ep;
- urb = usb_alloc_urb(0, GFP_KERNEL);
+ urb = usb_alloc_urb(0, GFP_LX_DMA);
if (!urb)
return NULL;
@@ -804,11 +803,11 @@ static int ehset_single_step_set_feature(struct usb_hcd *hcd, int port)
ehci_err(ehci, "No device attached to the RootHub\n");
return -ENODEV;
}
- buf = kmalloc(USB_DT_DEVICE_SIZE, GFP_KERNEL);
+ buf = kmalloc(USB_DT_DEVICE_SIZE, GFP_LX_DMA);
if (!buf)
return -ENOMEM;
- dr = kmalloc(sizeof(struct usb_ctrlrequest), GFP_KERNEL);
+ dr = kmalloc(sizeof(struct usb_ctrlrequest), GFP_LX_DMA);
if (!dr) {
kfree(buf);
return -ENOMEM;
diff --git a/drivers/usb/host/ehci-q.c b/drivers/usb/host/ehci-q.c
index 3276304..8b9e337 100644
--- a/drivers/usb/host/ehci-q.c
+++ b/drivers/usb/host/ehci-q.c
@@ -1020,7 +1020,7 @@ static struct ehci_qh *qh_append_tds (
qh = (struct ehci_qh *) *ptr;
if (unlikely (qh == NULL)) {
/* can't sleep here, we have ehci->lock... */
- qh = qh_make (ehci, urb, GFP_ATOMIC);
+ qh = qh_make (ehci, urb, GFP_LX_DMA);
*ptr = qh;
}
if (likely (qh != NULL)) {
@@ -1172,7 +1172,7 @@ static int submit_single_step_set_feature(
head = &qtd_list;
/* URBs map to sequences of QTDs: one logical transaction */
- qtd = ehci_qtd_alloc(ehci, GFP_KERNEL);
+ qtd = ehci_qtd_alloc(ehci, GFP_LX_DMA);
if (unlikely(!qtd))
return -1;
list_add_tail(&qtd->qtd_list, head);
@@ -1193,7 +1193,7 @@ static int submit_single_step_set_feature(
sizeof(struct usb_ctrlrequest),
QTD_IOC | token | (2 /* "setup" */ << 8), 8);
- submit_async(ehci, urb, &qtd_list, GFP_ATOMIC);
+ submit_async(ehci, urb, &qtd_list, GFP_LX_DMA);
return 0; /*Return now; we shall come back after 15 seconds*/
}
@@ -1221,7 +1221,7 @@ static int submit_single_step_set_feature(
token |= QTD_TOGGLE; /* force DATA1 */
qtd_prev = qtd;
- qtd = ehci_qtd_alloc(ehci, GFP_ATOMIC);
+ qtd = ehci_qtd_alloc(ehci, GFP_LX_DMA);
if (unlikely(!qtd))
goto cleanup;
qtd->urb = urb;
@@ -1231,7 +1231,7 @@ static int submit_single_step_set_feature(
/* Interrupt after STATUS completion */
qtd_fill(ehci, qtd, 0, 0, token | QTD_IOC, 0);
- submit_async(ehci, urb, &qtd_list, GFP_KERNEL);
+ submit_async(ehci, urb, &qtd_list, GFP_LX_DMA);
return 0;
diff --git a/drivers/usb/host/ohci-dbg.c b/drivers/usb/host/ohci-dbg.c
index ac7d4ac..1eb1fc7 100644
--- a/drivers/usb/host/ohci-dbg.c
+++ b/drivers/usb/host/ohci-dbg.c
@@ -683,7 +683,7 @@ static int fill_buffer(struct debug_buffer *buf)
int ret = 0;
if (!buf->page)
- buf->page = (char *)get_zeroed_page(GFP_KERNEL);
+ buf->page = (char *)get_zeroed_page(GFP_LX_DMA);
if (!buf->page) {
ret = -ENOMEM;
diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
index d088c34..2211b20 100644
--- a/drivers/usb/host/ohci-hcd.c
+++ b/drivers/usb/host/ohci-hcd.c
@@ -506,7 +506,7 @@ static int ohci_init (struct ohci_hcd *ohci)
ohci->prev_frame_no = IO_WATCHDOG_OFF;
ohci->hcca = dma_alloc_coherent (hcd->self.controller,
- sizeof(*ohci->hcca), &ohci->hcca_dma, GFP_KERNEL);
+ sizeof(*ohci->hcca), &ohci->hcca_dma, GFP_LX_DMA);
if (!ohci->hcca)
return -ENOMEM;
diff --git a/drivers/usb/host/uhci-hcd.c b/drivers/usb/host/uhci-hcd.c
index f9c3947..99a1696 100644
--- a/drivers/usb/host/uhci-hcd.c
+++ b/drivers/usb/host/uhci-hcd.c
@@ -602,7 +602,7 @@ static int uhci_start(struct usb_hcd *hcd)
uhci->frame = dma_zalloc_coherent(uhci_dev(uhci),
UHCI_NUMFRAMES * sizeof(*uhci->frame),
- &uhci->frame_dma_handle, GFP_KERNEL);
+ &uhci->frame_dma_handle, GFP_LX_DMA);
if (!uhci->frame) {
dev_err(uhci_dev(uhci),
"unable to allocate consistent memory for frame list\n");
@@ -610,7 +610,7 @@ static int uhci_start(struct usb_hcd *hcd)
}
uhci->frame_cpu = kcalloc(UHCI_NUMFRAMES, sizeof(*uhci->frame_cpu),
- GFP_KERNEL);
+ GFP_LX_DMA);
if (!uhci->frame_cpu)
goto err_alloc_frame_cpu;
diff --git a/drivers/usb/host/uhci-q.c b/drivers/usb/host/uhci-q.c
index 35fcb82..3a0cff5 100644
--- a/drivers/usb/host/uhci-q.c
+++ b/drivers/usb/host/uhci-q.c
@@ -108,7 +108,7 @@ static struct uhci_td *uhci_alloc_td(struct uhci_hcd *uhci)
dma_addr_t dma_handle;
struct uhci_td *td;
- td = dma_pool_alloc(uhci->td_pool, GFP_ATOMIC, &dma_handle);
+ td = dma_pool_alloc(uhci->td_pool, GFP_LX_DMA, &dma_handle);
if (!td)
return NULL;
@@ -248,7 +248,7 @@ static struct uhci_qh *uhci_alloc_qh(struct uhci_hcd *uhci,
dma_addr_t dma_handle;
struct uhci_qh *qh;
- qh = dma_pool_zalloc(uhci->qh_pool, GFP_ATOMIC, &dma_handle);
+ qh = dma_pool_zalloc(uhci->qh_pool, GFP_LX_DMA, &dma_handle);
if (!qh)
return NULL;
@@ -724,7 +724,7 @@ static inline struct urb_priv *uhci_alloc_urb_priv(struct uhci_hcd *uhci,
{
struct urb_priv *urbp;
- urbp = kmem_cache_zalloc(uhci_up_cachep, GFP_ATOMIC);
+ urbp = kmem_cache_zalloc(uhci_up_cachep, GFP_LX_DMA);
if (!urbp)
return NULL;
diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c
index 72ebbc9..0e815a8 100644
--- a/drivers/usb/host/xhci-hub.c
+++ b/drivers/usb/host/xhci-hub.c
@@ -404,7 +404,7 @@ static int xhci_stop_device(struct xhci_hcd *xhci, int slot_id, int suspend)
if (GET_EP_CTX_STATE(ep_ctx) != EP_STATE_RUNNING)
continue;
- command = xhci_alloc_command(xhci, false, GFP_NOWAIT);
+ command = xhci_alloc_command(xhci, false, GFP_LX_DMA);
if (!command) {
spin_unlock_irqrestore(&xhci->lock, flags);
ret = -ENOMEM;
diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c
index 332420d..e037aaf 100644
--- a/drivers/usb/host/xhci-mem.c
+++ b/drivers/usb/host/xhci-mem.c
@@ -2135,7 +2135,7 @@ static void xhci_add_in_port(struct xhci_hcd *xhci, unsigned int num_ports,
rhub->psi_count = XHCI_EXT_PORT_PSIC(temp);
if (rhub->psi_count) {
rhub->psi = kcalloc(rhub->psi_count, sizeof(*rhub->psi),
- GFP_KERNEL);
+ GFP_LX_DMA);
if (!rhub->psi)
rhub->psi_count = 0;
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index daa94c3..028891a 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -1141,7 +1141,7 @@ static void xhci_handle_cmd_reset_ep(struct xhci_hcd *xhci, int slot_id,
if (xhci->quirks & XHCI_RESET_EP_QUIRK) {
struct xhci_command *command;
- command = xhci_alloc_command(xhci, false, GFP_ATOMIC);
+ command = xhci_alloc_command(xhci, false, GFP_LX_DMA);
if (!command)
return;
@@ -1821,7 +1821,7 @@ static void xhci_cleanup_halted_endpoint(struct xhci_hcd *xhci,
{
struct xhci_virt_ep *ep = &xhci->devs[slot_id]->eps[ep_index];
struct xhci_command *command;
- command = xhci_alloc_command(xhci, false, GFP_ATOMIC);
+ command = xhci_alloc_command(xhci, false, GFP_LX_DMA);
if (!command)
return;
@@ -3906,7 +3906,7 @@ static int queue_command(struct xhci_hcd *xhci, struct xhci_command *cmd,
reserved_trbs++;
ret = prepare_ring(xhci, xhci->cmd_ring, EP_STATE_RUNNING,
- reserved_trbs, GFP_ATOMIC);
+ reserved_trbs, GFP_LX_DMA);
if (ret < 0) {
xhci_err(xhci, "ERR: No room for command on command ring\n");
if (command_must_succeed)
@@ -4040,7 +4040,7 @@ void xhci_queue_new_dequeue_state(struct xhci_hcd *xhci,
}
/* This function gets called from contexts where it cannot sleep */
- cmd = xhci_alloc_command(xhci, false, GFP_ATOMIC);
+ cmd = xhci_alloc_command(xhci, false, GFP_LX_DMA);
if (!cmd)
return;
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index 5d37700..1945abb 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -602,7 +604,7 @@ int xhci_run(struct usb_hcd *hcd)
if (xhci->quirks & XHCI_NEC_HOST) {
struct xhci_command *command;
- command = xhci_alloc_command(xhci, false, GFP_KERNEL);
+ command = xhci_alloc_command(xhci, false, GFP_LX_DMA);
if (!command)
return -ENOMEM;
@@ -1244,7 +1246,7 @@ static int xhci_check_maxpacket(struct xhci_hcd *xhci, unsigned int slot_id,
* changes max packet sizes.
*/
- command = xhci_alloc_command(xhci, true, GFP_KERNEL);
+ command = xhci_alloc_command(xhci, true, GFP_LX_DMA);
if (!command)
return -ENOMEM;
@@ -1355,7 +1357,7 @@ static int xhci_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, gfp_t mem_flag
switch (usb_endpoint_type(&urb->ep->desc)) {
case USB_ENDPOINT_XFER_CONTROL:
- ret = xhci_queue_ctrl_tx(xhci, GFP_ATOMIC, urb,
+ ret = xhci_queue_ctrl_tx(xhci, GFP_LX_DMA, urb,
slot_id, ep_index);
break;
case USB_ENDPOINT_XFER_BULK:
@@ -1366,18 +1368,18 @@ static int xhci_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, gfp_t mem_flag
ret = -EINVAL;
break;
}
- ret = xhci_queue_bulk_tx(xhci, GFP_ATOMIC, urb,
+ ret = xhci_queue_bulk_tx(xhci, GFP_LX_DMA, urb,
slot_id, ep_index);
break;
case USB_ENDPOINT_XFER_INT:
- ret = xhci_queue_intr_tx(xhci, GFP_ATOMIC, urb,
+ ret = xhci_queue_intr_tx(xhci, GFP_LX_DMA, urb,
slot_id, ep_index);
break;
case USB_ENDPOINT_XFER_ISOC:
- ret = xhci_queue_isoc_tx_prepare(xhci, GFP_ATOMIC, urb,
+ ret = xhci_queue_isoc_tx_prepare(xhci, GFP_LX_DMA, urb,
slot_id, ep_index);
}
@@ -1499,7 +1501,7 @@ static int xhci_urb_dequeue(struct usb_hcd *hcd, struct urb *urb, int status)
* the first cancellation to be handled.
*/
if (!(ep->ep_state & EP_STOP_CMD_PENDING)) {
- command = xhci_alloc_command(xhci, false, GFP_ATOMIC);
+ command = xhci_alloc_command(xhci, false, GFP_LX_DMA);
if (!command) {
ret = -ENOMEM;
goto done;
@@ -2684,7 +2686,7 @@ static int xhci_check_bandwidth(struct usb_hcd *hcd, struct usb_device *udev)
xhci_dbg(xhci, "%s called for udev %p\n", __func__, udev);
virt_dev = xhci->devs[udev->slot_id];
- command = xhci_alloc_command(xhci, true, GFP_KERNEL);
+ command = xhci_alloc_command(xhci, true, GFP_LX_DMA);
if (!command)
return -ENOMEM;
@@ -3560,7 +3562,7 @@ int xhci_disable_slot(struct xhci_hcd *xhci, u32 slot_id)
u32 state;
int ret = 0;
- command = xhci_alloc_command(xhci, false, GFP_KERNEL);
+ command = xhci_alloc_command(xhci, false, GFP_LX_DMA);
if (!command)
return -ENOMEM;
@@ -3622,7 +3624,7 @@ int xhci_alloc_dev(struct usb_hcd *hcd, struct usb_device *udev)
int ret, slot_id;
struct xhci_command *command;
- command = xhci_alloc_command(xhci, true, GFP_KERNEL);
+ command = xhci_alloc_command(xhci, true, GFP_LX_DMA);
if (!command)
return 0;
@@ -3755,7 +3757,7 @@ static int xhci_setup_device(struct usb_hcd *hcd, struct usb_device *udev,
}
}
- command = xhci_alloc_command(xhci, true, GFP_KERNEL);
+ command = xhci_alloc_command(xhci, true, GFP_LX_DMA);
if (!command) {
ret = -ENOMEM;
goto out;
@@ -4688,7 +4690,7 @@ static int xhci_update_hub_device(struct usb_hcd *hcd, struct usb_device *hdev,
spin_lock_irqsave(&xhci->lock, flags);
if (hdev->speed == USB_SPEED_HIGH &&
- xhci_alloc_tt_info(xhci, vdev, hdev, tt, GFP_ATOMIC)) {
+ xhci_alloc_tt_info(xhci, vdev, hdev, tt, GFP_LX_DMA)) {
xhci_dbg(xhci, "Could not allocate xHCI TT structure.\n");
xhci_free_command(xhci, config_cmd);
spin_unlock_irqrestore(&xhci->lock, flags);