ANDROID: vendor_hooks: add vendor hook in xhci_urb_suitable_for_idt()

By this vh, so that we can reimplement the function xhci_urb_suitable_for_idt()

Bug: 301055890
Change-Id: I5e4eabf1155eceb650eee6a42b0e00e8d55281dc
Signed-off-by: Wanwei Jiang <wanwei.jiang@amlogic.com>
This commit is contained in:
qinglin.li
2023-09-13 14:24:03 +08:00
committed by Treehugger Robot
parent a29acad961
commit d3c35bf422
4 changed files with 20 additions and 0 deletions

View File

@@ -358,3 +358,4 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_rvh_cpuset_fork);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_alloc_uid);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_free_user);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_cma_alloc_bypass);
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_xhci_urb_suitable_bypass);

View File

@@ -18,6 +18,7 @@
#include <linux/slab.h>
#include <linux/dmi.h>
#include <linux/dma-mapping.h>
#include <trace/hooks/usb.h>
#include "xhci.h"
#include "xhci-trace.h"
@@ -1410,6 +1411,11 @@ static void xhci_unmap_temp_buf(struct usb_hcd *hcd, struct urb *urb)
urb->transfer_buffer = NULL;
}
void _trace_android_vh_xhci_urb_suitable_bypass(struct urb *urb, int *ret)
{
trace_android_vh_xhci_urb_suitable_bypass(urb, ret);
}
/*
* Bypass the DMA mapping if URB is suitable for Immediate Transfer (IDT),
* we'll copy the actual data into the TRB address register. This is limited to

View File

@@ -2233,6 +2233,8 @@ static inline struct xhci_ring *xhci_urb_to_transfer_ring(struct xhci_hcd *xhci,
urb->stream_id);
}
void _trace_android_vh_xhci_urb_suitable_bypass(struct urb *urb, int *ret);
/*
* TODO: As per spec Isochronous IDT transmissions are supported. We bypass
* them anyways as we where unable to find a device that matches the
@@ -2240,6 +2242,12 @@ static inline struct xhci_ring *xhci_urb_to_transfer_ring(struct xhci_hcd *xhci,
*/
static inline bool xhci_urb_suitable_for_idt(struct urb *urb)
{
int ret = 1;
_trace_android_vh_xhci_urb_suitable_bypass(urb, &ret);
if (ret <= 0)
return ret == 0;
if (!usb_endpoint_xfer_isoc(&urb->ep->desc) && usb_urb_dir_out(urb) &&
usb_endpoint_maxp(&urb->ep->desc) >= TRB_IDT_MAX_SIZE &&
urb->transfer_buffer_length <= TRB_IDT_MAX_SIZE &&

View File

@@ -11,6 +11,7 @@
* mechanism for vendor modules to hook and extend functionality
*/
struct usb_device;
struct urb;
DECLARE_HOOK(android_vh_usb_new_device_added,
TP_PROTO(struct usb_device *udev, int *err),
@@ -24,6 +25,10 @@ DECLARE_HOOK(android_vh_usb_dev_resume,
TP_PROTO(struct usb_device *udev, pm_message_t msg, int *bypass),
TP_ARGS(udev, msg, bypass));
DECLARE_HOOK(android_vh_xhci_urb_suitable_bypass,
TP_PROTO(struct urb *urb, int *ret),
TP_ARGS(urb, ret));
#endif /* _TRACE_HOOK_USB_H */
/* This part must be outside protection */
#include <trace/define_trace.h>