Commit graph

205 commits

Author SHA1 Message Date
Sarannya S
23351b0e9f rpmsg: glink: Add error message in case of callback failure
Sometimes due to late initialization glink callback may not be
initialized and incoming will be dropped.

Print error message if receive callback is not ready.

Change-Id: I3eae1717d4e1c14b319e288078d122762fd476e7
Signed-off-by: Sarannya S <sarannya@codeaurora.org>
2020-09-08 02:01:08 -07:00
Deepak Kumar Singh
737c735323 rpmsg: glink: check channel state before serving intent
Receive callback can be registered even before rpmsg driver probe is
complete. Assuming callback register as channel ready and allowing
remote host to send data is incorrect. In such case for any rx packet
callback may return prematurely thereby dropping the rx packet.

Adding a flag to store channel state when it is ready. Check this flag
before allocating rx intent and allowing data communication to proceed.
It will ensure that client driver is able to receive data correctly,
without any rx packet getting dropped.

CRs-Fixed: 2747216
Change-Id: Ib153cfe5689f31d7417622bf6177e9535fda628a
Signed-off-by: Deepak Kumar Singh <deesin@codeaurora.org>
2020-08-11 20:16:36 +05:30
Deepak Kumar Singh
b5b6007d15 rpmsg: glink: do not serve intent request if no callback present
Sometime remote may try to send packet before receive callback is
assigned. Which can result in dropping of packets on apps.

Acknowledge intent request but queue the intent only when receive
callback assignment is complete.

Change-Id: Ie366c24e204db7f1609e2345ee3324cb00f56f3e
Signed-off-by: Deepak Kumar Singh <deesin@codeaurora.org>
2020-07-30 09:56:25 +05:30
Deepak Kumar Singh
ca6dac1f49 rpmsg: glink: Return error if receive callback is not present
There may be a rx packet on channel while receive callback is
not yet register. In that case rx packet will be missed and
not delivered to glink client.

Add check for receive callback. If it is not registered return
-EAGAIN, so that this packet can be retried on next interrupt.

Change-Id: Iff0873c8eef7ecfb4382bd2f73c3386ce9e5344a
Signed-off-by: Deepak Kumar Singh <deesin@codeaurora.org>
2020-05-27 12:27:22 +05:30
Deepak Kumar Singh
70b9f23e6c rpmsg: glink: Append glink irq name with remote edge name
Glink irq for all the remote edges are registered with same name
glink-native. It is difficult to distinguish each irq in logs.

Appending remote edge name to generic irq name.

Change-Id: I6ead87e0e4adae204535b599d07d9471387c861b
Signed-off-by: Deepak Kumar Singh <deesin@codeaurora.org>
2020-05-15 12:56:39 +05:30
Arun Kumar Neelakantam
17a12f2a90 rpmsg: glink: Send READ_NOTIFY command in FIFO full case
The current design sleeps unconditionally in TX FIFO full case and
wakeup only after sleep timer expires which adds random delays in
clients TX path.

Avoid sleep and use READ_NOTIFY command so that writer can be woken up
when remote notifies about read completion by sending IRQ.

Change-Id: I1b44df0ec437d4e76aff181470fcf4cafbdd098a
Signed-off-by: Arun Kumar Neelakantam <aneela@codeaurora.org>
2020-04-17 04:01:42 -07:00
Ivaylo Georgiev
ae4713530b Merge android-4.19-q.91 (663a25d) into msm-4.19
* refs/heads/tmp-663a25d:
  Linux 4.19.91
  xhci: fix USB3 device initiated resume race with roothub autosuspend
  drm/radeon: fix r1xx/r2xx register checker for POT textures
  scsi: qla2xxx: Change discovery state before PLOGI
  scsi: iscsi: Fix a potential deadlock in the timeout handler
  dm btree: increase rebalance threshold in __rebalance2()
  dm mpath: remove harmful bio-based optimization
  drm: meson: venc: cvbs: fix CVBS mode matching
  dma-buf: Fix memory leak in sync_file_merge()
  vfio/pci: call irq_bypass_unregister_producer() before freeing irq
  ARM: tegra: Fix FLOW_CTLR_HALT register clobbering by tegra_resume()
  ARM: dts: s3c64xx: Fix init order of clock providers
  CIFS: Close open handle after interrupted close
  CIFS: Respect O_SYNC and O_DIRECT flags during reconnect
  cifs: Don't display RDMA transport on reconnect
  cifs: smbd: Return -EINVAL when the number of iovs exceeds SMBDIRECT_MAX_SGE
  cifs: smbd: Add messages on RDMA session destroy and reconnection
  cifs: smbd: Return -EAGAIN when transport is reconnecting
  rpmsg: glink: Free pending deferred work on remove
  rpmsg: glink: Don't send pending rx_done during remove
  rpmsg: glink: Fix rpmsg_register_device err handling
  rpmsg: glink: Put an extra reference during cleanup
  rpmsg: glink: Fix use after free in open_ack TIMEOUT case
  rpmsg: glink: Fix reuse intents memory leak issue
  rpmsg: glink: Set tail pointer to 0 at end of FIFO
  xtensa: fix TLB sanity checker
  PCI: Apply Cavium ACS quirk to ThunderX2 and ThunderX3
  PCI/MSI: Fix incorrect MSI-X masking on resume
  PCI: Fix Intel ACS quirk UPDCR register address
  PCI: pciehp: Avoid returning prematurely from sysfs requests
  PCI/PM: Always return devices to D0 when thawing
  mmc: block: Add CMD13 polling for MMC IOCTLS with R1B response
  mmc: block: Make card_busy_detect() a bit more generic
  Revert "arm64: preempt: Fix big-endian when checking preempt count in assembly"
  tcp: Protect accesses to .ts_recent_stamp with {READ,WRITE}_ONCE()
  tcp: tighten acceptance of ACKs not matching a child socket
  tcp: fix rejected syncookies due to stale timestamps
  net/mlx5e: Query global pause state before setting prio2buffer
  tipc: fix ordering of tipc module init and exit routine
  tcp: md5: fix potential overestimation of TCP option space
  openvswitch: support asymmetric conntrack
  net: thunderx: start phy before starting autonegotiation
  net: sched: fix dump qlen for sch_mq/sch_mqprio with NOLOCK subqueues
  net: ethernet: ti: cpsw: fix extra rx interrupt
  net: dsa: fix flow dissection on Tx path
  net: bridge: deny dev_set_mac_address() when unregistering
  mqprio: Fix out-of-bounds access in mqprio_dump
  inet: protect against too small mtu values.

Conflicts:
	drivers/rpmsg/qcom_glink_native.c
	drivers/rpmsg/qcom_glink_smem.c

