1
0
Fork 0
Commit Graph

187 Commits (62be257e986dab439537b3e1c19ef746a13e1860)

Author SHA1 Message Date
Yue Haibing da217871ed staging: gasket: interrupt: remove unused including <linux/version.h>
Remove including <linux/version.h> that don't need it.

Signed-off-by: Yue Haibing <yuehaibing@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-01-22 11:32:36 +01:00
Robert Deal dc19d43f57 staging: gasket: formatting fixes
Reformat arguments in a few functions in gasket_page_table.c to better
follow linux kernel formatting standards.

Signed-off-by: Robert Deal <robert.edward.deal@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-11-12 14:43:15 -08:00
Kimberly Brown cd27f56fce staging: gasket: use sizeof(*p) for memory allocation
Use sizeof(*p) instead of sizeof(struct P) for memory allocation. This
change complies with the Linux kernel coding style. It improves
readability and decreases the opportunity for bugs if the pointer
variable type is changed. Issue found by checkpatch.

Signed-off-by: Kimberly Brown <kimbrownkd@gmail.com>
Acked-by: Todd Poynor <toddpoynor@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-11-05 14:16:32 +01:00
Laurence Rochfort 4ab7e05dd0 staging: gasket: Fix sparse "incorrect type in assignment" warnings.
Remove the coherent buffer __iomem cookie because the buffer is
allocated from dma_alloc_coherent().

warning: incorrect type in assignment (different address spaces)
   expected unsigned char [noderef] [usertype] <asn:2>*virt_base
   got void *[assigned] mem
warning: incorrect type in argument 3 (different address spaces)
   expected void *cpu_addr
   got unsigned char [noderef] [usertype] <asn:2>*virt_base

Signed-off-by: Laurence Rochfort <laurence.rochfort@gmail.com>
Reviewed-by: Todd Poynor <toddpoynor@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-10-19 21:12:29 +02:00
Todd Poynor 8ae925f025 staging: gasket: remove debug logs for callback invocation
Debug logs for device-specific callback invocation aren't very useful,
remove.

Signed-off-by: Todd Poynor <toddpoynor@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-10-19 21:12:28 +02:00
Todd Poynor e21d5cca3a staging: gasket: remove debug logs in page table mapping calls
Remove very noisy debug logs that also contain typos and incorrect
output formats.

Signed-off-by: Todd Poynor <toddpoynor@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-10-19 21:12:28 +02:00
Maya Nakamura d6de4674d3 staging: gasket: Remove extra blank line
Remove extra blank line. Issue found by checkpatch.pl.

Signed-off-by: Maya Nakamura <m.maya.nakamura@gmail.com>
Reviewed-by: Vaishali Thakkar <vthakkar@vaishalithakkar.in>
Acked-by: Todd Poynor <toddpoynor@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-10-19 21:10:45 +02:00
Nick Ewalt c2aed5648f staging: gasket: Update device virtual address comment
Add that number of page table entries and extended address bit offset
are configurable. Update example virtual address format to be more
consistent with typical usage.

Signed-off-by: Nick Ewalt <nicholasewalt@google.com>
Signed-off-by: Todd Poynor <toddpoynor@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-10-15 16:30:39 +02:00
Nick Ewalt df5f470de0 staging: gasket: sysfs: fix attribute release comment
Comments for gasket_sysfs_get_attr() incorrectly describe reference
release procedure.

Signed-off-by: Nick Ewalt <nicholasewalt@google.com>
Signed-off-by: Todd Poynor <toddpoynor@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-10-15 16:30:38 +02:00
Nick Ewalt 9edcf710ab staging: gasket: apex: fix sysfs_show
sysfs_show was incorrectly extracting the sysfs_attribute_type from the
gasket_sysfs_attribute. This prevented dispatch from working properly.

Signed-off-by: Nick Ewalt <nicholasewalt@google.com>
Signed-off-by: Todd Poynor <toddpoynor@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-10-15 16:30:37 +02:00
Nick Ewalt 4a966fa24a staging: gasket: page_table: simplify gasket_components_to_dev_address
Refactor gasket_components_to_dev_address to be faster and easier to
understand. The old implementation was unnecessarily complex and masked
the page_index for simple addresses but not extended ones. It makes the
most sense for this function to perform no such masking.

Signed-off-by: Nick Ewalt <nicholasewalt@google.com>
Signed-off-by: Todd Poynor <toddpoynor@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-10-15 16:30:37 +02:00
Nick Ewalt bae54fb812 staging: gasket: page_table: fix comment in components_to_dev_address
Comments in components_to_dev_address() describing examples are
inconsistent, fix these to be accurate.

