Message ID | 1650964728-175347-2-git-send-email-dh10.jung@samsung.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | add xhci-exynos driver | expand |
On Tue, Apr 26, 2022 at 06:18:44PM +0900, Daehwan Jung wrote: > Export symbols for xhci hooks usage: > xhci_get_slot_ctx > xhci_get_endpoint_address > - Allow xhci hook to get ep_ctx from the xhci_container_ctx for > getting the ep_ctx information to know which ep is offloading and > comparing the context in remote subsystem memory if needed. > > xhci_ring_alloc > - Allow xhci hook to allocate vendor specific ring. Vendors could > alloc additional event ring. > > xhci_trb_virt_to_dma > - Used to retrieve the DMA address of vendor specific ring. Vendors > could get dequeue address of event ring. > > xhci_segment_free > xhci_link_segments > - Allow xhci hook to handle vendor specific segment. Vendors could > directly free or link segments of vendor specific ring. > > xhci_initialize_ring_info > - Allow xhci hook to initialize vendor specific ring. > > xhci_check_trb_in_td_math > - Allow xhci hook to Check TRB math for validation. Vendors could > check trb when allocating vendor specific ring. > > xhci_address_device > - Allow override to give configuration info to Co-processor. > > xhci_bus_suspend > xhci_bus_resume > - Allow override of suspend and resume for power scenario. > > xhci_remove_stream_mapping > - Allow to xhci hook to remove stream mapping. Vendors need to do it > when free-ing vendor specific ring if it's stream type. > For the static functions that you are now exporting, they need to have their functions declared in a .h file. If not, you now get warnings when you run sparse after applying this commit, right? thanks, greg k-h
On Tue, Apr 26, 2022 at 11:54:16AM +0200, Greg Kroah-Hartman wrote: > On Tue, Apr 26, 2022 at 06:18:44PM +0900, Daehwan Jung wrote: > > Export symbols for xhci hooks usage: > > xhci_get_slot_ctx > > xhci_get_endpoint_address > > - Allow xhci hook to get ep_ctx from the xhci_container_ctx for > > getting the ep_ctx information to know which ep is offloading and > > comparing the context in remote subsystem memory if needed. > > > > xhci_ring_alloc > > - Allow xhci hook to allocate vendor specific ring. Vendors could > > alloc additional event ring. > > > > xhci_trb_virt_to_dma > > - Used to retrieve the DMA address of vendor specific ring. Vendors > > could get dequeue address of event ring. > > > > xhci_segment_free > > xhci_link_segments > > - Allow xhci hook to handle vendor specific segment. Vendors could > > directly free or link segments of vendor specific ring. > > > > xhci_initialize_ring_info > > - Allow xhci hook to initialize vendor specific ring. > > > > xhci_check_trb_in_td_math > > - Allow xhci hook to Check TRB math for validation. Vendors could > > check trb when allocating vendor specific ring. > > > > xhci_address_device > > - Allow override to give configuration info to Co-processor. > > > > xhci_bus_suspend > > xhci_bus_resume > > - Allow override of suspend and resume for power scenario. > > > > xhci_remove_stream_mapping > > - Allow to xhci hook to remove stream mapping. Vendors need to do it > > when free-ing vendor specific ring if it's stream type. > > > > For the static functions that you are now exporting, they need to have > their functions declared in a .h file. If not, you now get warnings > when you run sparse after applying this commit, right? > > thanks, > > greg k-h > I didn't get warnings in my environment. I tested to build default config + xhci_exynos by make command. Is there compile option to check it? Best Regards, Jung Daehwan
On Tue, Apr 26, 2022 at 07:27:09PM +0900, Jung Daehwan wrote: > On Tue, Apr 26, 2022 at 11:54:16AM +0200, Greg Kroah-Hartman wrote: > > On Tue, Apr 26, 2022 at 06:18:44PM +0900, Daehwan Jung wrote: > > > Export symbols for xhci hooks usage: > > > xhci_get_slot_ctx > > > xhci_get_endpoint_address > > > - Allow xhci hook to get ep_ctx from the xhci_container_ctx for > > > getting the ep_ctx information to know which ep is offloading and > > > comparing the context in remote subsystem memory if needed. > > > > > > xhci_ring_alloc > > > - Allow xhci hook to allocate vendor specific ring. Vendors could > > > alloc additional event ring. > > > > > > xhci_trb_virt_to_dma > > > - Used to retrieve the DMA address of vendor specific ring. Vendors > > > could get dequeue address of event ring. > > > > > > xhci_segment_free > > > xhci_link_segments > > > - Allow xhci hook to handle vendor specific segment. Vendors could > > > directly free or link segments of vendor specific ring. > > > > > > xhci_initialize_ring_info > > > - Allow xhci hook to initialize vendor specific ring. > > > > > > xhci_check_trb_in_td_math > > > - Allow xhci hook to Check TRB math for validation. Vendors could > > > check trb when allocating vendor specific ring. > > > > > > xhci_address_device > > > - Allow override to give configuration info to Co-processor. > > > > > > xhci_bus_suspend > > > xhci_bus_resume > > > - Allow override of suspend and resume for power scenario. > > > > > > xhci_remove_stream_mapping > > > - Allow to xhci hook to remove stream mapping. Vendors need to do it > > > when free-ing vendor specific ring if it's stream type. > > > > > > > For the static functions that you are now exporting, they need to have > > their functions declared in a .h file. If not, you now get warnings > > when you run sparse after applying this commit, right? > > > > thanks, > > > > greg k-h > > > > I didn't get warnings in my environment. I tested to build default config + > xhci_exynos by make command. Is there compile option to check it? make "C=1"
Hi Daehwan, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on usb/usb-testing] [also build test WARNING on krzk/for-next char-misc/char-misc-testing v5.18-rc4 next-20220426] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch] url: https://github.com/intel-lab-lkp/linux/commits/Daehwan-Jung/usb-host-export-symbols-for-xhci-exynos-to-use-xhci-hooks/20220426-181936 base: https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-testing config: arc-allyesconfig (https://download.01.org/0day-ci/archive/20220426/202204262306.mzMIKFKO-lkp@intel.com/config) compiler: arceb-elf-gcc (GCC) 11.3.0 reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # https://github.com/intel-lab-lkp/linux/commit/05a4937860cedb97b77200b7312a6f009aca2fc6 git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review Daehwan-Jung/usb-host-export-symbols-for-xhci-exynos-to-use-xhci-hooks/20220426-181936 git checkout 05a4937860cedb97b77200b7312a6f009aca2fc6 # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.3.0 make.cross W=1 O=build_dir ARCH=arc SHELL=/bin/bash drivers/usb/host/ If you fix the issue, kindly add following tag as appropriate Reported-by: kernel test robot <lkp@intel.com> All warnings (new ones prefixed by >>): drivers/usb/host/xhci-mem.c:68:6: warning: no previous prototype for 'xhci_segment_free' [-Wmissing-prototypes] 68 | void xhci_segment_free(struct xhci_hcd *xhci, struct xhci_segment *seg) | ^~~~~~~~~~~~~~~~~ drivers/usb/host/xhci-mem.c:100:6: warning: no previous prototype for 'xhci_link_segments' [-Wmissing-prototypes] 100 | void xhci_link_segments(struct xhci_segment *prev, | ^~~~~~~~~~~~~~~~~~ >> drivers/usb/host/xhci-mem.c:261:6: warning: no previous prototype for 'xhci_remove_stream_mapping' [-Wmissing-prototypes] 261 | void xhci_remove_stream_mapping(struct xhci_ring *ring) | ^~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/usb/host/xhci-mem.c:1974:5: warning: no previous prototype for 'xhci_check_trb_in_td_math' [-Wmissing-prototypes] 1974 | int xhci_check_trb_in_td_math(struct xhci_hcd *xhci) | ^~~~~~~~~~~~~~~~~~~~~~~~~ vim +/xhci_remove_stream_mapping +261 drivers/usb/host/xhci-mem.c 260 > 261 void xhci_remove_stream_mapping(struct xhci_ring *ring) 262 { 263 struct xhci_segment *seg; 264 265 if (WARN_ON_ONCE(ring->trb_address_map == NULL)) 266 return; 267 268 seg = ring->first_seg; 269 do { 270 xhci_remove_segment_mapping(ring->trb_address_map, seg); 271 seg = seg->next; 272 } while (seg != ring->first_seg); 273 } 274 EXPORT_SYMBOL_GPL(xhci_remove_stream_mapping); 275
On Tue, Apr 26, 2022 at 12:31:33PM +0200, Greg Kroah-Hartman wrote: > On Tue, Apr 26, 2022 at 07:27:09PM +0900, Jung Daehwan wrote: > > On Tue, Apr 26, 2022 at 11:54:16AM +0200, Greg Kroah-Hartman wrote: > > > On Tue, Apr 26, 2022 at 06:18:44PM +0900, Daehwan Jung wrote: > > > > Export symbols for xhci hooks usage: > > > > xhci_get_slot_ctx > > > > xhci_get_endpoint_address > > > > - Allow xhci hook to get ep_ctx from the xhci_container_ctx for > > > > getting the ep_ctx information to know which ep is offloading and > > > > comparing the context in remote subsystem memory if needed. > > > > > > > > xhci_ring_alloc > > > > - Allow xhci hook to allocate vendor specific ring. Vendors could > > > > alloc additional event ring. > > > > > > > > xhci_trb_virt_to_dma > > > > - Used to retrieve the DMA address of vendor specific ring. Vendors > > > > could get dequeue address of event ring. > > > > > > > > xhci_segment_free > > > > xhci_link_segments > > > > - Allow xhci hook to handle vendor specific segment. Vendors could > > > > directly free or link segments of vendor specific ring. > > > > > > > > xhci_initialize_ring_info > > > > - Allow xhci hook to initialize vendor specific ring. > > > > > > > > xhci_check_trb_in_td_math > > > > - Allow xhci hook to Check TRB math for validation. Vendors could > > > > check trb when allocating vendor specific ring. > > > > > > > > xhci_address_device > > > > - Allow override to give configuration info to Co-processor. > > > > > > > > xhci_bus_suspend > > > > xhci_bus_resume > > > > - Allow override of suspend and resume for power scenario. > > > > > > > > xhci_remove_stream_mapping > > > > - Allow to xhci hook to remove stream mapping. Vendors need to do it > > > > when free-ing vendor specific ring if it's stream type. > > > > > > > > > > For the static functions that you are now exporting, they need to have > > > their functions declared in a .h file. If not, you now get warnings > > > when you run sparse after applying this commit, right? > > > > > > thanks, > > > > > > greg k-h > > > > > > > I didn't get warnings in my environment. I tested to build default config + > > xhci_exynos by make command. Is there compile option to check it? > > make "C=1" And now 0-day reported it as well: https://lore.kernel.org/r/202204262306.mzMIKFKO-lkp@intel.com
On Tue, Apr 26, 2022 at 08:40:07PM +0200, Greg Kroah-Hartman wrote: > On Tue, Apr 26, 2022 at 12:31:33PM +0200, Greg Kroah-Hartman wrote: > > On Tue, Apr 26, 2022 at 07:27:09PM +0900, Jung Daehwan wrote: > > > On Tue, Apr 26, 2022 at 11:54:16AM +0200, Greg Kroah-Hartman wrote: > > > > On Tue, Apr 26, 2022 at 06:18:44PM +0900, Daehwan Jung wrote: > > > > > Export symbols for xhci hooks usage: > > > > > xhci_get_slot_ctx > > > > > xhci_get_endpoint_address > > > > > - Allow xhci hook to get ep_ctx from the xhci_container_ctx for > > > > > getting the ep_ctx information to know which ep is offloading and > > > > > comparing the context in remote subsystem memory if needed. > > > > > > > > > > xhci_ring_alloc > > > > > - Allow xhci hook to allocate vendor specific ring. Vendors could > > > > > alloc additional event ring. > > > > > > > > > > xhci_trb_virt_to_dma > > > > > - Used to retrieve the DMA address of vendor specific ring. Vendors > > > > > could get dequeue address of event ring. > > > > > > > > > > xhci_segment_free > > > > > xhci_link_segments > > > > > - Allow xhci hook to handle vendor specific segment. Vendors could > > > > > directly free or link segments of vendor specific ring. > > > > > > > > > > xhci_initialize_ring_info > > > > > - Allow xhci hook to initialize vendor specific ring. > > > > > > > > > > xhci_check_trb_in_td_math > > > > > - Allow xhci hook to Check TRB math for validation. Vendors could > > > > > check trb when allocating vendor specific ring. > > > > > > > > > > xhci_address_device > > > > > - Allow override to give configuration info to Co-processor. > > > > > > > > > > xhci_bus_suspend > > > > > xhci_bus_resume > > > > > - Allow override of suspend and resume for power scenario. > > > > > > > > > > xhci_remove_stream_mapping > > > > > - Allow to xhci hook to remove stream mapping. Vendors need to do it > > > > > when free-ing vendor specific ring if it's stream type. > > > > > > > > > > > > > For the static functions that you are now exporting, they need to have > > > > their functions declared in a .h file. If not, you now get warnings > > > > when you run sparse after applying this commit, right? > > > > > > > > thanks, > > > > > > > > greg k-h > > > > > > > > > > I didn't get warnings in my environment. I tested to build default config + > > > xhci_exynos by make command. Is there compile option to check it? > > > > make "C=1" > > And now 0-day reported it as well: > https://protect2.fireeye.com/v1/url?k=eb7c3909-8af72c33-eb7db246-74fe4860008a-ea28471ebd7c5af8&q=1&e=c40c7ad3-ab59-48ea-92a0-19c7ed0d5fd9&u=https%3A%2F%2Flore.kernel.org%2Fr%2F202204262306.mzMIKFKO-lkp%40intel.com > > I agree they should be added in header instead manually including xhci-exynos. I will modify it on next submission. I also don't get warnings in my environment when I run sparse. Let me check my environment again. Best Regards, Jung Daehwan
diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c index f65f1ba2b592..841617952ac7 100644 --- a/drivers/usb/host/xhci-hub.c +++ b/drivers/usb/host/xhci-hub.c @@ -1812,6 +1812,7 @@ int xhci_bus_suspend(struct usb_hcd *hcd) return 0; } +EXPORT_SYMBOL_GPL(xhci_bus_suspend); /* * Workaround for missing Cold Attach Status (CAS) if device re-plugged in S3. @@ -1956,6 +1957,7 @@ int xhci_bus_resume(struct usb_hcd *hcd) spin_unlock_irqrestore(&xhci->lock, flags); return 0; } +EXPORT_SYMBOL_GPL(xhci_bus_resume); unsigned long xhci_get_resuming_ports(struct usb_hcd *hcd) { diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c index bbb27ee2c6a3..82b9f90c0f27 100644 --- a/drivers/usb/host/xhci-mem.c +++ b/drivers/usb/host/xhci-mem.c @@ -65,7 +65,7 @@ static struct xhci_segment *xhci_segment_alloc(struct xhci_hcd *xhci, return seg; } -static void xhci_segment_free(struct xhci_hcd *xhci, struct xhci_segment *seg) +void xhci_segment_free(struct xhci_hcd *xhci, struct xhci_segment *seg) { if (seg->trbs) { dma_pool_free(xhci->segment_pool, seg->trbs, seg->dma); @@ -74,6 +74,7 @@ static void xhci_segment_free(struct xhci_hcd *xhci, struct xhci_segment *seg) kfree(seg->bounce_buf); kfree(seg); } +EXPORT_SYMBOL_GPL(xhci_segment_free); static void xhci_free_segments_for_ring(struct xhci_hcd *xhci, struct xhci_segment *first) @@ -96,9 +97,9 @@ static void xhci_free_segments_for_ring(struct xhci_hcd *xhci, * DMA address of the next segment. The caller needs to set any Link TRB * related flags, such as End TRB, Toggle Cycle, and no snoop. */ -static void xhci_link_segments(struct xhci_segment *prev, - struct xhci_segment *next, - enum xhci_ring_type type, bool chain_links) +void xhci_link_segments(struct xhci_segment *prev, + struct xhci_segment *next, + enum xhci_ring_type type, bool chain_links) { u32 val; @@ -118,6 +119,7 @@ static void xhci_link_segments(struct xhci_segment *prev, prev->trbs[TRBS_PER_SEGMENT-1].link.control = cpu_to_le32(val); } } +EXPORT_SYMBOL_GPL(xhci_link_segments); /* * Link the ring to the new segments. @@ -256,7 +258,7 @@ static int xhci_update_stream_segment_mapping( return ret; } -static void xhci_remove_stream_mapping(struct xhci_ring *ring) +void xhci_remove_stream_mapping(struct xhci_ring *ring) { struct xhci_segment *seg; @@ -269,6 +271,7 @@ static void xhci_remove_stream_mapping(struct xhci_ring *ring) seg = seg->next; } while (seg != ring->first_seg); } +EXPORT_SYMBOL_GPL(xhci_remove_stream_mapping); static int xhci_update_stream_mapping(struct xhci_ring *ring, gfp_t mem_flags) { @@ -316,6 +319,7 @@ void xhci_initialize_ring_info(struct xhci_ring *ring, */ ring->num_trbs_free = ring->num_segs * (TRBS_PER_SEGMENT - 1) - 1; } +EXPORT_SYMBOL_GPL(xhci_initialize_ring_info); /* Allocate segments and link them for a ring */ static int xhci_alloc_segments_for_ring(struct xhci_hcd *xhci, @@ -407,6 +411,7 @@ struct xhci_ring *xhci_ring_alloc(struct xhci_hcd *xhci, kfree(ring); return NULL; } +EXPORT_SYMBOL_GPL(xhci_ring_alloc); void xhci_free_endpoint_ring(struct xhci_hcd *xhci, struct xhci_virt_device *virt_dev, @@ -518,6 +523,7 @@ struct xhci_slot_ctx *xhci_get_slot_ctx(struct xhci_hcd *xhci, return (struct xhci_slot_ctx *) (ctx->bytes + CTX_SIZE(xhci->hcc_params)); } +EXPORT_SYMBOL_GPL(xhci_get_slot_ctx); struct xhci_ep_ctx *xhci_get_ep_ctx(struct xhci_hcd *xhci, struct xhci_container_ctx *ctx, @@ -1965,7 +1971,7 @@ static int xhci_test_trb_in_td(struct xhci_hcd *xhci, } /* TRB math checks for xhci_trb_in_td(), using the command and event rings. */ -static int xhci_check_trb_in_td_math(struct xhci_hcd *xhci) +int xhci_check_trb_in_td_math(struct xhci_hcd *xhci) { struct { dma_addr_t input_dma; @@ -2085,6 +2091,7 @@ static int xhci_check_trb_in_td_math(struct xhci_hcd *xhci) xhci_dbg(xhci, "TRB math tests passed.\n"); return 0; } +EXPORT_SYMBOL_GPL(xhci_check_trb_in_td_math); static void xhci_set_hc_event_deq(struct xhci_hcd *xhci) { diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index f9707997969d..652b37cd9c5e 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c @@ -79,6 +79,7 @@ dma_addr_t xhci_trb_virt_to_dma(struct xhci_segment *seg, return 0; return seg->dma + (segment_offset * sizeof(*trb)); } +EXPORT_SYMBOL_GPL(xhci_trb_virt_to_dma); static bool trb_is_noop(union xhci_trb *trb) { diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index 25b87e99b4dd..c06e8b21b724 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c @@ -1468,6 +1468,7 @@ unsigned int xhci_get_endpoint_address(unsigned int ep_index) unsigned int direction = ep_index % 2 ? USB_DIR_OUT : USB_DIR_IN; return direction | number; } +EXPORT_SYMBOL_GPL(xhci_get_endpoint_address); /* Find the flag for this endpoint (for use in the control context). Use the * endpoint index to create a bitmask. The slot context is bit 0, endpoint 0 is @@ -4324,10 +4325,11 @@ static int xhci_setup_device(struct usb_hcd *hcd, struct usb_device *udev, return ret; } -static int xhci_address_device(struct usb_hcd *hcd, struct usb_device *udev) +int xhci_address_device(struct usb_hcd *hcd, struct usb_device *udev) { return xhci_setup_device(hcd, udev, SETUP_CONTEXT_ADDRESS); } +EXPORT_SYMBOL_GPL(xhci_address_device); static int xhci_enable_device(struct usb_hcd *hcd, struct usb_device *udev) {