Change-Id: I3a55edc48885ed6fc61853c59fcd78a9838a6ad4
Signed-off-by: Ivaylo Georgiev <irgeorgiev@codeaurora.org>
2020-02-03 21:37:34 -08:00
Ivaylo Georgiev
cda8925044 Merge android-4.19-q.86 (10f1d14) into msm-4.19
* refs/heads/tmp-10f1d14:
  Linux 4.19.86
  x86/resctrl: Fix rdt_find_domain() return value and checks
  mmc: tmio: fix SCC error handling to avoid false positive CRC error
  powerpc/time: Fix clockevent_decrementer initalisation for PR KVM
  tools: PCI: Fix broken pcitest compilation
  PM / devfreq: Fix static checker warning in try_then_request_governor
  ACPI / LPSS: Use acpi_lpss_* instead of acpi_subsys_* functions for hibernate
  tcp: start receiver buffer autotuning sooner
  ARM: dts: omap5: Fix dual-role mode on Super-Speed port
  mlxsw: spectrum_switchdev: Check notification relevance based on upper device
  spi: rockchip: initialize dma_slave_config properly
  mac80211: minstrel: fix sampling/reporting of CCK rates in HT mode
  mac80211: minstrel: fix CCK rate group streams value
  mac80211: minstrel: fix using short preamble CCK rates on HT clients
  misc: cxl: Fix possible null pointer dereference
  netfilter: nft_compat: do not dump private area
  net: sched: avoid writing on noop_qdisc
  selftests: forwarding: Have lldpad_app_wait_set() wait for unknown, too
  hwmon: (npcm-750-pwm-fan) Change initial pwm target to 255
  hwmon: (ina3221) Fix INA3221_CONFIG_MODE macros
  hwmon: (pwm-fan) Silence error on probe deferral
  hwmon: (nct6775) Fix names of DIMM temperature sources
  hwmon: (k10temp) Support all Family 15h Model 6xh and Model 7xh processors
  scsi: arcmsr: clean up clang warning on extraneous parentheses
  pinctrl: gemini: Fix up TVC clock group
  orangefs: rate limit the client not running info message
  x86/mm: Do not warn about PCI BIOS W+X mappings
  ARM: 8802/1: Call syscall_trace_exit even when system call skipped
  spi: spidev: Fix OF tree warning logic
  pinctrl: gemini: Mask and set properly
  spi: fsl-lpspi: Prevent FIFO under/overrun by default
  gpio: syscon: Fix possible NULL ptr usage
  net: fix generic XDP to handle if eth header was mangled
  bpf: btf: Fix a missing check bug
  x86/kexec: Correct KEXEC_BACKUP_SRC_END off-by-one error
  lightnvm: pblk: consider max hw sectors supported for max_write_pgs
  lightnvm: pblk: fix error handling of pblk_lines_init()
  lightnvm: do no update csecs and sos on 1.2
  lightnvm: pblk: guarantee mw_cunits on read buffer
  lightnvm: pblk: fix write amplificiation calculation
  lightnvm: pblk: guarantee emeta on line close
  lightnvm: pblk: fix incorrect min_write_pgs
  lightnvm: pblk: fix rqd.error return value in pblk_blk_erase_sync
  ALSA: hda/ca0132 - Fix input effect controls for desktop cards
  media: venus: vdec: fix decoded data size
  media: cx231xx: fix potential sign-extension overflow on large shift
  GFS2: Flush the GFS2 delete workqueue before stopping the kernel threads
  media: isif: fix a NULL pointer dereference bug
  printk: Give error on attempt to set log buffer length to over 2G
  mfd: ti_am335x_tscadc: Keep ADC interface on if child is wakeup capable
  backlight: lm3639: Unconditionally call led_classdev_unregister
  proc/vmcore: Fix i386 build error of missing copy_oldmem_page_encrypted()
  s390/kasan: avoid user access code instrumentation
  s390/kasan: avoid instrumentation of early C code
  s390/kasan: avoid vdso instrumentation
  mmc: mmci: expand startbiterr to irqmask and error check
  x86/intel_rdt: CBM overlap should also check for overlap with CDP peer
  x86/intel_rdt: Introduce utility to obtain CDP peer
  mtd: devices: m25p80: Make sure WRITE_EN is issued before each write
  mtd: spi-nor: cadence-quadspi: Use proper enum for dma_[un]map_single
  media: cx18: Don't check for address of video_dev
  media: dw9807-vcm: Fix probe error handling
  media: dw9714: Fix error handling in probe function
  platform/x86: mlx-platform: Properly use mlxplat_mlxcpld_msn201x_items
  bcache: recal cached_dev_sectors on detach
  bcache: account size of buckets used in uuid write to ca->meta_sectors_written
  reset: Fix potential use-after-free in __of_reset_control_get()
  fbdev: fix broken menu dependencies
  fbdev: sbuslib: integer overflow in sbusfb_ioctl_helper()
  fbdev: sbuslib: use checked version of put_user()
  atmel_lcdfb: support native-mode display-timings
  mmc: renesas_sdhi_internal_dmac: set scatter/gather max segment size
  mmc: tmio: Fix SCC error detection
  mmc: renesas_sdhi_internal_dmac: Whitelist r8a774a1
  x86/fsgsbase/64: Fix ptrace() to read the FS/GS base accurately
  xsk: proper AF_XDP socket teardown ordering
  iwlwifi: mvm: don't send keys when entering D3
  ACPI / SBS: Fix rare oops when removing modules
  xfrm: use correct size to initialise sp->ovec
  crypto: mxs-dcp - Fix AES issues
  crypto: mxs-dcp - Fix SHA null hashes and output length
  dmaengine: rcar-dmac: set scatter/gather max segment size
  x86/olpc: Fix build error with CONFIG_MFD_CS5535=m
  kexec: Allocate decrypted control pages for kdump if SME is enabled
  remoteproc: qcom: q6v5: Fix a race condition on fatal crash
  remoteproc: Check for NULL firmwares in sysfs interface
  tc-testing: fix build of eBPF programs
  net: hns3: Fix for rx vlan id handle to support Rev 0x21 hardware
  soc: fsl: bman_portals: defer probe after bman's probe
  Input: silead - try firmware reload after unsuccessful resume
  Input: st1232 - set INPUT_PROP_DIRECT property
  i2c: zx2967: use core to detect 'no zero length' quirk
  i2c: tegra: use core to detect 'no zero length' quirk
  i2c: qup: use core to detect 'no zero length' quirk
  i2c: omap: use core to detect 'no zero length' quirk
  gfs2: slow the deluge of io error messages
  media: cec-gpio: select correct Signal Free Time
  media: ov5640: fix framerate update
  dmaengine: ioat: fix prototype of ioat_enumerate_channels
  NFSv4.x: fix lock recovery during delegation recall
  printk: Correct wrong casting
  i2c: brcmstb: Allow enabling the driver on DSL SoCs
  clk: samsung: Use clk_hw API for calling clk framework from clk notifiers
  clk: samsung: exynos5420: Define CLK_SECKEY gate clock only or Exynos5420
  clk: samsung: Use NOIRQ stage for Exynos5433 clocks suspend/resume
  qtnfmac: drop error reports for out-of-bounds key indexes
  qtnfmac: inform wireless core about supported extended capabilities
  qtnfmac: pass sgi rate info flag to wireless core
  qtnfmac: request userspace to do OBSS scanning if FW can not
  brcmfmac: fix full timeout waiting for action frame on-channel tx
  brcmfmac: reduce timeout for action frame scan
  cpu/SMT: State SMT is disabled even with nosmt and without "=force"
  mtd: physmap_of: Release resources on error
  usb: dwc2: disable power_down on rockchip devices
  USB: serial: cypress_m8: fix interrupt-out transfer length
  KVM: PPC: Book3S PR: Exiting split hack mode needs to fixup both PC and LR
  bnxt_en: return proper error when FW returns HWRM_ERR_CODE_RESOURCE_ACCESS_DENIED
  ALSA: hda/sigmatel - Disable automute for Elo VuPoint
  media: i2c: adv748x: Support probing a single output
  media: rcar-vin: fix redeclaration of symbol
  media: pxa_camera: Fix check for pdev->dev.of_node
  media: rc: ir-rc6-decoder: enable toggle bit for Kathrein RCU-676 remote
  qed: Avoid implicit enum conversion in qed_ooo_submit_tx_buffers
  ata: ep93xx: Use proper enums for directions
  powerpc/64s/radix: Explicitly flush ERAT with local LPID invalidation
  powerpc/time: Use clockevents_register_device(), fixing an issue with large decrementer
  ASoC: qdsp6: q6asm-dai: checking NULL vs IS_ERR()
  cpuidle: menu: Fix wakeup statistics updates for polling state
  ACPICA: Never run _REG on system_memory and system_IO
  OPP: Return error on error from dev_pm_opp_get_opp_count()
  msm/gpu/a6xx: Force of_dma_configure to setup DMA for GMU
  rpmsg: glink: smem: Support rx peak for size less than 4 bytes
  IB/mlx4: Avoid implicit enumerated type conversion
  RDMA/hns: Limit the size of extend sge of sq
  RDMA/hns: Bugfix for CM test
  RDMA/hns: Submit bad wr when post send wr exception
  RDMA/hns: Bugfix for reserved qp number
  IB/rxe: avoid srq memory leak
  IB/mthca: Fix error return code in __mthca_init_one()
  ixgbe: Fix crash with VFs and flow director on interface flap
  i40e: Use proper enum in i40e_ndo_set_vf_link_state
  ixgbe: Fix ixgbe TX hangs with XDP_TX beyond queue limit
  md: allow metadata updates while suspending an array - fix
  ice: Fix forward to queue group logic
  clocksource/drivers/sh_cmt: Fix clocksource width for 32-bit machines
  clocksource/drivers/sh_cmt: Fixup for 64-bit machines
  tools: PCI: Fix compilation warnings
  PM / hibernate: Check the success of generating md5 digest before hibernation
  mtd: rawnand: sh_flctl: Use proper enum for flctl_dma_fifo0_transfer
  ARM: dts: at91: sama5d2_ptc_ek: fix bootloader env offsets
  ARM: dts: at91: at91sam9x5cm: fix addressable nand flash size
  ARM: dts: at91: sama5d4_xplained: fix addressable nand flash size
  powerpc/xive: Move a dereference below a NULL test
  powerpc/pseries: Fix how we iterate over the DTL entries
  powerpc/pseries: Fix DTL buffer registration
  cxgb4: Use proper enum in IEEE_FAUX_SYNC
  cxgb4: Use proper enum in cxgb4_dcb_handle_fw_update
  mei: samples: fix a signedness bug in amt_host_if_call()
  x86/PCI: Apply VMD's AERSID fixup generically
  sunrpc: Fix connect metrics
  clk: keystone: Enable TISCI clocks if K3_ARCH
  ext4: fix build error when DX_DEBUG is defined
  ALSA: hda: Fix mismatch for register mask and value in ext controller.
  dmaengine: timb_dma: Use proper enum in td_prep_slave_sg
  dmaengine: ep93xx: Return proper enum in ep93xx_dma_chan_direction
  printk: CON_PRINTBUFFER console registration is a bit racy
  printk: Do not miss new messages when replaying the log
  KVM: PPC: Inform the userspace about TCE update failures
  watchdog: w83627hf_wdt: Support NCT6796D, NCT6797D, NCT6798D
  watchdog: sama5d4: fix timeout-sec usage
  watchdog: renesas_wdt: stop when unregistering
  watchdog: core: fix null pointer dereference when releasing cdev
  irqchip/irq-mvebu-icu: Fix wrong private data retrieval
  nl80211: Fix a GET_KEY reply attribute
  usb: dwc3: gadget: Check ENBLSLPM before sending ep command
  usb: gadget: udc: fotg210-udc: Fix a sleep-in-atomic-context bug in fotg210_get_status()
  selftests/tls: Fix recv(MSG_PEEK) & splice() test cases
  ath9k: fix reporting calculated new FFT upper max
  PM / devfreq: stopping the governor before device_unregister()
  PM / devfreq: Fix handling of min/max_freq == 0
  PM / devfreq: Fix devfreq_add_device() when drivers are built as modules.
  ata: ahci_brcm: Allow using driver or DSL SoCs
  rtlwifi: btcoex: Use proper enumerated types for Wi-Fi only interface
  ath10k: fix vdev-start timeout on error
  arm64/numa: Report correct memblock range for the dummy node
  kvm: arm/arm64: Fix stage2_flush_memslot for 4 level page table
  iommu/arm-smmu-v3: Fix unexpected CMD_SYNC timeout
  iommu/io-pgtable-arm: Fix race handling in split_blk_unmap()
  mt76: fix handling ps-poll frames
  mt76x2: disable WLAN core before probe
  mt76x2: fix tx power configuration for VHT mcs 9
  IB/hfi1: Ensure ucast_dlid access doesnt exceed bounds
  IB/hfi1: Error path MAD response size is incorrect
  f2fs: keep lazytime on remount
  ACPI / LPSS: Resume BYT/CHT I2C controllers from resume_noirq
  ACPI / LPSS: Make acpi_lpss_find_device() also find PCI devices
  SUNRPC: Fix priority queue fairness
  tcp: up initial rmem to 128KB and SYN rwin to around 64KB
  ARM: dts: sun8i: h3: bpi-m2-plus: Fix address for external RGMII Ethernet PHY
  ARM: dts: sun8i: h3-h5: ir register size should be the whole memory block
  f2fs: return correct errno in f2fs_gc
  net: hns3: Fix loss of coal configuration while doing reset
  net: hns3: Fix for netdev not up problem when setting mtu
  ARM: dts: omap5: enable OTG role for DWC3 controller
  ARM: dts: dra7: Enable workaround for errata i870 in PCIe host mode
  net: xen-netback: fix return type of ndo_start_xmit function
  net: ovs: fix return type of ndo_start_xmit function
  bpf, x32: Fix bug for BPF_JMP | {BPF_JSGT, BPF_JSLE, BPF_JSLT, BPF_JSGE}
  bpf, x32: Fix bug with ALU64 {LSH, RSH, ARSH} BPF_K shift by 0
  bpf, x32: Fix bug with ALU64 {LSH, RSH, ARSH} BPF_X shift by 0
  bpf, x32: Fix bug for BPF_ALU64 | BPF_NEG
  fbdev: Ditch fb_edid_add_monspecs
  arm64: uaccess: Ensure PAN is re-enabled after unhandled uaccess fault
  mm/memory_hotplug: fix updating the node span
  mm/memory_hotplug: don't access uninitialized memmaps in shrink_pgdat_span()
  idr: Fix idr_get_next race with idr_remove
  net: cdc_ncm: Signedness bug in cdc_ncm_set_dgram_size()
  Revert "OPP: Protect dev_list with opp_table lock"
  tee: optee: add missing of_node_put after of_device_is_available
  i2c: mediatek: modify threshold passed to i2c_get_dma_safe_msg_buf()
  spi: mediatek: use correct mata->xfer_len when in fifo transfer