Signed-off-by: Nick Ewalt <nicholasewalt@google.com>
Signed-off-by: Todd Poynor <toddpoynor@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-10-15 16:30:37 +02:00
Nick Ewalt 54be7ec988 staging: gasket: page table: fixup error path allocating coherent mem
Correctly clean up data structure state in gasket_alloc_coherent_memory
error path, to ensure no double free on the stale pointer value.

Signed-off-by: Nick Ewalt <nicholasewalt@google.com>
Signed-off-by: Todd Poynor <toddpoynor@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-10-15 16:30:37 +02:00
Nick Ewalt 53f8a81d46 staging: gasket: page_table: rearrange gasket_page_table_entry
Rearrange gasket_page_table entry to reduce padding slop.

Signed-off-by: Nick Ewalt <nicholasewalt@google.com>
Signed-off-by: Todd Poynor <toddpoynor@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-10-15 16:30:37 +02:00
Nick Ewalt efa5dcfa8f staging: gasket: page_table: remove unnecessary PTE status set to free
Remove unnecessary ptes[i].status update in gasket_perform_unmapping.
The vaaue will be cleared in the following memset.

Signed-off-by: Nick Ewalt <nicholasewalt@google.com>
Signed-off-by: Todd Poynor <toddpoynor@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-10-15 16:30:37 +02:00
Todd Poynor 02d3718633 staging: gasket: page table: remove dead code in coherent mem alloc
gasket_alloc_coherent_memory() has some unnecessary code related to out
of memory checking that will never hit the condition checked, remove.

Signed-off-by: Todd Poynor <toddpoynor@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-10-15 16:30:37 +02:00
Todd Poynor b1004491c9 staging: gasket: page table: return valid error code on map fail
Return -EINVAL on mapping failures, instead of -1, which triggers a
checkpatch error.

Signed-off-by: Todd Poynor <toddpoynor@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-10-15 16:30:37 +02:00
Nick Ewalt 08b6b28801 staging: gasket: page_table: handle failed dma_map_page
Handle dma_map_page failing in gasket_alloc_extended_subtable: free
memory, don't add invalid page table entry.

Signed-off-by: Nick Ewalt <nicholasewalt@google.com>
Signed-off-by: Todd Poynor <toddpoynor@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-09-18 13:22:01 +02:00
Nick Ewalt 0eaf57fb61 staging: gasket: page_table: use total_entries for max ext lvl0 page idx
The maximum number of entries in the page table is configurable at
initialization time and should be used in gasket_extended_lvl0_page_idx.

Signed-off-by: Nick Ewalt <nicholasewalt@google.com>
Signed-off-by: Todd Poynor <toddpoynor@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-09-18 13:22:01 +02:00
Nick Ewalt 863739bda2 staging: gasket: cleanup if dma_map_page fails in gasket_perform_mapping
Previously pages would have never been unmapped in this case.

Signed-off-by: Nick Ewalt <nicholasewalt@google.com>
Signed-off-by: Todd Poynor <toddpoynor@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-09-18 13:22:01 +02:00
Nick Ewalt c3873a5c74 staging: gasket: fix gasket_free_coherent_memory metadata frees
Free gasket_coherent_page_entries metadata memory, update data
structures accordingly.

Signed-off-by: Nick Ewalt <nicholasewalt@google.com>
Signed-off-by: Todd Poynor <toddpoynor@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-09-18 13:22:01 +02:00
Nick Ewalt f8b6a07661 staging: gasket: page_table: don't unmap coherent pages
Only call dma_unmap_page if there was an associated dma_map_page call.

Signed-off-by: Nick Ewalt <nicholasewalt@google.com>
Signed-off-by: Todd Poynor <toddpoynor@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-09-18 13:22:01 +02:00
Nick Ewalt d2118f8e93 staging: gasket: fix data page unmap DMA direction
The DMA direction supplied to dma_unmap_page should match the
corresponding dma_map_page call, which is mapped bi-directional.

Signed-off-by: Nick Ewalt <nicholasewalt@google.com>
Signed-off-by: Todd Poynor <toddpoynor@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-09-18 13:22:01 +02:00
Nick Ewalt 912b8a811c staging: gasket: fix DMA direction for extended page tables
Extended page tables should be mapped as DMA_TO_DEVICE, not
bi-directional.

