This patch fixes the function signatures for gasket_read_page_table_size,
gasket_read_simple_page_table_size, gasket_partition_page_table,
gasket_config_coherent_allocator to avoid the checkpatch.pl warning:
CHECK: Lines should not end with a '('
Signed-off-by: Sumera Priyadarsini <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Static structure apex_desc, of type gasket_driver_desc, is used only as
an argument to the functions gasket_register_device() and
gasket_unregister_device(). In the definitions of both these functions,
their parameter is declared as const. Hence make apex_desc itself
constant to protect it from modification.
Issue found with Coccinelle.
Signed-off-by: Nishka Dasgupta <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Use DIV_ROUND_UP in-kernel function to make code simple and more
understandable.
Issue found using Coccinelle.
Signed-off-by: Madhumitha Prabakaran <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
There are a few remaining drivers/staging/*/Makefile files that do not
have SPDX identifiers in them. Add the correct GPL-2.0 identifier to
them to make scanning tools happy.
Reviewed-by: Mukesh Ojha <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
There are a few remaining drivers/staging/*/Kconfig files that do not
have SPDX identifiers in them. Add the correct GPL-2.0 identifier to
them to make scanning tools happy.
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Concatenate a multi-line string constant into a single
line.Issue found by checkpatch.pl.
WARNING:quoted string split across line.
Signed-off-by: Sanjana Sanikommu <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Remove string " across the line.
Issue found by checkpatch.pl semantic patch results for rtw_ap.c
Signed-off-by: Sanjana Sanikommu <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Replace macro __ATTR with __ATTR_NULL since the former one is
unnecessary for gasket_sysfs_attr array terminator. Also silence the
checkpatch.pl warning:
WARNING:Symbolic permissions 'S_IRUGO' are not preferred. Consider using
octal
permissions '0444'.
Signed-off-by: Wentao Cai <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Remove including <linux/version.h> that don't need it.
Signed-off-by: Yue Haibing <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Reformat arguments in a few functions in gasket_page_table.c to better
follow linux kernel formatting standards.
Signed-off-by: Robert Deal <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
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 <[email protected]>
Acked-by: Todd Poynor <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
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 <[email protected]>
Signed-off-by: Todd Poynor <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
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 <[email protected]>
Signed-off-by: Todd Poynor <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
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 <[email protected]>
Signed-off-by: Todd Poynor <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Comments in components_to_dev_address() describing examples are
inconsistent, fix these to be accurate.
Signed-off-by: Nick Ewalt <[email protected]>
Signed-off-by: Todd Poynor <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
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 <[email protected]>
Signed-off-by: Todd Poynor <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Remove unnecessary ptes[i].status update in gasket_perform_unmapping.
The vaaue will be cleared in the following memset.
Signed-off-by: Nick Ewalt <[email protected]>
Signed-off-by: Todd Poynor <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
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 <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
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 <[email protected]>
Signed-off-by: Todd Poynor <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Previously pages would have never been unmapped in this case.
Signed-off-by: Nick Ewalt <[email protected]>
Signed-off-by: Todd Poynor <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Only call dma_unmap_page if there was an associated dma_map_page call.
Signed-off-by: Nick Ewalt <[email protected]>
Signed-off-by: Todd Poynor <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
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 <[email protected]>
Signed-off-by: Todd Poynor <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Extended page tables should be mapped as DMA_TO_DEVICE, not
bi-directional.
Signed-off-by: Nick Ewalt <[email protected]>
Signed-off-by: Todd Poynor <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Flags should be specified for dma_alloc_coherent() call. Use
GFP_KERNEL, it's fine to sleep here.
Signed-off-by: Todd Poynor <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
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 <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
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 <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
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 <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
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 <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
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 <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
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 <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
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 <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
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 <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>