Conflicts:
	drivers/rpmsg/qcom_glink_smem.c
	drivers/usb/dwc3/gadget.c

Change-Id: I6e0f156d860bf2afcaabcf70d653676eb7d3de4e
Signed-off-by: Ivaylo Georgiev <irgeorgiev@codeaurora.org>
2020-01-28 03:10:58 -08:00
Bjorn Andersson
7438617d2c rpmsg: glink: Free pending deferred work on remove
commit 278bcb7300f61785dba63840bd2a8cf79f14554c upstream.

By just cancelling the deferred rx worker during GLINK instance teardown
any pending deferred commands are leaked, so free them.

Fixes: b4f8e52b89 ("rpmsg: Introduce Qualcomm RPM glink driver")
Cc: stable@vger.kernel.org
Acked-by: Chris Lew <clew@codeaurora.org>
Tested-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-21 10:57:30 +01:00
Bjorn Andersson
6f48229519 rpmsg: glink: Don't send pending rx_done during remove
commit c3dadc19b7564c732598b30d637c6f275c3b77b6 upstream.

Attempting to transmit rx_done messages after the GLINK instance is
being torn down will cause use after free and memory leaks. So cancel
the intent_work and free up the pending intents.

With this there are no concurrent accessors of the channel left during
qcom_glink_native_remove() and there is therefor no need to hold the
spinlock during this operation - which would prohibit the use of
cancel_work_sync() in the release function. So remove this.

Fixes: 1d2ea36eea ("rpmsg: glink: Add rx done command")
Cc: stable@vger.kernel.org
Acked-by: Chris Lew <clew@codeaurora.org>
Tested-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-21 10:57:29 +01:00
Chris Lew
a033a2a6be rpmsg: glink: Fix rpmsg_register_device err handling
commit f7e714988edaffe6ac578318e99501149b067ba0 upstream.

The device release function is set before registering with rpmsg. If
rpmsg registration fails, the framework will call device_put(), which
invokes the release function. The channel create logic does not need to
free rpdev if rpmsg_register_device() fails and release is called.

Fixes: b4f8e52b89 ("rpmsg: Introduce Qualcomm RPM glink driver")
Cc: stable@vger.kernel.org
Tested-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Chris Lew <clew@codeaurora.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-21 10:57:28 +01:00
Chris Lew
478963b1f8 rpmsg: glink: Put an extra reference during cleanup
commit b646293e272816dd0719529dcebbd659de0722f7 upstream.

In a remote processor crash scenario, there is no guarantee the remote
processor sent close requests before it went into a bad state. Remove
the reference that is normally handled by the close command in the
so channel resources can be released.

Fixes: b4f8e52b89 ("rpmsg: Introduce Qualcomm RPM glink driver")
Cc: stable@vger.kernel.org
Tested-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Chris Lew <clew@codeaurora.org>
Reported-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-21 10:57:28 +01:00
Arun Kumar Neelakantam
8a5b99adbf rpmsg: glink: Fix use after free in open_ack TIMEOUT case
commit ac74ea01860170699fb3b6ea80c0476774c8e94f upstream.

Extra channel reference put when remote sending OPEN_ACK after timeout
causes use-after-free while handling next remote CLOSE command.

Remove extra reference put in timeout case to avoid use-after-free.

Fixes: b4f8e52b89 ("rpmsg: Introduce Qualcomm RPM glink driver")
Cc: stable@vger.kernel.org
Tested-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Arun Kumar Neelakantam <aneela@codeaurora.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-21 10:57:27 +01:00
Arun Kumar Neelakantam
b909f12e3c rpmsg: glink: Fix reuse intents memory leak issue
commit b85f6b601407347f5425c4c058d1b7871f5bf4f0 upstream.

Memory allocated for re-usable intents are not freed during channel
cleanup which causes memory leak in system.

Check and free all re-usable memory to avoid memory leak.

Fixes: 933b45da5d ("rpmsg: glink: Add support for TX intents")
Cc: stable@vger.kernel.org
Acked-By: Chris Lew <clew@codeaurora.org>
Tested-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Arun Kumar Neelakantam <aneela@codeaurora.org>
Reported-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-21 10:57:26 +01:00
Chris Lew
6c4560364d rpmsg: glink: Set tail pointer to 0 at end of FIFO
commit 4623e8bf1de0b86e23a56cdb39a72f054e89c3bd upstream.

When wrapping around the FIFO, the remote expects the tail pointer to
be reset to 0 on the edge case where the tail equals the FIFO length.

Fixes: caf989c350 ("rpmsg: glink: Introduce glink smem based transport")
Cc: stable@vger.kernel.org
Signed-off-by: Chris Lew <clew@codeaurora.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-12-21 10:57:26 +01:00
Arun Kumar Neelakantam
674b223d7a rpmsg: glink: smem: Support rx peak for size less than 4 bytes
[ Upstream commit 928002a5e9dab2ddc1a0fe3e00739e89be30dc6b ]

The current rx peak function fails to read the data if size is
less than 4bytes.

Use memcpy_fromio to support data reads of size less than 4 bytes.