Signed-off-by: Nick Ewalt <nicholasewalt@google.com>
Signed-off-by: Todd Poynor <toddpoynor@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-09-18 13:22:01 +02:00
Todd Poynor 45dd9954d9 staging: gasket: page table: use GFP_KERNEL for dma_alloc_coherent
Flags should be specified for dma_alloc_coherent() call.  Use
GFP_KERNEL, it's fine to sleep here.

Signed-off-by: Todd Poynor <toddpoynor@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-09-18 13:22:01 +02:00
Todd Poynor 467976ff6e staging: gasket: interrupt: remove PCI-MSIX-specific status check
Devices not using MSIX don't use the msix_initialized field, so don't
require it to be set in the interrupt system status check. The general
check for interrupts configured that follows can cover both MSIX and
device-managed interrupts.

Signed-off-by: Todd Poynor <toddpoynor@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-09-18 13:22:01 +02:00
Todd Poynor a15087ec16 staging: gasket: Kconfig: describe Apex as an Edge TPU device
Add a brief description and URL for more information on the Apex device,
an Edge TPU (Tensorflow Processing Unit) machine learning accelerator.

Signed-off-by: Todd Poynor <toddpoynor@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-09-18 13:22:01 +02:00
Greg Kroah-Hartman 7dc074348e Merge 4.19-rc4 into staging-next
Handle the merge issues and take the iio and staging driver fixes.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-09-16 22:04:13 +02:00
Ahmed S. Darwish 3835841577 staging: gasket: TODO: re-implement using UIO
The gasket in-kernel framework, recently introduced under staging,
re-implements what is already long-time provided by the UIO
subsystem, with extra PCI BAR remapping and MSI conveniences.

Before moving it out of staging, make sure we add the new bits to
the UIO framework instead, then transform its signle client, the
Apex driver, to a proper UIO driver (uio_driver.h).

Link: https://lkml.kernel.org/r/20180828103817.GB1397@do-kernel

Signed-off-by: Ahmed S. Darwish <darwish.07@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-09-10 18:08:06 +02:00
Todd Poynor cca5dd8790 staging: gasket: interrupt: remove unimplemented interrupt types
Interrupt types PCI_MSI and PLATFORM_WIRE are unused and unimplemented.
Remove these.

Signed-off-by: Todd Poynor <toddpoynor@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-08-27 19:43:44 +02:00
Todd Poynor 8b872d6f06 staging: gasket: interrupt: simplify interrupt init parameters
Pass the gasket driver descriptor to the interrupt init function, rather
than exploding out separate parameters from various fields of that
structure.  This allows us to make more localized changes to the types
of interrupts supported (MSIX vs. wire, etc.) without affecting the
calling sequence, and seems nicer for simplification purposes.

Signed-off-by: Todd Poynor <toddpoynor@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-08-27 19:43:44 +02:00
Todd Poynor 62af16524c staging: gasket: interrupt: refactor PCI MSIX-specific handler code
Split interrupt handler into PCI MSIX-specific and generic functions,
for adding non-MSIX handlers in the future.  Move MSIX init code
together,, out of generic init path.

Signed-off-by: Todd Poynor <toddpoynor@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-08-27 19:43:44 +02:00
Todd Poynor 97fead8c90 staging: gasket: core: rename lookup_internal_desc to be PCI-specific
Rename lookup_internal_desc() to lookup_pci_internal_desc() to reflect
use for PCI devices only, in prep for non-PCI devices in the future.

Signed-off-by: Todd Poynor <toddpoynor@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-08-27 19:43:44 +02:00
Todd Poynor 1fb5e1c92e staging: gasket: core: factor out generic device remove code from PCI
Separate code for generic parts of gasket device removal sequence from
the PCI device removal code, in prep for non-PCI devices later.

Signed-off-by: Todd Poynor <toddpoynor@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-08-27 19:43:44 +02:00
Todd Poynor 9c34e95c6f staging: gasket: core: factor out generic device add code from PCI code
Split out generic gasket device add code from the code for adding a PCI
gasket device, in prep for other gasket device types in the future.

Signed-off-by: Todd Poynor <toddpoynor@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-08-27 19:43:44 +02:00
Todd Poynor 7b49682bdc staging: gasket: page table: remove extraneous memory barriers
Some explicit memory barriers in the page table code are not necessary,
either because:

(a) The barrier follows a non-relaxed MMIO access that already performs
a read or write memory barrier.

(b) The barrier follows DMA API calls for which the device-visible
effects of IOMMU programming are guaranteed to be flushed to the IOMMU
prior to the call returning, and doesn't need to sync with normal memory
access.

