diff options
author | Stijn Tintel <stijn@linux-ipv6.be> | 2018-11-10 13:03:18 +0200 |
---|---|---|
committer | Stijn Tintel <stijn@linux-ipv6.be> | 2018-12-18 23:19:21 +0200 |
commit | f5919b65d4c671fd5083838c7a445f319f9a13c8 (patch) | |
tree | 2c791d2a5dea5bbbb0b85f86f74afce2647c0726 /target/linux/brcm2708/patches-4.14/950-0392-staging-bcm2835-camera-Do-not-bulk-receive-from-serv.patch | |
parent | 822b4c3b250a254e74407056ccfd5c6aa38da162 (diff) | |
download | upstream-f5919b65d4c671fd5083838c7a445f319f9a13c8.tar.gz upstream-f5919b65d4c671fd5083838c7a445f319f9a13c8.tar.bz2 upstream-f5919b65d4c671fd5083838c7a445f319f9a13c8.zip |
brcm2708: add kernel 4.14 support
Patch generation process:
- rebase rpi/rpi-4.14.y on v4.14.89 from linux-stable
- git format-patch v4.14.89
Patches skipped during rebase:
- lan78xx: Read MAC address from DT if present
- lan78xx: Enable LEDs and auto-negotiation
- Revert "softirq: Let ksoftirqd do its job"
- sc16is7xx: Fix for multi-channel stall
- lan78xx: Ignore DT MAC address if already valid
- lan78xx: Simple patch to prevent some crashes
- tcp_write_queue_purge clears all the SKBs in the write queue
- Revert "lan78xx: Simple patch to prevent some crashes"
- lan78xx: Connect phy early
- Arm: mm: ftrace: Only set text back to ro after kernel has been marked ro
- Revert "Revert "softirq: Let ksoftirqd do its job""
- ASoC: cs4265: SOC_SINGLE register value error fix
- Revert "ASoC: cs4265: SOC_SINGLE register value error fix"
- Revert "net: pskb_trim_rcsum() and CHECKSUM_COMPLETE are friends"
- Revert "Revert "net: pskb_trim_rcsum() and CHECKSUM_COMPLETE are friends""
Patches dropped after rebase:
- net: Add non-mainline source for rtl8192cu wlan
- net: Fix rtl8192cu build errors on other platforms
- brcm: adds support for BCM43341 wifi
- brcmfmac: Mute expected startup 'errors'
- ARM64: Fix build break for RTL8187/RTL8192CU wifi
- ARM64: Enable RTL8187/RTL8192CU wifi in build config
- This is the driver for Sony CXD2880 DVB-T2/T tuner + demodulator
- brcmfmac: add CLM download support
- brcmfmac: request_firmware_direct is quieter
- Sets the BCDC priority to constant 0
- brcmfmac: Disable ARP offloading when promiscuous
- brcmfmac: Avoid possible out-of-bounds read
- brcmfmac: Delete redundant length check
- net: rtl8192cu: Normalize indentation
- net: rtl8192cu: Fix implicit fallthrough warnings
- Revert "Sets the BCDC priority to constant 0"
- media: cxd2880: Bump to match 4.18.y version
- media: cxd2880-spi: Bump to match 4.18.y version
- Revert "mm: alloc_contig: re-allow CMA to compact FS pages"
- Revert "Revert "mm: alloc_contig: re-allow CMA to compact FS pages""
- cxd2880: CXD2880_SPI_DRV should select DVB_CXD2880 with
MEDIA_SUBDRV_AUTOSELECT
- 950-0421-HID-hid-bigbenff-driver-for-BigBen-Interactive-PS3OF.patch
- 950-0453-Add-hid-bigbenff-to-list-of-have_special_driver-for-.patch
Make I2C built-in instead of modular as in upstream defconfig; also the
easiest way to get MFD_ARIZONA enabled, which is required by
kmod-sound-soc-rpi-cirrus.
Add missing compatible strings from
4.9/960-add-rasbperrypi-compatible.patch, using upstream names for
compute modules.
Add extra patch to enable the LEDs on lan78xx.
Compile-tested: bcm2708, bcm2709, bcm2710 (with CONFIG_ALL_KMODS=y)
Runtime-tested: bcm2708, bcm2710
Signed-off-by: Stijn Tintel <stijn@linux-ipv6.be>
Diffstat (limited to 'target/linux/brcm2708/patches-4.14/950-0392-staging-bcm2835-camera-Do-not-bulk-receive-from-serv.patch')
-rw-r--r-- | target/linux/brcm2708/patches-4.14/950-0392-staging-bcm2835-camera-Do-not-bulk-receive-from-serv.patch | 197 |
1 files changed, 197 insertions, 0 deletions
diff --git a/target/linux/brcm2708/patches-4.14/950-0392-staging-bcm2835-camera-Do-not-bulk-receive-from-serv.patch b/target/linux/brcm2708/patches-4.14/950-0392-staging-bcm2835-camera-Do-not-bulk-receive-from-serv.patch new file mode 100644 index 0000000000..12cce81eae --- /dev/null +++ b/target/linux/brcm2708/patches-4.14/950-0392-staging-bcm2835-camera-Do-not-bulk-receive-from-serv.patch @@ -0,0 +1,197 @@ +From 2324b6fff518bebf6ec6363afe932c227f9d0b09 Mon Sep 17 00:00:00 2001 +From: Dave Stevenson <dave.stevenson@raspberrypi.org> +Date: Wed, 14 Feb 2018 17:04:26 +0000 +Subject: [PATCH 392/454] staging: bcm2835-camera: Do not bulk receive from + service thread + +vchi_bulk_queue_receive will queue up to a default of 4 +bulk receives on a connection before blocking. +If called from the VCHI service_callback thread, then +that thread is unable to service the VCHI_CALLBACK_BULK_RECEIVED +events that would enable the queue call to succeed. + +Add a workqueue to schedule the call vchi_bulk_queue_receive +in an alternate context to avoid the lock up. + +Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org> +--- + .../vc04_services/bcm2835-camera/mmal-vchiq.c | 101 ++++++++++-------- + 1 file changed, 59 insertions(+), 42 deletions(-) + +--- a/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c ++++ b/drivers/staging/vc04_services/bcm2835-camera/mmal-vchiq.c +@@ -118,8 +118,10 @@ struct mmal_msg_context { + + union { + struct { +- /* work struct for defered callback - must come first */ ++ /* work struct for buffer_cb callback */ + struct work_struct work; ++ /* work struct for deferred callback */ ++ struct work_struct buffer_to_host_work; + /* mmal instance */ + struct vchiq_mmal_instance *instance; + /* mmal port */ +@@ -174,6 +176,9 @@ struct vchiq_mmal_instance { + /* component to use next */ + int component_idx; + struct vchiq_mmal_component component[VCHIQ_MMAL_MAX_COMPONENTS]; ++ ++ /* ordered workqueue to process all bulk operations */ ++ struct workqueue_struct *bulk_wq; + }; + + static int __must_check +@@ -320,7 +325,44 @@ static void buffer_work_cb(struct work_s + msg_context->u.bulk.mmal_flags, + msg_context->u.bulk.dts, + msg_context->u.bulk.pts); ++} ++ ++/* workqueue scheduled callback to handle receiving buffers ++ * ++ * VCHI will allow up to 4 bulk receives to be scheduled before blocking. ++ * If we block in the service_callback context then we can't process the ++ * VCHI_CALLBACK_BULK_RECEIVED message that would otherwise allow the blocked ++ * vchi_bulk_queue_receive() call to complete. ++ */ ++static void buffer_to_host_work_cb(struct work_struct *work) ++{ ++ struct mmal_msg_context *msg_context = ++ container_of(work, struct mmal_msg_context, ++ u.bulk.buffer_to_host_work); ++ struct vchiq_mmal_instance *instance = msg_context->instance; ++ unsigned long len = msg_context->u.bulk.buffer_used; ++ int ret; + ++ if (!len) ++ /* Dummy receive to ensure the buffers remain in order */ ++ len = 8; ++ /* queue the bulk submission */ ++ vchi_service_use(instance->handle); ++ ret = vchi_bulk_queue_receive(instance->handle, ++ msg_context->u.bulk.buffer->buffer, ++ /* Actual receive needs to be a multiple ++ * of 4 bytes ++ */ ++ (len + 3) & ~3, ++ VCHI_FLAGS_CALLBACK_WHEN_OP_COMPLETE | ++ VCHI_FLAGS_BLOCK_UNTIL_QUEUED, ++ msg_context); ++ ++ vchi_service_release(instance->handle); ++ ++ if (ret != 0) ++ pr_err("%s: ctx: %p, vchi_bulk_queue_receive failed %d\n", ++ __func__, msg_context, ret); + } + + /* enqueue a bulk receive for a given message context */ +@@ -329,7 +371,6 @@ static int bulk_receive(struct vchiq_mma + struct mmal_msg_context *msg_context) + { + unsigned long rd_len; +- int ret; + + rd_len = msg->u.buffer_from_host.buffer_header.length; + +@@ -365,45 +406,10 @@ static int bulk_receive(struct vchiq_mma + msg_context->u.bulk.dts = msg->u.buffer_from_host.buffer_header.dts; + msg_context->u.bulk.pts = msg->u.buffer_from_host.buffer_header.pts; + +- /* queue the bulk submission */ +- vchi_service_use(instance->handle); +- ret = vchi_bulk_queue_receive(instance->handle, +- msg_context->u.bulk.buffer->buffer, +- /* Actual receive needs to be a multiple +- * of 4 bytes +- */ +- (rd_len + 3) & ~3, +- VCHI_FLAGS_CALLBACK_WHEN_OP_COMPLETE | +- VCHI_FLAGS_BLOCK_UNTIL_QUEUED, +- msg_context); +- +- vchi_service_release(instance->handle); +- +- return ret; +-} +- +-/* enque a dummy bulk receive for a given message context */ +-static int dummy_bulk_receive(struct vchiq_mmal_instance *instance, +- struct mmal_msg_context *msg_context) +-{ +- int ret; +- +- /* zero length indicates this was a dummy transfer */ +- msg_context->u.bulk.buffer_used = 0; +- +- /* queue the bulk submission */ +- vchi_service_use(instance->handle); +- +- ret = vchi_bulk_queue_receive(instance->handle, +- instance->bulk_scratch, +- 8, +- VCHI_FLAGS_CALLBACK_WHEN_OP_COMPLETE | +- VCHI_FLAGS_BLOCK_UNTIL_QUEUED, +- msg_context); ++ queue_work(msg_context->instance->bulk_wq, ++ &msg_context->u.bulk.buffer_to_host_work); + +- vchi_service_release(instance->handle); +- +- return ret; ++ return 0; + } + + /* data in message, memcpy from packet into output buffer */ +@@ -451,6 +457,8 @@ buffer_from_host(struct vchiq_mmal_insta + + /* initialise work structure ready to schedule callback */ + INIT_WORK(&msg_context->u.bulk.work, buffer_work_cb); ++ INIT_WORK(&msg_context->u.bulk.buffer_to_host_work, ++ buffer_to_host_work_cb); + + /* prep the buffer from host message */ + memset(&m, 0xbc, sizeof(m)); /* just to make debug clearer */ +@@ -531,7 +539,7 @@ static void buffer_to_host_cb(struct vch + if (msg->u.buffer_from_host.buffer_header.flags & + MMAL_BUFFER_HEADER_FLAG_EOS) { + msg_context->u.bulk.status = +- dummy_bulk_receive(instance, msg_context); ++ bulk_receive(instance, msg, msg_context); + if (msg_context->u.bulk.status == 0) + return; /* successful bulk submission, bulk + * completion will trigger callback +@@ -1862,6 +1870,9 @@ int vchiq_mmal_finalise(struct vchiq_mma + + mutex_unlock(&instance->vchiq_mutex); + ++ flush_workqueue(instance->bulk_wq); ++ destroy_workqueue(instance->bulk_wq); ++ + vfree(instance->bulk_scratch); + + mmal_context_map_destroy(&instance->context_map); +@@ -1935,6 +1946,11 @@ int vchiq_mmal_init(struct vchiq_mmal_in + + params.callback_param = instance; + ++ instance->bulk_wq = alloc_ordered_workqueue("mmal-vchiq", ++ WQ_MEM_RECLAIM); ++ if (!instance->bulk_wq) ++ goto err_free; ++ + status = vchi_service_open(vchi_instance, ¶ms, &instance->handle); + if (status) { + pr_err("Failed to open VCHI service connection (status=%d)\n", +@@ -1949,8 +1965,9 @@ int vchiq_mmal_init(struct vchiq_mmal_in + return 0; + + err_close_services: +- + vchi_service_close(instance->handle); ++ destroy_workqueue(instance->bulk_wq); ++err_free: + vfree(instance->bulk_scratch); + kfree(instance); + return -ENODEV; |