Cc: stable@vger.kernel.org
Fixes: f0beb4ba9b18 ("rpmsg: glink: Remove chunk size word align warning")
Signed-off-by: Arun Kumar Neelakantam <aneela@codeaurora.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2019-11-24 08:20:05 +01:00
Deepak Kumar Singh
65fbc359e8 rpmsg: glink: reset read/write index after ssr
While system is going down fifo index are not reset which can
cause remote subsystem to read stale index.

Now resetting the index while system is going down.

CRs-Fixed: 2543040
Change-Id: Icb4010c120f4735da206a44a4eb1bcf06ae0a1b7
Signed-off-by: Deepak Kumar Singh <deesin@codeaurora.org>
2019-10-22 02:59:55 -07:00
Raghavendra Kakarla
1bf666cef4 soc: qcom: Add RPM SMD Driver
This is a snapshot of the RPM-SMD driver functionality as of
'commit 0453f0e705df8b("move rpm-smd initcall to
postcore_initcall_sync")' on msm-4.14 branch.

Change-Id: Ie70bca9c28ae2339b45715f7d82839f39e733832
Signed-off-by: Raghavendra Kakarla <rkakarla@codeaurora.org>
2019-09-15 21:51:06 -07:00
Chris Lew
7afd24c6fb rpmsg: glink: Remove channel decouple from rpdev release
If a channel is being rapidly restarting and the kobj release worker
is busy, there is a chance the the rpdev_release function will run
after the channel struct itself has been released.

There should not be a need to decouple the channel from rpdev in the
rpdev release since that should only happen from the close commands.

Change-Id: Ia4131151b7efb014716c5a0666f940384975ea42
Signed-off-by: Chris Lew <clew@codeaurora.org>
2019-08-26 17:56:27 -07:00
Deepak Kumar Singh
e80a8aa9b8 rpmsg : glink: validate head and tail index before fifo read write
We are not validating head and tail index of tx and rx fifo
before using to read or write fifo. This can result in out of
bound memory access if head and tail have incorrect values.

This patch adds check for validation of head and tail index.

CRs-Fixed: 2398099
Change-Id: Ia8725a731cc7a45f7e13b09e1e62842ff44d53f3
Signed-off-by: Deepak Kumar Singh <deesin@codeaurora.org>
2019-05-02 12:27:56 +05:30
qctecmdr
6a1ef27d2f Merge "soc: qcom: mem-offline: Make mem-offline depend on MEMORY_HOTPLUG" 2019-04-02 15:36:11 -07:00
Deepak Kumar Singh
eb06f0b202 rpmsg: glink: Return -ECONNRESET for non-blcoking tx
For non-blocking Glink tx return -ECONNRESET in case
of connection reset.

CR-Fixed: 2401245
Change-Id: I0773847e8d8cd18664199f13b0830689d741bcf0
Signed-off-by: Deepak Kumar Singh <deesin@codeaurora.org>
2019-03-12 17:39:21 -07:00
Deepak Kumar Singh
de35e77307 rpmsg: glink: Early bootup init of glink rpm driver
To enable early probe of glink rpm driver, register driver at
postcore_init level instead of subsys_init level.

CRs-Fixed: 2394694
Change-Id: I180c5d35142db498fe78d814f004f84ba24c6696
Signed-off-by: Deepak Kumar Singh <deesin@codeaurora.org>
2019-03-12 17:39:20 -07:00
Arun Kumar Neelakantam
56e0a4832c rpmsg: glink: use correct data pointer in packets larger than 8k
Only first 8K data is sending repeatedly in split and sending case.

Update data pointer with correct index while sending split packets.

CRs-Fixed: 2391918
Change-Id: I48925c0249c8849a6df388de1b98aa5b2a524e2e
Signed-off-by: Arun Kumar Neelakantam <aneela@codeaurora.org>
2019-03-12 17:39:20 -07:00
Chris Lew
37d78deabf rpmsg: glink: Do not send to remote proc in reset
If an intent is available and there is space in the fifo, glink sends
the message and returns success even when the remote proc is in reset.
This causes request/response type drivers to wait for a response from
a remote proc in reset which can delay cleanup. Return an error on send
if the remote proc is in reset.

Change-Id: Ic49aa5e545d871387b8ebd74ad2828ca2140645b
Signed-off-by: Chris Lew <clew@codeaurora.org>
2019-03-12 17:39:19 -07:00
Arun Kumar Neelakantam
c0f4d1deef rpmsg: glink: Remove the rpmsg dev in close_ack
Un-register and register of rpmsg driver is sending invalid open_ack
on closed channel.

To avoid sending invalid open_ack case unregister the rpmsg device
after receiving the local_close_ack from remote side.

CRs-Fixed: 2275152
Change-Id: I5255c8bb55cb3bc35d9813a3a349d8af391d1862
Signed-off-by: Arun Kumar Neelakantam <aneela@codeaurora.org>
2019-03-12 17:39:19 -07:00
Arun Kumar Neelakantam
74427beff8 rpmsg: glink: Add TX_DATA_CONT command while sending
With current design the transport can send packets of size upto
FIFO_SIZE which is 16k and return failure for all packets above 16k.

Add TX_DATA_CONT command to send packets greater than 16k by splitting
into 8K chunks.

CRs-Fixed: 2351375
Change-Id: Iba3bbb440aacc0d5f33d0e5d88a3be0a31179ee7
Signed-off-by: Arun Kumar Neelakantam <aneela@codeaurora.org>
2019-03-12 17:39:18 -07:00
Arun Kumar Neelakantam
e8c2c2c157 rpmsg: glink: early reset notifier for RPM edge
RPM does not support SSR hence registering for early reset notifier
fails and cause probe to be failed.

Avoid probe bailout for early reset notifier registration failures.

CRs-Fixed: 2341794
Change-Id: I7357afc85b345a1384e8015356458c5f74f235b2
Signed-off-by: Arun Kumar Neelakantam <aneela@codeaurora.org>
2019-03-12 17:39:18 -07:00
Arun Kumar Neelakantam
91cffe5a75 rpmsg: glink: Fix reuse intents memory leak issue
Memory allocated for re-usable intents are not freed during channel
cleanup which causes memory leak in system.

Check and free all re-usable memory to avoid memory leak.

CRs-Fixed: 2339489
Change-Id: I2a174aabfced05c165a1b342032926fbd8de70cb
Signed-off-by: Arun Kumar Neelakantam <aneela@codeaurora.org>
2019-03-12 17:39:17 -07:00
Chris Lew
424874ce43 rpmsg: glink: Add early reset notifier
Register glink with the early reset notifier provided by the SSR
framework. SSR is traditionally handed in a single work context to
ease cleanup dependencies from SSR. This because an issue when multiple
processors reset at the same time. Glink sends to an unresponsive proc
will block until the 10 second intent timeout. Receiving an early
notification allows GLINK to cancel any current and future tx to the
unrepsonsive proc until a full cleanup happens from unregister.

Change-Id: Ie7a76a9e88696d9dac2837e68a2ec2f6eaf45204
Signed-off-by: Chris Lew <clew@codeaurora.org>
2019-03-12 17:38:38 -07:00
Chris Lew
ab26f34569 rpmsg: glink: Deny intent request if reusable intent fits
In high traffic scenarios a remote may request extra intents to send
data faster. If the work thread that handles these intent requests is
starved of cpu time, then these requests can build up. Some remote
procs may not be able to handle this burst of built up intent requests.

In order to prevent intent build up, deny intent requests that can be
fulfilled by default intents that are reusable.

Change-Id: I0932b458eb5694bdd5f92f1b4dc19b578da1e4da
Signed-off-by: Chris Lew <clew@codeaurora.org>
2019-03-12 17:07:09 -07:00
Chris Lew
bb043ade15 rpmsg: glink: Fix rpmsg_register_device err handling
The device release function is set before registering with rpmsg. If
rpmsg registration fails, the framework will call device_put(), which
invokes the release function. The channel create logic does not need to
free rpdev if rpmsg_register_device() fails and release is called.

Change-Id: I66d3cc02eb5503130c6ad700a7e000054e8992f3
Signed-off-by: Chris Lew <clew@codeaurora.org>
2019-03-12 17:07:09 -07:00
Jordan Crouse
4d44618168 rpmsg: Fix compiler warnings
gcc 6.1.1 identified a few additional compiler warnings.

Fixes: d064080d80 ("rpmsg: Add snapshot of RPMSG Glink drivers")
Change-Id: Ic0dedbadd7d2fb8fbddfd8c8b80f7f687aab37de
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
2019-03-04 11:52:23 -07:00
Konstantin Dorfman
089d322897 rpmsg: glink: fix destroy channel endpoint logic
When rpmsg client driver destroys last channel endpoint, remove rpmsg
device is triggered. In both cases (destroy endpoint and remove device)
a glink close command sent to the remote peer.

This change, when for removing rpmsg device endpoint already destroyed
will avoid sending second glink close command.