Signed-off-by: Todd Poynor <toddpoynor@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-08-27 19:43:44 +02:00
Todd Poynor 717264bab4 staging: gasket: core: switch to relaxed memory-mapped I/O
Use of readl() is deprecated; readl_relaxed() with appropriate memory
barriers is preferred.  Switch to relaxed reads and writes for better
performance as well.  Memory barriers required for I/O vs. normal
memory access on Apex devices have already been explicitly coded in the
page table routines.

Signed-off-by: Todd Poynor <toddpoynor@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-08-27 19:43:44 +02:00
Todd Poynor 6c258edc64 staging: gasket: page table: use dma_mapping_error for error detection
gasket_perform_mapping() call dma_mapping_error() to determine if
mapping failed.

Signed-off-by: Todd Poynor <toddpoynor@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-08-27 19:43:43 +02:00
Todd Poynor 1fdd6d720c staging: gasket: remove gasket_exit()
Remove now-empty gasket_exit() function.

Signed-off-by: Todd Poynor <toddpoynor@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-08-27 19:43:42 +02:00
Todd Poynor 1fb227bf2e staging: gasket: core: remove ftrace-style debug logs
Remove debug logs that only indicate the name of the entered function,
in favor of using ftrace for function tracing style logs.

Signed-off-by: Todd Poynor <toddpoynor@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-08-27 19:43:42 +02:00
Todd Poynor 57db4be3bb staging: gasket: core: remove kobj_name param from gasket_alloc_dev
gasket_alloc_dev can retrieve the device name from the parent parameter,
a separate parameter isn't needed for this.  Rename the variable to
better reflect its meaning, as the name of the parent device for which a
gasket device is being allocated.

Signed-off-by: Todd Poynor <toddpoynor@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-08-27 19:43:42 +02:00
Todd Poynor c5e0a62ad8 staging: gasket: core: fix line continuation indent in gasket_alloc_dev
Previous cleanups missed a case of multi-line function call with line
continuation parameters not aligned per kernel style.

Signed-off-by: Todd Poynor <toddpoynor@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-08-27 19:43:42 +02:00
Todd Poynor 4cfc2bff29 staging: gasket: core: remove debug log that could crash
A debug log in gasket_alloc_dev() is issued regardless of whether the
device pointer used returned success or error.  The log isn't that
useful anyway, remove it.

Signed-off-by: Todd Poynor <toddpoynor@google.com>
Reviewed-by: Rob Springer <rspringer@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-08-27 19:43:42 +02:00
Colin Ian King 9323bbfa14 staging: gasket: apex: remove unused array cm_mappable_regions
Array cm_mappable_regions is defined but is never used hence it is
redundant and can be removed.

Cleans up clang warning:
warning: 'cm_mappable_regions' defined but not used [-Wunused-const-variable=]

Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-08-27 19:42:43 +02:00
Sumit Kumar 3c0971939e staging: gasket: remove null ptr check before kfree
Remove null ptr check before kfree because kfree is null ptr safe.
Issue found by checkpatch.

Signed-off-by: Sumit Kumar <sumit686215@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-08-27 19:42:32 +02:00
zhong jiang ec6e6925fc staging: gasket: remove some extra semicolon
That semicolons are unneeded, Just remove them.

Signed-off-by: zhong jiang <zhongjiang@huawei.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-08-08 11:20:45 +02:00
Sumit Pundir 8d84a9c1d2 staging: gasket: fix code indent for conditional statement
Fixed a coding style issue related to indentation. Reported by
checkpatch.pl

Signed-off-by: Sumit Pundir <pundirsumit11@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-08-08 11:20:45 +02:00
Todd Poynor d37d2dd41f staging: gasket: core: remove incorrect extraneous comment
A copy-and-pasted comment from another code sequence is removed from
gasket core init sequence.

Signed-off-by: Todd Poynor <toddpoynor@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-08-08 11:20:08 +02:00
Todd Poynor 4801fc6f7f staging: gasket: apex: place in low power reset until opened
The apex device is left out of reset mode at the end of device
probe/initialize processing.  Add a call to enter reset at the end of
the sequence, triggering power gating and other low power features.

Signed-off-by: Todd Poynor <toddpoynor@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-08-08 11:20:08 +02:00
Todd Poynor 95a2c279b2 staging: gasket: core: protect against races during unregister
Keep mutex held across the unregistration operation, until the
driver_desc field of the global table is removed, to prevent a
concurrent accessor from looking up the driver_desc while
gasket_unregister_device() is in the processing of removing it.

Reported-by: Guenter Roeck <groeck@chromium.org>
Signed-off-by: Todd Poynor <toddpoynor@google.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-08-08 11:20:07 +02:00