aboutsummaryrefslogtreecommitdiff
path: root/drivers
AgeCommit message (Collapse)AuthorFilesLines
2016-12-30vfio-mdev: Make mdev_device private and abstract interfacesAlex Williamson3-9/+52
Abstract access to mdev_device so that we can define which interfaces are public rather than relying on comments in the structure. Cc: Zhenyu Wang <[email protected]> Cc: Zhi Wang <[email protected]> Signed-off-by: Alex Williamson <[email protected]> Reviewed-by: Jike Song <[email protected]> Reviewed by: Kirti Wankhede <[email protected]>
2016-12-30vfio-mdev: Make mdev_parent privateAlex Williamson3-1/+17
Rather than hoping for good behavior by marking some elements internal, enforce it by making the entire structure private and creating an accessor function for the one useful external field. Cc: Zhenyu Wang <[email protected]> Cc: Zhi Wang <[email protected]> Cc: Jike Song <[email protected]> Signed-off-by: Alex Williamson <[email protected]> Reviewed by: Kirti Wankhede <[email protected]>
2016-12-30vfio-mdev: de-polute the namespace, rename parent_device & parent_opsAlex Williamson5-28/+28
Add an mdev_ prefix so we're not poluting the namespace so much. Cc: Zhenyu Wang <[email protected]> Cc: Zhi Wang <[email protected]> Cc: Jike Song <[email protected]> Signed-off-by: Alex Williamson <[email protected]> Reviewed by: Kirti Wankhede <[email protected]>
2016-12-30vfio-mdev: Fix remove raceAlex Williamson1-2/+34
Using the mtty mdev sample driver we can generate a remove race by starting one shell that continuously creates mtty devices and several other shells all attempting to remove devices, in my case four remove shells. The fault occurs in mdev_remove_sysfs_files() where the passed type arg is NULL, which suggests we've received a struct device in mdev_device_remove() but it's in some sort of teardown state. The solution here is to make use of the accidentally unused list_head on the mdev_device such that the mdev core keeps a list of all the mdev devices. This allows us to validate that we have a valid mdev before we start removal, remove it from the list to prevent others from working on it, and if the vendor driver refuses to remove, we can re-add it to the list. Cc: Kirti Wankhede <[email protected]> Signed-off-by: Alex Williamson <[email protected]>
2016-12-30vfio/type1: Restore mapping performance with mdev supportAlex Williamson1-47/+51
As part of the mdev support, type1 now gets a task reference per vfio_dma and uses that to get an mm reference for the task while working on accounting. That's correct, but it's not fast. For some paths, like vfio_pin_pages_remote(), we know we're only called from user context, so we can restore the lighter weight calls. In other cases, we're effectively already testing whether we're in the stored task context elsewhere, extend this vfio_lock_acct() as well. Signed-off-by: Alex Williamson <[email protected]> Reviewed by: Kirti Wankhede <[email protected]>
2016-12-30firmware: arm_scpi: fix reading sensor values on pre-1.0 SCPI firmwaresMartin Blumenstingl1-2/+8
The pre-1.0 SCPI firmwares are using single __le32 as sensor value, while the SCPI v1.0 protocol uses two __le32 as sensor values(64bit) split into 32bit upper and 32bit lower value. Using an "struct sensor_value" to read the sensor value on a pre-1.0 SCPI firmware gives garbage in the "hi_val" field. This patch fixes the issue by reading only the lower 32-bit value for all pre-1.0 SCPI versions. Suggested-by: Sudeep Holla <[email protected]> Signed-off-by: Martin Blumenstingl <[email protected]> [[email protected]: updated the commit log to reflect the implementation] Signed-off-by: Sudeep Holla <[email protected]>
2016-12-30drm: Avoid NULL dereference of drm_device.devChris Wilson1-1/+2
For a virtual device, drm_device.dev is NULL, so becareful not to dereference it unconditionally in core code such as drm_dev_register(). Fixes: 75f6dfe3e652 ("drm: Deduplicate driver initialization message") Signed-off-by: Chris Wilson <[email protected]> Cc: Gabriel Krisman Bertazi <[email protected]> Cc: Daniel Vetter <[email protected]> Signed-off-by: Daniel Vetter <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2016-12-30rtlwifi: rtl_usb: Fix missing entry in USB driver's private dataLarry Finger1-0/+1
These drivers need to be able to reference "struct ieee80211_hw" from the driver's private data, and vice versa. The USB driver failed to store the address of ieee80211_hw in the private data. Although this bug has been present for a long time, it was not exposed until commit ba9f93f82aba ("rtlwifi: Fix enter/exit power_save"). Fixes: ba9f93f82aba ("rtlwifi: Fix enter/exit power_save") Signed-off-by: Larry Finger <[email protected]> Signed-off-by: Kalle Valo <[email protected]>
2016-12-30pinctrl: samsung: Fix the width of PINCFG_TYPE_DRV bitfields for Exynos5433Chanwoo Choi2-40/+82
This patch fixes the wrong width of PINCFG_TYPE_DRV bitfields for Exynos5433 because PINCFG_TYPE_DRV of Exynos5433 has 4bit fields in the *_DRV registers. Usually, other Exynos have 2bit field for PINCFG_TYPE_DRV. Fixes: 3c5ecc9ed353 ("pinctrl: exynos: Add support for Exynos5433") Cc: [email protected] Cc: Tomasz Figa <[email protected]> Cc: Krzysztof Kozlowski <[email protected]> Cc: Sylwester Nawrocki <[email protected]> Cc: Linus Walleij <[email protected]> Cc: Kukjin Kim <[email protected]> Cc: Javier Martinez Canillas <[email protected]> Signed-off-by: Chanwoo Choi <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2016-12-30drm/atomic-helpers: Remove outdated commentDaniel Vetter1-5/+0
We forgot to clean this up when adding connector refcounting. Reviewed-by: David Herrmann <[email protected]> Signed-off-by: Daniel Vetter <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2016-12-30drm/rect: Fix formatting of example codeDaniel Vetter1-3/+3
Drive-by polish. Cc: Ville Syrjälä <[email protected]> Signed-off-by: Daniel Vetter <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2016-12-30drm/doc: use preferred struct reference in kernel-docDaniel Vetter18-41/+41
sed -e 's/\( \* .*\)struct &\([_a-z]*\)/\1\&struct \2/' -i Originally I wasnt a friend of this style because I thought a line-break between the "&struct" and "foo" part would break it. But a quick test shows that " * &struct \n * foo\n" works pefectly well with current kernel-doc. So time to mass-apply these changes! Cc: Jani Nikula <[email protected]> Cc: Chris Wilson <[email protected]> Reviewed-by: David Herrmann <[email protected]> Signed-off-by: Daniel Vetter <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2016-12-30dma-buf: Use recommended structure member referenceDaniel Vetter1-3/+2
I just learned that &struct_name.member_name works and looks pretty even. It doesn't (yet) link to the member directly though, which would be really good for big structures or vfunc tables (where the per-member kerneldoc tends to be long). Cc: Sumit Semwal <[email protected]> Cc: Jani Nikula <[email protected]> Cc: Chris Wilson <[email protected]> Reviewed-by: David Herrmann <[email protected]> Signed-off-by: Daniel Vetter <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2016-12-30orinoco: Use shash instead of ahash for MIC calculationsAndrew Lutomirski3-21/+30
Eric Biggers pointed out that the orinoco driver pointed scatterlists at the stack. Fix it by switching from ahash to shash. The result should be simpler, faster, and more correct. kvalo: cherry picked from commit 1fef293b8a9850cfa124a53c1d8878d355010403 as I accidentally applied this patch to wireless-drivers-next when I was supposed to apply this wireless-drivers Cc: [email protected] # 4.9 only Reported-by: Eric Biggers <[email protected]> Signed-off-by: Andy Lutomirski <[email protected]> Signed-off-by: Kalle Valo <[email protected]>
2016-12-30dma-buf: use preferred struct reference in kernel-docDaniel Vetter1-3/+3
sed -e 's/\( \* .*\)struct &\([_a-z]*\)/\1\&struct \2/' -i Originally I wasnt a friend of this style because I thought a line-break between the "&struct" and "foo" part would break it. But a quick test shows that " * &struct \n * foo\n" works pefectly well with current kernel-doc. So time to mass-apply these changes! Cc: Sumit Semwal <[email protected]> Cc: Jani Nikula <[email protected]> Cc: Chris Wilson <[email protected]> Reviewed-by: David Herrmann <[email protected]> Signed-off-by: Daniel Vetter <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2016-12-30drm/mm: Some doc polishDaniel Vetter1-19/+22
Added some boilerplate for the structs, documented members where they are relevant and plenty of markup for hyperlinks all over. And a few small wording polish. Note that the intro needs some more love after the DRM_MM_INSERT_* patch from Chris has landed. v2: Spelling fixes (Chris). v3: Use &struct foo instead of &foo structure (Chris). Cc: Chris Wilson <[email protected]> Cc: Joonas Lahtinen <[email protected]> Reviewed-by: David Herrmann <[email protected]> Signed-off-by: Daniel Vetter <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2016-12-30drm: Update TTM initialization documentationGabriel Krisman Bertazi1-0/+23
ttm_global_reference was renamed to drm_global_reference. This updates the documentation to reflect that. While we are there, document the drm_global_reference API and update the initialization interface documentation. Signed-off-by: Gabriel Krisman Bertazi <[email protected]> [danvet: Keep the warning, ttm docs are still massively inadequate.] Signed-off-by: Daniel Vetter <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2016-12-30drm: Export drm_ioctl_permit to kernel-docGabriel Krisman Bertazi1-3/+5
drm_ioctl_permit is exported but missed a kernel-doc style documentation. Signed-off-by: Gabriel Krisman Bertazi <[email protected]> Signed-off-by: Daniel Vetter <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2016-12-30drm: Drop unused forward declaration of drm_versionGabriel Krisman Bertazi1-3/+0
Signed-off-by: Gabriel Krisman Bertazi <[email protected]> Signed-off-by: Daniel Vetter <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2016-12-30drm: Deduplicate driver initialization messageGabriel Krisman Bertazi8-30/+7
Several DRM drivers print the same initialization message right after drm_dev_register, so move that to common code. The exception is i915, which uses its own register handle, so let it keep its own message. Notice that this was tested only with Exynos, but looks simple enough for the other drivers. Signed-off-by: Gabriel Krisman Bertazi <[email protected]> Signed-off-by: Daniel Vetter <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2016-12-30Revert "remoteproc: Merge table_ptr and cached_table pointers"Bjorn Andersson1-10/+16
Following any fw_rsc_vdev entries in the resource table are two variable length arrays, the first one reference vring resources and the second one is the virtio config space. The virtio config space is used by virtio to communicate status and configuration changes and must as such be shared with the remote. The reverted commit incorrectly made any changes to the virtio config space only affect the local copy, in an attempt to allowing memory protection of the shared resource table. This reverts commit cda8529346935fc86f476999ac4fbfe4e17abf11. Signed-off-by: Bjorn Andersson <[email protected]>
2016-12-30drm: Reduce verbosity level for drm_core_init() debug messageChris Wilson1-1/+1
Currently at the end of drm_core_init() we print [ 0.735185] [drm] Initialized which does not provide any user information and is only a breadcrumb for developers, so reduce it from info to debug. Signed-off-by: Chris Wilson <[email protected]> Signed-off-by: Daniel Vetter <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2016-12-30remoteproc: fix vdev reference managementLoic Pallardy1-3/+0
Commit 2b45cef5868a ("remoteproc: Further extend the vdev life cycle") extends kref support for vdev management. It introduces a regression when following sequence is executed: rproc_boot --> rproc_shutdown --> rproc_boot Second rproc_boot call crashes on register_virtio_device as device is already existing. Issue is previous vdev is never released when rproc is stop because associated refcount is too high. kref_get introduces is not needed as kref_init already initializes krefcount to 1 because it considers associated variable as used. This introduces a misalignment between kref_get and kref_put calls. Fixes: 2b45cef5868a ("remoteproc: Further extend the vdev life cycle") Signed-off-by: Loic Pallardy <[email protected]> Signed-off-by: Bjorn Andersson <[email protected]>
2016-12-30drm: rockchip: use crtc helper drm_crtc_from_index()Shawn Guo1-15/+2
Function rockchip_crtc_from_pipe() does the exactly same thing as what crtc helper drm_crtc_from_index() provides. Use the helper to save some code. Signed-off-by: Shawn Guo <[email protected]> Signed-off-by: Daniel Vetter <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2016-12-30drm: zte: use crtc helper drm_crtc_from_index()Shawn Guo1-13/+2
Function zx_find_crtc() does the exactly same thing as what crtc helper drm_crtc_from_index() provides. Use the helper to save some code. Signed-off-by: Shawn Guo <[email protected]> Signed-off-by: Daniel Vetter <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2016-12-30rpmsg: virtio_rpmsg_bus: fix channel creationLoic Pallardy1-2/+2
Since commit 4dffed5b3ac796b ("rpmsg: Name rpmsg devices based on channel id"), it is no more possible for a firmware to register twice a service (on different endpoints). rpmsg_register_device function is failing when calling device_add for the second time as second device has the same name as first one already register. It is because name is based only on service name and so is not more unique. Previously name was unique thanks to the use of rpmsg_dev_index. This patch adds destination and source endpoint numbers device name to create an unique identifier. Fixes: 4dffed5b3ac7 ("rpmsg: Name rpmsg devices based on channel id") Acked-by: Peter Griffin <[email protected]> Signed-off-by: Loic Pallardy <[email protected]> [bjorn: flipped name and address in device name] Signed-off-by: Bjorn Andersson <[email protected]>
2016-12-30drm: add crtc helper drm_crtc_from_index()Shawn Guo1-0/+20
It adds a crtc helper drm_crtc_from_index() to find the registered CRTC with a given index, just like drm_plane_from_index(). Signed-off-by: Shawn Guo <[email protected]> Signed-off-by: Daniel Vetter <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2016-12-30drm/mm: Convert to drm_printerDaniel Vetter14-83/+60
Including all drivers. I thought about keeping small compat functions to avoid having to change all drivers. But I really like the drm_printer idea, so figured spreading it more widely is a good thing. v2: Review from Chris: - Natural argument order and better name for drm_mm_print. - show_mm() macro in the selftest. Cc: Rob Clark <[email protected]> Cc: Russell King <[email protected]> Cc: Alex Deucher <[email protected]> Cc: Christian König <[email protected]> Cc: Lucas Stach <[email protected]> Cc: Tomi Valkeinen <[email protected]> Cc: Thierry Reding <[email protected]> Cc: Jyri Sarha <[email protected]> Reviewed-by: Chris Wilson <[email protected]> Signed-off-by: Daniel Vetter <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2016-12-30iio: bmi160: Fix time needed to sleep after command executionMarcin Niestroj1-19/+6
Datasheet specifies typical and maximum execution times for which CMD register is occupied after previous command execution. We took these values as minimum and maximum time for usleep_range() call before making a new command execution. To be sure, that the CMD register is no longer occupied we need to wait *at least* the maximum time specified by datasheet. Signed-off-by: Marcin Niestroj <[email protected]> Cc: <[email protected]> Signed-off-by: Jonathan Cameron <[email protected]>
2016-12-30drm/printer: add debug printerDaniel Vetter1-0/+6
Useful for dumping lots of data into dmesg, e.g. drm_mm. v2: Fixup export_symbol line, I misplaced a hunk (Chris). Cc: Rob Clark <[email protected]> Reviewed-by: Chris Wilson <[email protected]> Signed-off-by: Daniel Vetter <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2016-12-30gpio: Move freeing of GPIO hogs before numbing of the deviceGeert Uytterhoeven1-1/+1
When removing a gpiochip that uses GPIO hogging (e.g. by unloading the chip's DT overlay), a warning is printed: gpio gpiochip8: REMOVING GPIOCHIP WITH GPIOS STILL REQUESTED This happens because gpiochip_free_hogs() is called after the gdev->chip pointer is reset to NULL. Hence __gpiod_free() cannot determine the chip in use, and cannot clear flags nor call the optional chip-specific .free() callback. Move the call to gpiochip_free_hogs() up to fix this. Cc: [email protected] Fixes: ff2b135922992756 ("gpio: make the gpiochip a real device") Signed-off-by: Geert Uytterhoeven <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2016-12-30gpio: mxs: remove __init annotationArnd Bergmann1-1/+1
Building with an old toolchain, I ran into this warning: WARNING: vmlinux.o(.text+0x63eef0): Section mismatch in reference from the function mxs_gpio_probe() to the function .init.text:mxs_gpio_init_gc() Clearly the annotation is wrong, since the function is called from the non-init probe, so let's remove it. Signed-off-by: Arnd Bergmann <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2016-12-30drm/i915: Add dpll entrypoint for dumping hw stateAnder Conselvan de Oliveira3-33/+83
Remove the IS_PLATFORM() macros from intel_dump_pipe_config() and split that logic in platform specific implementations inside the dpll code, accessed through a platform independent interface. v2: Rebase. Signed-off-by: Ander Conselvan de Oliveira <[email protected]> Reviewed-by: Daniel Vetter <[email protected]> (v1) Link: http://patchwork.freedesktop.org/patch/msgid/1483024933-3726-7-git-send-email-ander.conselvan.de.oliveira@intel.com
2016-12-30drm/i915: Update kerneldoc for intel_dpll_mgr.cAnder Conselvan de Oliveira2-20/+225
The documentation for most of the non-static members and structs were missing. Fix that. v2: Fix typos (Durga) v3: Rebase. Fix make docs warnings. Document more. v4: capitilize CRTC; say that the prepare hook is a nop if the DPLL is already enabled; link to struct intel_dpll_hw_state from @hw_state field in struct intel_shared_dpll_state; reorganize DPLL flags; link intel_shared_dpll_state to other structs and functions. (Daniel) Signed-off-by: Ander Conselvan de Oliveira <[email protected]> Reviewed-by: Daniel Vetter <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/1483024933-3726-6-git-send-email-ander.conselvan.de.oliveira@intel.com
2016-12-30drm/i915: Rename intel_shared_dpll->mode_set() to prepare()Ander Conselvan de Oliveira2-6/+6
The hook is called from intel_prepare_shared_dpll(). The name doesn't make sense after all the changes to modeset code. So just call it prepare. Signed-off-by: Ander Conselvan de Oliveira <[email protected]> Reviewed-by: Durgadoss R <[email protected]> Reviewed-by: Daniel Vetter <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/1483024933-3726-5-git-send-email-ander.conselvan.de.oliveira@intel.com
2016-12-30drm/i915: Rename intel_shared_dpll_config to intel_shared_dpll_stateAnder Conselvan de Oliveira7-65/+65
Struct intel_shared_dpll_config is used to hold the state of the DPLL in the "atomic" sense, so call it state like everything else atomic. v2: Rebase Signed-off-by: Ander Conselvan de Oliveira <[email protected]> Reviewed-by: Daniel Vetter <[email protected]> (v1) Link: http://patchwork.freedesktop.org/patch/msgid/1483024933-3726-4-git-send-email-ander.conselvan.de.oliveira@intel.com
2016-12-30drm/i915: Rename intel_shared_dpll_commit() to _swap_state()Ander Conselvan de Oliveira3-3/+8
The function intel_shared_dpll_commit() performs the equivalent of drm_atomic_helper_swap_state() for the shared dpll state, which is not handled by the helpers. So make it do a full swap of the state and rename it for consistency. v2: Fix typo in the commit message. (Durga) v3: Rebase. v4: Swap the states instead of just renaming the function. (Daniel) Signed-off-by: Ander Conselvan de Oliveira <[email protected]> Reviewed-by: Durgadoss R <[email protected]> (v2) Reviewed-by: Daniel Vetter <[email protected]> (v3) Link: http://patchwork.freedesktop.org/patch/msgid/1483024933-3726-3-git-send-email-ander.conselvan.de.oliveira@intel.com
2016-12-30drm/i915: Introduce intel_release_shared_dpll()Ander Conselvan de Oliveira3-36/+22
While the details of getting a shared dpll are wrapped by intel_get_shared_dpll(), the release was still hand rolled into the modeset code. Fix that by creating an entry point for releasing the pll and move that code there. v2: Take old_dpll from crtc->state instead of crtc_state. (CI) Signed-off-by: Ander Conselvan de Oliveira <[email protected]> Reviewed-by: Daniel Vetter <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/1483024933-3726-2-git-send-email-ander.conselvan.de.oliveira@intel.com
2016-12-29sh_eth: fix branch prediction in sh_eth_interrupt()Sergei Shtylyov1-1/+1
IIUC, likely()/unlikely() should apply to the whole *if* statement's expression, not a part of it -- fix such expression in sh_eth_interrupt() accordingly... Fixes: 283e38db65e7 ("sh_eth: Fix serialisation of interrupt disable with interrupt & NAPI handlers") Signed-off-by: Sergei Shtylyov <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2016-12-29pinctrl: meson: fix gpio request disabling other modesNeil Armstrong1-1/+1
The pinctrl_gpio_request is called with the "full" gpio number, already containing the base, then meson_pmx_request_gpio is then called with the final pin number. Remove the base addition when calling meson_pmx_disable_other_groups. Fixes: 6ac730951104 ("pinctrl: add driver for Amlogic Meson SoCs") CC: Beniamino Galvani <[email protected]> Signed-off-by: Neil Armstrong <[email protected]> Acked-by: Kevin Hilman <[email protected]> Acked-by: Beniamino Galvani <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2016-12-29pinctrl/amd: Set the level based on ACPI tablesShyam Sundar S K1-12/+7
In the function amd_gpio_irq_set_type, read the values from the ACPI table to set the level and drop the settings passed by the client. Cc: <[email protected]> # 4.8.x+ Reviewed-by: Pankaj Sen <[email protected]> Reviewed-by: Nitesh Kumar Agrawal <[email protected]> Reviewed-by: Shah, Nehal-bakulchandra <[email protected]> Signed-off-by: Shyam-sundar S-k <[email protected]> Signed-off-by: Linus Walleij <[email protected]>
2016-12-29drm/msm: Verify that MSM_SUBMIT_BO_FLAGS are setJordan Crouse1-1/+2
For every submission buffer object one of MSM_SUBMIT_BO_WRITE and MSM_SUBMIT_BO_READ must be set (and nothing else). If we allowed zero then the buffer object would never get queued to be unreferenced. Signed-off-by: Jordan Crouse <[email protected]> Signed-off-by: Rob Clark <[email protected]>
2016-12-29drm/msm: Put back the vaddr in submit_reloc()Jordan Crouse1-6/+9
The error cases in submit_reloc() need to put back the virtual address of the bo before failling. Add a single failure path for the function. Signed-off-by: Jordan Crouse <[email protected]> Signed-off-by: Rob Clark <[email protected]>
2016-12-29drm/msm: Ensure that the hardware write pointer is validJordan Crouse2-2/+10
Currently the value written to CP_RB_WPTR is calculated on the fly as (rb->next - rb->start). But as the code is designed rb->next is wrapped before writing the commands so if a series of commands happened to fit perfectly in the ringbuffer, rb->next would end up being equal to rb->size / 4 and thus result in an out of bounds address to CP_RB_WPTR. The easiest way to fix this is to mask WPTR when writing it to the hardware; it makes the hardware happy and the rest of the ringbuffer math appears to work and there isn't any point in upsetting anything. Signed-off-by: Jordan Crouse <[email protected]> [squash in is_power_of_2() check] Signed-off-by: Rob Clark <[email protected]>
2016-12-29net/mlx4_core: Fix raw qp flow steering rules under SRIOVJack Morgenstein3-23/+31
Demoting simple flow steering rule priority (for DPDK) was achieved by wrapping FW commands MLX4_QP_FLOW_STEERING_ATTACH/DETACH for the PF as well, and forcing the priority to MLX4_DOMAIN_NIC in the wrapper function for the PF and all VFs. In function mlx4_ib_create_flow(), this change caused the main rule creation for the PF to be wrapped, while it left the associated tunnel steering rule creation unwrapped for the PF. This mismatch caused rule deletion failures in mlx4_ib_destroy_flow() for the PF when the detach wrapper function did not find the associated tunnel-steering rule (since creation of that rule for the PF did not go through the wrapper function). Fix this by setting MLX4_QP_FLOW_STEERING_ATTACH/DETACH to be "native" (so that the PF invocation does not go through the wrapper), and perform the required priority demotion for the PF in the mlx4_ib_create_flow() code path. Fixes: 48564135cba8 ("net/mlx4_core: Demote simple multicast and broadcast flow steering rules") Signed-off-by: Jack Morgenstein <[email protected]> Signed-off-by: Tariq Toukan <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2016-12-29net/mlx4_en: Fix type mismatch for 32-bit systemsSlava Shwartsman1-6/+2
is_power_of_2 expects unsigned long and we pass u64 max_val_cycles, this will be truncated on 32 bit systems, and the result is not what we were expecting. div_u64 expects u32 as a second argument and we pass max_val_cycles_rounded which is u64 hence it will always be truncated. Fix was tested on both 64 and 32 bit systems and got same results for max_val_cycles and max_val_cycles_rounded. Fixes: 4850cf458157 ("net/mlx4_en: Resolve dividing by zero in 32-bit system") Signed-off-by: Slava Shwartsman <[email protected]> Signed-off-by: Tariq Toukan <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2016-12-29net/mlx4: Remove BUG_ON from ICM allocation routineLeon Romanovsky1-1/+6
This patch removes BUG_ON() macro from mlx4_alloc_icm_coherent() by checking DMA address alignment in advance and performing proper folding in case of error. Fixes: 5b0bf5e25efe ("mlx4_core: Support ICM tables in coherent memory") Reported-by: Ozgur Karatas <[email protected]> Signed-off-by: Leon Romanovsky <[email protected]> Signed-off-by: Tariq Toukan <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2016-12-29net/mlx4_en: Fix bad WQE issueEugenia Emantayev1-1/+7
Single send WQE in RX buffer should be stamped with software ownership in order to prevent the flow of QP in error in FW once UPDATE_QP is called. Fixes: 9f519f68cfff ('mlx4_en: Not using Shared Receive Queues') Signed-off-by: Eugenia Emantayev <[email protected]> Signed-off-by: Tariq Toukan <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2016-12-29net/mlx4_core: Use-after-free causes a resource leak in flow-steering detachJack Morgenstein1-2/+4
mlx4_QP_FLOW_STEERING_DETACH_wrapper first removes the steering rule (which results in freeing the rule structure), and then references a field in this struct (the qp number) when releasing the busy-status on the rule's qp. Since this memory was freed, it could reallocated and changed. Therefore, the qp number in the struct may be incorrect, so that we are releasing the incorrect qp. This leaves the rule's qp in the busy state (and could possibly release an incorrect qp as well). Fix this by saving the qp number in a local variable, for use after removing the steering rule. Fixes: 2c473ae7e582 ("net/mlx4_core: Disallow releasing VF QPs which have steering rules") Signed-off-by: Jack Morgenstein <[email protected]> Signed-off-by: Tariq Toukan <[email protected]> Signed-off-by: David S. Miller <[email protected]>
2016-12-29Merge branch 'synaptics-rmi4' into for-linusDmitry Torokhov1-1/+2
This brings in fix for F03 build error when serio is module.