Change-Id: I0135e2626f4ede7a380308944f7c273d18e223bf
Signed-off-by: Konstantin Dorfman <kdorfman@codeaurora.org>
2019-02-11 23:57:41 -08:00
Jordan Crouse
4b1da898c8 rpmsg: glink: Fix string format warnings
Fix these string format warnings:

 drivers/rpmsg/qcom_glink_native.c: In function 'qcom_glink_advertise_intent':
 drivers/rpmsg/qcom_glink_native.c:38:34: error:
   format '%d' expects argument of type 'int', but argument 8 has type 'size_t {aka long unsigned int}' [-Werror=format=]
 drivers/rpmsg/qcom_glink_native.c:720:2: note: in expansion of macro 'CH_INFO'

 drivers/rpmsg/qcom_glink_native.c: In function 'qcom_glink_handle_intent':
 drivers/rpmsg/qcom_glink_native.c:38:34: error:
   format '%d' expects argument of type 'int', but argument 8 has type 'size_t {aka long unsigned int}'
 drivers/rpmsg/qcom_glink_native.c:1027:3: note: in expansion of macro 'CH_INFO'

 drivers/rpmsg/qcom_glink_native.c: In function 'qcom_glink_request_intent':
 drivers/rpmsg/qcom_glink_native.c:38:34: error:
   format '%d' expects argument of type 'int', but argument 7 has type 'size_t {aka long unsigned int}'
 drivers/rpmsg/qcom_glink_native.c:1385:2: note: in expansion of macro 'CH_INFO'

 drivers/rpmsg/qcom_glink_native.c: In function 'qcom_glink_native_probe':
 drivers/rpmsg/qcom_glink_native.c:1866:16: error:
   format '%d' expects argument of type 'int', but argument 3 has type 'long int' [-Werror=format=]

Fixes: d064080d80 ("rpmsg: Add snapshot of RPMSG Glink drivers")
Change-Id: Ic0dedbad9a9f827665325c43d3599036204fab37
Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
2019-01-29 08:29:41 -07:00
Rishabh Bhatnagar
e9a05bb4d3 spdx: Modify spdx tag from GPL-2.0 to GPL-2.0-only
Modify spdx tag for all CAF authored files for Kona.

Change-Id: I9308c7189412b1e428a7f67ded0dc076b0e38254
Signed-off-by: Rishabh Bhatnagar <rishabhb@codeaurora.org>
2018-12-10 11:09:45 -08:00
Blagovest Kolenichev
7fe1c1db80 Merge LTS tag v4.19.2 into msm-kona
* refs/heads/tmp-7950eb3:
  Revert "scsi: ufs: Schedule clk gating work on correct queue"
  Linux 4.19.2
  MD: fix invalid stored role for a disk - try2
  vga_switcheroo: Fix missing gpu_bound call at audio client registration
  bpf: wait for running BPF programs when updating map-in-map
  userns: also map extents in the reverse map to kernel IDs
  vt: fix broken display when running aptitude
  net: sched: Remove TCA_OPTIONS from policy
  Btrfs: fix use-after-free when dumping free space
  Btrfs: fix use-after-free during inode eviction
  btrfs: move the dio_sem higher up the callchain
  btrfs: don't run delayed_iputs in commit
  btrfs: fix insert_reserved error handling
  btrfs: only free reserved extent if we didn't insert it
  btrfs: don't use ctl->free_space for max_extent_size
  btrfs: set max_extent_size properly
  btrfs: reset max_extent_size properly
  Btrfs: fix deadlock when writing out free space caches
  Btrfs: fix assertion on fsync of regular file when using no-holes feature
  Btrfs: fix null pointer dereference on compressed write path error
  btrfs: qgroup: Dirty all qgroups before rescan
  Btrfs: fix wrong dentries after fsync of file that got its parent replaced
  Btrfs: fix warning when replaying log after fsync of a tmpfile
  btrfs: make sure we create all new block groups
  btrfs: reset max_extent_size on clear in a bitmap
  btrfs: protect space cache inode alloc with GFP_NOFS
  btrfs: release metadata before running delayed refs
  Btrfs: don't clean dirty pages during buffered writes
  btrfs: wait on caching when putting the bg cache
  btrfs: keep trim from interfering with transaction commits
  btrfs: don't attempt to trim devices that don't support it
  btrfs: iterate all devices during trim, instead of fs_devices::alloc_list
  btrfs: Ensure btrfs_trim_fs can trim the whole filesystem
  btrfs: Enhance btrfs_trim_fs function to handle error better
  btrfs: fix error handling in btrfs_dev_replace_start
  btrfs: fix error handling in free_log_tree
  btrfs: locking: Add extra check in btrfs_init_new_buffer() to avoid deadlock
  btrfs: Handle owner mismatch gracefully when walking up tree
  btrfs: qgroup: Avoid calling qgroup functions if qgroup is not enabled
  tracing: Return -ENOENT if there is no target synthetic event
  selftests/powerpc: Fix ptrace tm failure
  selftests/ftrace: Fix synthetic event test to delete event correctly
  soc/tegra: pmc: Fix child-node lookup
  soc: qcom: rmtfs-mem: Validate that scm is available
  arm64: dts: stratix10: Correct System Manager register size
  ARM: dts: socfpga: Fix SDRAM node address for Arria10
  Cramfs: fix abad comparison when wrap-arounds occur
  rpmsg: smd: fix memory leak on channel create
  arm64: lse: remove -fcall-used-x0 flag
  media: hdmi.h: rename ADOBE_RGB to OPRGB and ADOBE_YCC to OPYCC
  media: replace ADOBERGB by OPRGB
  media: media colorspaces*.rst: rename AdobeRGB to opRGB
  drm/mediatek: fix OF sibling-node lookup
  media: adv7842: when the EDID is cleared, unconfigure CEC as well
  media: adv7604: when the EDID is cleared, unconfigure CEC as well
  media: em28xx: fix handler for vidioc_s_input()
  media: em28xx: make v4l2-compliance happier by starting sequence on zero
  media: em28xx: fix input name for Terratec AV 350
  media: tvp5150: avoid going past array on v4l2_querymenu()
  media: em28xx: use a default format if TRY_FMT fails
  media: cec: forgot to cancel delayed work
  media: cec: fix the Signal Free Time calculation
  media: cec: add new tx/rx status bits to detect aborts/timeouts
  xen-blkfront: fix kernel panic with negotiate_mq error path
  xen: remove size limit of privcmd-buf mapping interface
  xen: fix xen_qlock_wait()
  media: cec: integrate cec_validate_phys_addr() in cec-api.c
  media: cec: make cec_get_edid_spa_location() an inline function
  remoteproc: qcom: q6v5: Propagate EPROBE_DEFER
  kgdboc: Passing ekgdboc to command line causes panic
  Revert "media: dvbsky: use just one mutex for serializing device R/W ops"
  media: v4l2-tpg: fix kernel oops when enabling HFLIP and OSD
  net: bcmgenet: fix OF child-node lookup
  TC: Set DMA masks for devices
  iommu/arm-smmu: Ensure that page-table updates are visible before TLBI
  ocxl: Fix access to the AFU Descriptor Data
  power: supply: twl4030-charger: fix OF sibling-node lookup
  rtc: cmos: Remove the `use_acpi_alarm' module parameter for !ACPI
  rtc: cmos: Fix non-ACPI undefined reference to `hpet_rtc_interrupt'
  rtc: ds1307: fix ds1339 wakealarm support
  MIPS: OCTEON: fix out of bounds array access on CN68XX
  powerpc/64s/hash: Do not use PPC_INVALIDATE_ERAT on CPUs before POWER9
  powerpc/tm: Fix HFSCR bit for no suspend case
  powerpc/msi: Fix compile error on mpc83xx
  powerpc64/module elfv1: Set opd addresses after module relocation
  fsnotify: Fix busy inodes during unmount
  media: ov7670: make "xclk" clock optional
  dm zoned: fix various dmz_get_mblock() issues
  dm zoned: fix metadata block ref counting
  dm ioctl: harden copy_params()'s copy_from_user() from malicious users
  lockd: fix access beyond unterminated strings in prints
  nfsd: Fix an Oops in free_session()
  nfsd: correctly decrement odstate refcount in error path
  nfs: Fix a missed page unlock after pg_doio()
  NFSv4.1: Fix the r/wsize checking
  NFC: nfcmrvl_uart: fix OF child-node lookup
  tpm: fix response size validation in tpm_get_random()
  genirq: Fix race on spurious interrupt detection
  printk: Fix panic caused by passing log_buf_len to command line
  smb3: on kerberos mount if server doesn't specify auth type use krb5
  smb3: do not attempt cifs operation in smb3 query info error path
  smb3: allow stats which track session and share reconnects to be reset
  w1: omap-hdq: fix missing bus unregister at removal
  iio: adc: at91: fix wrong channel number in triggered buffer mode
  iio: adc: at91: fix acking DRDY irq on simple conversions
  iio: adc: imx25-gcq: Fix leak of device_node in mx25_gcq_setup_cfgs()
  iio: ad5064: Fix regulator handling
  kbuild: fix kernel/bounds.c 'W=1' warning
  KVM: arm64: Fix caching of host MDCR_EL2 value
  KVM: arm/arm64: Ensure only THP is candidate for adjustment
  mm/hmm: fix race between hmm_mirror_unregister() and mmu_notifier callback
  mm/rmap: map_pte() was not handling private ZONE_DEVICE page properly
  hugetlbfs: dirty pages as they are added to pagecache
  ima: open a new file instance if no read permissions
  ima: fix showing large 'violations' or 'runtime_measurements_count'
  userfaultfd: disable irqs when taking the waitqueue lock
  mm: /proc/pid/smaps_rollup: fix NULL pointer deref in smaps_pte_range()
  crypto: speck - remove Speck
  crypto: aegis/generic - fix for big endian systems
  crypto: morus/generic - fix for big endian systems
  crypto: aesni - don't use GFP_ATOMIC allocation if the request doesn't cross a page in gcm
  crypto: tcrypt - fix ghash-generic speed test
  crypto: lrw - Fix out-of bounds access on counter overflow
  signal: Guard against negative signal numbers in copy_siginfo_from_user32
  signal/GenWQE: Fix sending of SIGKILL
  PCI: Add Device IDs for Intel GPU "spurious interrupt" quirk
  PCI/ASPM: Fix link_state teardown on device removal
  ARM: dts: dra7: Fix up unaligned access setting for PCIe EP
  EDAC, skx_edac: Fix logical channel intermediate decoding
  EDAC, {i7core,sb,skx}_edac: Fix uncorrected error counting
  EDAC, amd64: Add Family 17h, models 10h-2fh support
  HID: hiddev: fix potential Spectre v1
  HID: wacom: Work around HID descriptor bug in DTK-2451 and DTH-2452
  selinux: fix mounting of cgroup2 under older policies
  ext4: fix use-after-free race in ext4_remount()'s error path
  ext4: propagate error from dquot_initialize() in EXT4_IOC_FSSETXATTR
  ext4: fix setattr project check in fssetxattr ioctl
  ext4: initialize retries variable in ext4_da_write_inline_data_begin()
  ext4: fix EXT4_IOC_SWAP_BOOT
  gfs2_meta: ->mount() can get NULL dev_name
  jbd2: fix use after free in jbd2_log_do_checkpoint()
  IB/rxe: Revise the ib_wr_opcode enum
  IB/mlx5: Fix MR cache initialization
  ASoC: sta32x: set ->component pointer in private struct
  ASoC: intel: skylake: Add missing break in skl_tplg_get_token()
  libnvdimm, pmem: Fix badblocks population for 'raw' namespaces
  libnvdimm, region: Fail badblocks listing for inactive regions
  libnvdimm: Hold reference on parent while scheduling async init
  scsi: target: Fix target_wait_for_sess_cmds breakage with active signals
  scsi: sched/wait: Add wait_event_lock_irq_timeout for TASK_UNINTERRUPTIBLE usage
  dmaengine: ppc4xx: fix off-by-one build failure
  net/ipv4: defensive cipso option parsing
  iwlwifi: mvm: check return value of rs_rate_from_ucode_rate()
  mt76: mt76x2: fix multi-interface beacon configuration
  usb: gadget: udc: renesas_usb3: Fix b-device mode for "workaround"
  usb: typec: tcpm: Fix APDO PPS order checking to be based on voltage
  usbip:vudc: BUG kmalloc-2048 (Not tainted): Poison overwritten
  libertas: don't set URB_ZERO_PACKET on IN USB transfer
  xen/pvh: don't try to unplug emulated devices
  xen/pvh: increase early stack size
  xen: make xen_qlock_wait() nestable
  xen: fix race in xen_qlock_wait()
  xen/balloon: Support xend-based toolstack
  xen/blkfront: avoid NULL blkfront_info dereference on device removal
  tpm: Restore functionality to xen vtpm driver.
  xen-swiotlb: use actually allocated size on check physical continuous
  ARM: dts: exynos: Mark 1 GHz CPU OPP as suspend OPP on Exynos5250
  ARM: dts: exynos: Convert exynos5250.dtsi to opp-v2 bindings
  OPP: Free OPP table properly on performance state irregularities
  f2fs: fix to account IO correctly
  f2fs: fix to recover cold bit of inode block during POR
  f2fs: fix missing up_read
  Revert "f2fs: fix to clear PG_checked flag in set_page_dirty()"
  cpupower: Fix AMD Family 0x17 msr_pstate size
  ALSA: hda: Check the non-cached stream buffers more explicitly
  IB/rxe: fix for duplicate request processing and ack psns
  dmaengine: dma-jz4780: Return error if not probed from DT
  mfd: menelaus: Fix possible race condition and leak
  f2fs: fix to flush all dirty inodes recovered in readonly fs
  signal: Always deliver the kernel's SIGKILL and SIGSTOP to a pid namespace init
  f2fs: report error if quota off error during umount
  f2fs: avoid sleeping under spin_lock
  scsi: lpfc: Correct race with abort on completion path
  scsi: lpfc: Correct soft lockup when running mds diagnostics
  uio: ensure class is registered before devices
  IB/mlx5: Allow transition of DCI QP to reset
  IB/ipoib: Use dev_port to expose network interface port numbers
  firmware: coreboot: Unmap ioregion after device population
  ASoC: AMD: Fix capture unstable in beginning for some runs
  driver/dma/ioat: Call del_timer_sync() without holding prep_lock
  Smack: ptrace capability use fixes
  usb: chipidea: Prevent unbalanced IRQ disable
  crypto: caam - fix implicit casts in endianness helpers
  PCI: dwc: pci-dra7xx: Enable errata i870 for both EP and RC mode
  coresight: etb10: Fix handling of perf mode
  PCI/MSI: Warn and return error if driver enables MSI/MSI-X twice
  f2fs: fix to recover inode's i_flags during POR
  f2fs: fix to recover inode's crtime during POR
  scsi: qla2xxx: Fix recursive mailbox timeout
  xhci: Avoid USB autosuspend when resuming USB2 ports.
  nvmem: check the return value of nvmem_add_cells()
  PCI: cadence: Correct probe behaviour when failing to get PHY
  MD: fix invalid stored role for a disk
  ext4: fix argument checking in EXT4_IOC_MOVE_EXT
  usb: gadget: udc: atmel: handle at91sam9rl PMC
  usb: dwc2: fix a race with external vbus supply
  usb: dwc2: fix call to vbus supply exit routine, call it unlocked
  irqchip/pdc: Setup all edge interrupts as rising edge at GIC
  xprtrdma: Reset credit grant properly after a disconnect
  PCI / ACPI: Enable wake automatically for power managed bridges
  VMCI: Resource wildcard match fixed
  Drivers: hv: vmbus: Use cpumask_var_t for on-stack cpu mask
  f2fs: clear PageError on the read path
  tpm: suppress transmit cmd error logs when TPM 1.2 is disabled/deactivated
  usb: typec: tcpm: Report back negotiated PPS voltage and current
  PCI: cadence: Use AXI region 0 to signal interrupts from EP
  PCI: mediatek: Fix mtk_pcie_find_port() endpoint/port matching logic
  usb: host: ohci-at91: fix request of irq for optional gpio
  RDMA/bnxt_re: Fix recursive lock warning in debug kernel
  RDMA/bnxt_re: Avoid accessing nq->bar_reg_iomem in failure case
  IB/ipoib: Clear IPCB before icmp_send
  RDMA/cm: Respect returned status of cm_init_av_by_path
  RDMA/core: Do not expose unsupported counters
  scsi: megaraid_sas: fix a missing-check bug
  KVM: nVMX: Clear reserved bits of #DB exit qualification
  UAPI: ndctl: Fix g++-unsupported initialisation in headers
  scsi: ufs: Schedule clk gating work on correct queue
  scsi: esp_scsi: Track residual for PIO transfers
  of: Add missing exports of node name compare functions
  md: fix memleak for mempool
  MD: Memory leak when flush bio size is zero
  f2fs: fix to account IO correctly for cgroup writeback
  net: stmmac: dwmac-sun8i: fix OF child-node lookup
  cgroup, netclassid: add a preemption point to write_classid
  cifs: fix a credits leak for compund commands
  thermal: da9062/61: Prevent hardware access during system suspend
  thermal: rcar_thermal: Prevent doing work after unbind
  libata: Apply NOLPM quirk for SAMSUNG MZ7TD256HAFV-000L9
  ath10k: schedule hardware restart if WMI command times out
  wil6210: fix RX buffers release and unmap
  ixgbevf: VF2VF TCP RSS
  ixgbe: disallow IPsec Tx offload when in SR-IOV mode
  gpio: brcmstb: allow 0 width GPIO banks
  iwlwifi: mvm: fix BAR seq ctrl reporting
  libertas_tf: prevent underflow in process_cmdrequest()
  rsi: fix memory alignment issue in ARM32 platforms
  mt76x2u: run device cleanup routine if resume fails
  net: dsa: mv88e6xxx: Fix writing to a PHY page.
  net: hns3: Fix for vf vlan delete failed problem
  net: hns3: Fix ping exited problem when doing lp selftest
  net: hns3: Preserve vlan 0 in hardware table
  pinctrl: ssbi-gpio: Fix pm8xxx_pin_config_get() to be compliant
  pinctrl: spmi-mpp: Fix pmic_mpp_config_get() to be compliant
  perf tests: Fix record+probe_libc_inet_pton.sh without ping's debuginfo
  failover: Add missing check to validate 'slave_dev' in net_failover_slave_unregister
  bpf/verifier: fix verifier instability
  pinctrl: qcom: spmi-mpp: Fix drive strength setting
  ACPI / LPSS: Add alternative ACPI HIDs for Cherry Trail DMA controllers
  spi: gpio: No MISO does not imply no RX
  kprobes: Return error if we fail to reuse kprobe instead of BUG_ON()
  arm64: entry: Allow handling of undefined instructions from EL1
  block, bfq: correctly charge and reset entity service in all cases
  net: phy: phylink: ensure the carrier is off when starting phylink
  net: hns3: Set STATE_DOWN bit of hdev state when stopping net
  net: hns3: Check hdev state when getting link status
  brcmfmac: fix for proper support of 160MHz bandwidth
  pinctrl: qcom: spmi-mpp: Fix err handling of pmic_mpp_set_mux
  pinctrl: sunxi: fix 'pctrl->functions' allocation in sunxi_pinctrl_build_state
  net: hns3: Fix ets validate issue
  net: hns3: Add nic state check before calling netif_tx_wake_queue
  x86: boot: Fix EFI stub alignment
  efi/x86: Call efi_parse_options() from efi_main()
  Bluetooth: hci_qca: Remove hdev dereference in qca_close().
  Bluetooth: btbcm: Add entry for BCM4335C0 UART bluetooth
  net: hns3: Fix for packet buffer setting bug
  ice: update fw version check logic
  ice: fix changing of ring descriptor size (ethtool -G)
  signal: Introduce COMPAT_SIGMINSTKSZ for use in compat_sys_sigaltstack
  ath10k: fix tx status flag setting for management frames
  nvme: call nvme_complete_rq when nvmf_check_ready fails for mpath I/O
  mtd: rawnand: atmel: Fix potential NULL pointer dereference
  x86/intel_rdt: Show missing resctrl mount options
  cpufreq: dt: Try freeing static OPPs only if we have added them
  ACPI / processor: Fix the return value of acpi_processor_ids_walk()
  ACPI / PM: LPIT: Register sysfs attributes based on FADT
  ACPI/PPTT: Handle architecturally unknown cache types
  wlcore: Fix BUG with clear completion on timeout
  x86/olpc: Indicate that legacy PC XO-1 platform should not register RTC
  iwlwifi: mvm: check for n_profiles validity in EWRD ACPI
  iwlwifi: mvm: clear HW_RESTART_REQUESTED when stopping the interface
  iwlwifi: pcie: avoid empty free RB queue
  mtd: rawnand: denali: set SPARE_AREA_SKIP_BYTES register to 8 if unset
  sdhci: acpi: add free_slot callback
  mmc: sdhci-pci-o2micro: Add quirk for O2 Micro dev 0x8620 rev 0x01
  bcache: Populate writeback_rate_minimum attribute
  cpupower: Fix coredump on VMWare
  perf strbuf: Match va_{add,copy} with va_end
  perf tools: Free 'printk' string in parse_ftrace_printk()
  perf tools: Cleanup trace-event-info 'tdata' leak
  perf tools: Free temporary 'sys' string in read_event_files()
  spi: spi-ep93xx: Use dma_data_direction for ep93xx_spi_dma_{finish,prepare}
  lightnvm: pblk: fix race condition on metadata I/O
  lightnvm: pblk: fix two sleep-in-atomic-context bugs
  lightnvm: pblk: fix race on sysfs line state
  hwmon: (pwm-fan) Set fan speed to 0 on suspend
  s390/sthyi: Fix machine name validity indication
  tun: Consistently configure generic netdev params via rtnetlink
  nfp: devlink port split support for 1x100G CXP NIC
  hv_netvsc: fix vf serial matching with pci slot info
  arm64: cpufeature: ctr: Fix cpu capability check for late CPUs
  swim: fix cleanup on setup error
  ataflop: fix error handling during setup
  netfilter: xt_nat: fix DNAT target for shifted portmap ranges
  locking/lockdep: Fix debug_locks off performance problem
  net: loopback: clear skb->tstamp before netif_rx()
  net: socionext: Reset tx queue in ndo_stop
  ARM: dts: exynos: Disable pull control for MAX8997 interrupts on Origen
  x86/numa_emulation: Fix uniform-split numa emulation
  x86/mm/pat: Disable preemption around __flush_tlb_all()
  x86/kvm/nVMX: allow bare VMXON state migration
  x86/corruption-check: Fix panic in memory_corruption_check() when boot option without value is provided
  x86/xen: Fix boot loader version reported for PVH guests
  x86/speculation: Enable cross-hyperthread spectre v2 STIBP mitigation
  ALSA: hda - Fix incorrect clearance of thinkpad_acpi hooks
  ALSA: ca0106: Disable IZD on SB0570 DAC to fix audio pops
  ALSA: hda: Add 2 more models to the power_save blacklist
  ALSA: hda - Add mic quirk for the Lenovo G50-30 (17aa:3905)
  ALSA: hda/realtek - Fix the problem of the front MIC on the Lenovo M715
  ALSA: hda - Fix headphone pin config for ASUS G751
  ALSA: hda - Add quirk for ASUS G751 laptop
  parisc: Fix exported address of os_hpmc handler
  parisc: Fix map_pages() to not overwrite existing pte entries
  parisc: Fix address in HPMC IVA
  mailbox: PCC: handle parse error
  ipmi: Fix timer race with module unload
  kprobes/x86: Use preempt_enable() in optimized_callback()
  acpi, nfit: Fix Address Range Scrub completion tracking
  ACPICA: AML Parser: fix parse loop to correctly skip erroneous extended opcodes
  ACPICA: AML interpreter: add region addresses in global list during initialization
  ACPI / OSL: Use 'jiffies' as the time bassis for acpi_os_get_timer()
  pcmcia: Implement CLKRUN protocol disabling for Ricoh bridges
  dma-mapping: fix panic caused by passing empty cma command line argument
  cpufreq: conservative: Take limits changes into account properly
  block: make sure writesame bio is aligned with logical block size
  block: make sure discard bio is aligned with logical block size
  block: setup bounce bio_sets properly
  jffs2: free jffs2_sb_info through jffs2_kill_sb()
  hwmon: (pmbus) Fix page count auto-detection.
  bcache: fix miss key refill->end in writeback
  bcache: correct dirty data statistics
  bcache: fix ioctl in flash device
  bcache: trace missed reading by cache_missed
  spi: bcm-qspi: fix calculation of address length
  spi: bcm-qspi: switch back to reading flash using smaller chunks
  spi: spi-mem: Adjust op len based on message/transfer size limitations
  mtd: spi-nor: fsl-quadspi: Don't let -EINVAL on the bus
  mtd: spi-nor: intel-spi: Add support for Intel Ice Lake SPI serial flash
  mtd: spi-nor: fsl-quadspi: fix read error for flash size larger than 16MB
  mtd: maps: gpio-addr-flash: Fix ioremapped size
  mtd: rawnand: marvell: fix the IRQ handler complete() condition
  gpio: mxs: Get rid of external API call
  MIPS: VDSO: Reduce VDSO_RANDOMIZE_SIZE to 64MB for 64bit
  bpf: fix partial copy of map_ptr when dst is scalar

Conflicts:
	drivers/iommu/arm-smmu.c

Change-Id: Iff6f46fb6932b2a41a7a3df5f2a18f1eddfb9d66
Signed-off-by: Blagovest Kolenichev <bkolenichev@codeaurora.org>
2018-11-26 05:12:07 -08:00
Colin Ian King
9632c0339b rpmsg: smd: fix memory leak on channel create
commit 940c620d6af8fca7d115de40f19870fba415efac upstream.

Currently a failed allocation of channel->name leads to an
immediate return without freeing channel. Fix this by setting
ret to -ENOMEM and jumping to an exit path that kfree's channel.

Detected by CoverityScan, CID#1473692 ("Resource Leak")

Fixes: 53e2822e56 ("rpmsg: Introduce Qualcomm SMD backend")
Cc: stable@vger.kernel.org
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-11-13 11:08:55 -08:00
Chris Lew
d064080d80 rpmsg: Add snapshot of RPMSG Glink drivers
This snapshot is taken as of msm-4.14 'commit <67942dbf2187>
("Merge "net: netfilter: IRC DCC for private clients"")'.

This change brings the rpmsg and rpmsg glink drivers up to date with
the fixes from msm-4.14 and also adds the spi and spss transports from
msm-4.14. In addition, change the copyrights to SPDX format.

Change-Id: Idc0c9ad00c0562a7f3e2807ea9cfca644680dd9d
Signed-off-by: Chris Lew <clew@codeaurora.org>
2018-10-18 15:51:12 -07:00
Arun Kumar Neelakantam
00b645e0b4 rpmsg: Add compat ioctl for rpmsg char driver
Add compat ioctl callback to support 32bit user space applications.

Signed-off-by: Arun Kumar Neelakantam <aneela@codeaurora.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-07-30 23:40:23 -07:00
Chris Lew
475452fca1 rpmsg: glink: Store edge name for glink device
Channels may need to identify the edge their channel was probed for.
Store the edge name by reading the label property from device tree or
default to the node name.

Signed-off-by: Chris Lew <clew@codeaurora.org>
Signed-off-by: Arun Kumar Neelakantam <aneela@codeaurora.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-07-30 23:39:04 -07:00
Srinivas Kandagatla
fe782affd0 rpmsg: core: add support to power domains for devices
Some of the rpmsg devices need to switch on power domains to communicate
with remote processor. For example on Qualcomm DB820c platform LPASS
power domain needs to switched on for any kind of audio services.
This patch adds the missing power domain support in rpmsg core.

Without this patch attempting to play audio via QDSP on DB820c would
reboot the system.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-07-30 23:32:03 -07:00
Srinivas Kandagatla
82eca590cf rpmsg: smd: fix kerneldoc warnings
This patch fixes below kerneldoc warnings

qcom_smd.c:141: warning: Function parameter or member 'dev' not described in 'qcom_smd_edge'
qcom_smd.c:141: warning: Function parameter or member 'name' not described in 'qcom_smd_edge'
qcom_smd.c:141: warning: Function parameter or member 'new_channel_event' not described in 'qcom_smd_edge'
qcom_smd.c:222: warning: Function parameter or member 'qsept' not described in 'qcom_smd_channel'
qcom_smd.c:222: warning: Function parameter or member 'registered' not described in 'qcom_smd_channel'
qcom_smd.c:222: warning: Function parameter or member 'state_change_event' not described in 'qcom_smd_channel'
qcom_smd.c:222: warning: Function parameter or member 'drvdata' not described in 'qcom_smd_channel'
qcom_smd.c:737: warning: Function parameter or member 'wait' not described in '__qcom_smd_send'

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-07-30 23:22:23 -07:00
Srinivas Kandagatla
6f0b958427 rpmsg: glink: Fix various kerneldoc warnings.
Fix below kerneldoc warnings while building with W=1
qcom_glink_native.c:53: warning: Function parameter or member 'data' not described in 'glink_defer_cmd'
qcom_glink_native.c:75: warning: Function parameter or member 'data' not described in 'glink_core_rx_intent'
qcom_glink_native.c:75: warning: Function parameter or member 'id' not described in 'glink_core_rx_intent'
qcom_glink_native.c:75: warning: Function parameter or member 'size' not described in 'glink_core_rx_intent'
qcom_glink_native.c:75: warning: Function parameter or member 'reuse' not described in 'glink_core_rx_intent'
qcom_glink_native.c:75: warning: Function parameter or member 'in_use' not described in 'glink_core_rx_intent'
qcom_glink_native.c:75: warning: Function parameter or member 'offset' not described in 'glink_core_rx_intent'
qcom_glink_native.c:75: warning: Function parameter or member 'node' not described in 'glink_core_rx_intent'
qcom_glink_native.c:116: warning: Function parameter or member 'features' not described in 'qcom_glink'
qcom_glink_native.c:116: warning: Function parameter or member 'intentless' not described in 'qcom_glink'
qcom_glink_native.c:524: warning: Function parameter or member 'version' not described in 'qcom_glink_receive_version'
qcom_glink_native.c:524: warning: Function parameter or member 'features' not described in 'qcom_glink_receive_version'
qcom_glink_native.c:524: warning: Excess function parameter 'r_version' description in 'qcom_glink_receive_version'
qcom_glink_native.c:524: warning: Excess function parameter 'r_features' description in 'qcom_glink_receive_version'
qcom_glink_native.c:551: warning: Function parameter or member 'version' not described in 'qcom_glink_receive_version_ack'
qcom_glink_native.c:551: warning: Function parameter or member 'features' not described in 'qcom_glink_receive_version_ack'
qcom_glink_native.c:551: warning: Excess function parameter 'r_version' description in 'qcom_glink_receive_version_ack'
qcom_glink_native.c:551: warning: Excess function parameter 'r_features' description in 'qcom_glink_receive_version_ack'
qcom_glink_native.c:570: warning: bad line:                                       wire format and transmit
qcom_glink_native.c:604: warning: Function parameter or member 'intent' not described in 'qcom_glink_advertise_intent'
qcom_glink_native.c:604: warning: Excess function parameter 'size' description in 'qcom_glink_advertise_intent'
qcom_glink_native.c:710: warning: Function parameter or member 'glink' not described in 'qcom_glink_handle_intent_req'
qcom_glink_native.c:710: warning: Function parameter or member 'cid' not described in 'qcom_glink_handle_intent_req'
qcom_glink_native.c:710: warning: Function parameter or member 'size' not described in 'qcom_glink_handle_intent_req'

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-07-30 23:21:53 -07:00
Srinivas Kandagatla
427613ee19 rpmsg: glink: correctly annotate intent members
As intent structure members are not correctly annotated, leading to below warnings

qcom_glink_native.c:614:16: warning: incorrect type in assignment (different base types)
qcom_glink_native.c:614:16:    expected unsigned short [unsigned] [usertype] id
qcom_glink_native.c:614:16:    got restricted __le16 [usertype] <noident>
qcom_glink_native.c:615:18: warning: incorrect type in assignment (different base types)
qcom_glink_native.c:615:18:    expected unsigned short [unsigned] [usertype] lcid
qcom_glink_native.c:615:18:    got restricted __le16 [usertype] <noident>
qcom_glink_native.c:616:19: warning: incorrect type in assignment (different base types)
qcom_glink_native.c:616:19:    expected unsigned int [unsigned] [usertype] count
qcom_glink_native.c:616:19:    got restricted __le32 [usertype] <noident>
qcom_glink_native.c:617:18: warning: incorrect type in assignment (different base types)
qcom_glink_native.c:617:18:    expected unsigned int [unsigned] [usertype] size
qcom_glink_native.c:617:18:    got restricted __le32 [usertype] <noident>
qcom_glink_native.c:618:18: warning: incorrect type in assignment (different base types)
qcom_glink_native.c:618:18:    expected unsigned int [unsigned] [usertype] liid
qcom_glink_native.c:618:18:    got restricted __le32 [usertype] <noident>

Fix this by correctly annotating them.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-07-30 23:21:36 -07:00
Niklas Cassel
67cd0eec5b rpmsg: smd: Add missing include of sizes.h
Add missing include of sizes.h.

drivers/rpmsg/qcom_smd.c: In function ‘qcom_smd_channel_open’:
drivers/rpmsg/qcom_smd.c:809:36: error: ‘SZ_4K’ undeclared (first use in this function)
  bb_size = min(channel->fifo_size, SZ_4K);
                                    ^~~~~

Signed-off-by: Niklas Cassel <niklas.cassel@linaro.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-07-01 23:32:21 -07:00
Srinivas Kandagatla
4a2e84c6ed rpmsg: smd: do not use mananged resources for endpoints and channels
All the managed resources would be freed by the time release function
is invoked. Handling such memory in qcom_smd_edge_release() would do
bad things.

Found this issue while testing Audio usecase where the dsp is started up
and shutdown in a loop.

This patch fixes this issue by using simple kzalloc for allocating
channel->name and channel which is then freed in qcom_smd_edge_release().

Without this patch restarting a remoteproc would crash the system.
Fixes: 53e2822e56 ("rpmsg: Introduce Qualcomm SMD backend")
Cc: <stable@vger.kernel.org>
Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-06-04 12:35:03 -07:00
Suman Anna
136200f4fd rpmsg: char: Switch to SPDX license identifier
Use the appropriate SPDX license identifier in the rpmsg char driver
source file and drop the previous boilerplate license text. The uapi
header file already had the SPDX license identifier added as part of
a mass update but the license text removal was deferred for later,
and this patch drops the same.

Signed-off-by: Suman Anna <s-anna@ti.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-06-03 17:37:16 -07:00
Suman Anna
84369fbe62 rpmsg: glink: Switch to SPDX license identifier
Use the appropriate SPDX license identifier in various rpmsg
glink driver source files and drop the previous boilerplate
license text.

Signed-off-by: Suman Anna <s-anna@ti.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-06-03 17:37:15 -07:00
Suman Anna
49b0597825 rpmsg: smd: Switch to SPDX license identifier
Use the appropriate SPDX license identifier in the rpmsg SMD backend
driver source file and drop the previous boilerplate license text.

Signed-off-by: Suman Anna <s-anna@ti.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2018-06-03 17:37:14 -07:00