aboutsummaryrefslogtreecommitdiff
path: root/drivers/misc
AgeCommit message (Collapse)AuthorFilesLines
2022-05-22habanalabs: Add separate poll interval value for protocolfarah kassabri3-1/+8
Currently we're using the same poll interval value for both COMMs protocol(for sending a command and waits for an ACK) and the device CPU boot phases status waits. On COMMs protocol this interval should be much lower than the device CPU boot which may take long time to change status. Signed-off-by: farah kassabri <[email protected]> Reviewed-by: Oded Gabbay <[email protected]> Signed-off-by: Oded Gabbay <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2022-05-22habanalabs: use get_task_pid() to take PIDDani Liberman1-1/+1
find_get_pid() isn't good in case the user process was run inside docker. As a result, we didn't had the PID and we couldn't kill the user process in case the device got stuck and we needed to reset the device. Signed-off-by: Dani Liberman <[email protected]> Reviewed-by: Oded Gabbay <[email protected]> Signed-off-by: Oded Gabbay <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2022-05-22habanalabs: add prefetch flag to the MAP operationOhad Sharabi1-5/+6
This patch let the user decide whether the translations done in the page tables will be fetched directly to the STLB right after the map. We want to let the user control whether to perform prefetch upon map operation. To do so a memory flag was added, to be used in the MAP ioctl, called HL_MEM_PREFETCH and if set- the mappings will be fetched directly to the STLB after map operation. Signed-off-by: Ohad Sharabi <[email protected]> Reviewed-by: Oded Gabbay <[email protected]> Signed-off-by: Oded Gabbay <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2022-05-22habanalabs: Stop using iommu_present()Robin Murphy1-1/+1
Even if an IOMMU might be present for some PCI segment in the system, that doesn't necessarily mean it provides translation for the device we care about. Replace iommu_present() with a more appropriate check. Signed-off-by: Robin Murphy <[email protected]> Reviewed-by: Oded Gabbay <[email protected]> Signed-off-by: Oded Gabbay <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2022-05-22habanalabs: support debugfs Byte access to device DRAMMoti Haimovski3-0/+17
The habanalabs HW requires memory resources to be used by its internal hardware structures. These structures are allocated and initialized by the driver. We would like to use the device HBM for that purpose. This memory is io-remapped and accessed using the writel()/writeb()/writew() commands. Since some of the HW structures are one byte in size we need to add support for the writeb() and readb() functions in the driver. Signed-off-by: Moti Haimovski <[email protected]> Reviewed-by: Oded Gabbay <[email protected]> Signed-off-by: Oded Gabbay <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2022-05-22habanalabs: use for_each_sgtable_dma_sg for dma sgtOhad Sharabi6-94/+61
Instead of using for_each_sg when iterating sgt that contains dma entries, use the more proper for_each_sgtable_dma_sg macro. In addition, both Goya and Gaudi have the exact same implementation of the asic function that encapsulate the usage of this macro, so it is better to move that implementation to the common code. Signed-off-by: Ohad Sharabi <[email protected]> Reviewed-by: Oded Gabbay <[email protected]> Signed-off-by: Oded Gabbay <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2022-05-22habanalabs/gaudi: use lower_32_bits() for castingRajaravi Krishna Katta1-1/+1
Use standard kernel macro to take lower 32 bits of 64-bits variable. Signed-off-by: Rajaravi Krishna Katta <[email protected]> Reviewed-by: Oded Gabbay <[email protected]> Signed-off-by: Oded Gabbay <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2022-05-22habanalabs: refactor HOP functions in MMU V1Ohad Sharabi1-209/+88
Take advantage of the HOPs shift/masks now defined as arrays. Signed-off-by: Ohad Sharabi <[email protected]> Reviewed-by: Oded Gabbay <[email protected]> Signed-off-by: Oded Gabbay <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2022-05-22habanalabs: fix comments according to kernel-docRajaravi Krishna Katta3-8/+9
Incorrect/Missing doxygen tag Signed-off-by: Rajaravi Krishna Katta <[email protected]> Reviewed-by: Oded Gabbay <[email protected]> Signed-off-by: Oded Gabbay <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2022-05-22habanalabs: remove user interrupt debug printOded Gabbay1-4/+0
As user interrupts are a common use case, this dump pollutes the dmesg log, hence removing it. Signed-off-by: Oded Gabbay <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2022-05-22habanalabs: don't print normal reset operationsOded Gabbay1-3/+6
Only a hard-reset is an unexpected event which should be notify in the kernel log. Other resets are normal operations and therefore we should not pollute the log with them. Signed-off-by: Oded Gabbay <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2022-05-22habanalabs: change a reset print to debug levelOded Gabbay2-5/+5
Currently we have two reset prints per reset. One is in the common code and one in each asic-specific file. We can change the asic-specific message to be debug only as we can know the type of reset being done according to the print in the common code, which is also easier to maintain. Signed-off-by: Oded Gabbay <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2022-05-22habanalabs: remove redundant info printOded Gabbay2-6/+0
Halting compute engines is a print that doesn't add us any information because it is always done in the reset process and not used elsewhere. Even if it was, we don't use prints to mark functions we passed through. Signed-off-by: Oded Gabbay <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2022-05-22habanalabs: wrong handle removal in memory managerYuri Nudelman1-1/+1
During the unified memory manager release, a wrong id was used to remove an entry from the idr. Signed-off-by: Yuri Nudelman <[email protected]> Reviewed-by: Oded Gabbay <[email protected]> Signed-off-by: Oded Gabbay <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2022-05-22habanalabs: remove debugfs read/write callbacksDafna Hirschfeld3-416/+1
The debugfs memory access now uses the callback 'access_dev_mem' so there is no use of the callbacks 'debugfs_{read32,read64,write32,write6}'. Remove them. Signed-off-by: Dafna Hirschfeld <[email protected]> Reviewed-by: Oded Gabbay <[email protected]> Signed-off-by: Oded Gabbay <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2022-05-22habanalabs: enforce alignment upon registers access through debugfsDafna Hirschfeld1-0/+5
When accessing the configuration registers through debugfs, it is only allowed to access aligned address. Fail if address is not aligned. Signed-off-by: Dafna Hirschfeld <[email protected]> Reviewed-by: Oded Gabbay <[email protected]> Signed-off-by: Oded Gabbay <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2022-05-22habanalabs: unify code for memory access from debugfsDafna Hirschfeld1-52/+104
Currently each asic version implements 4 callbacks: 'debugfs_{read32/write32/read64/write64}' There is a lot of code duplication among the different callbacks of all asic versions. This patch unify the code in order to avoid the code duplication by iterating the pci_mem_region array in hl_device and use its fields instead of macros. Signed-off-by: Dafna Hirschfeld <[email protected]> Reviewed-by: Oded Gabbay <[email protected]> Signed-off-by: Oded Gabbay <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2022-05-22habanalabs: add callback and field to be used for debugfs refactorDafna Hirschfeld4-2/+158
This is a preparation for unifying the code of accessing device memory through debugfs. Add struct fields and callbacks that will later be used in debugfs code and will reduce code duplication among the different read{32,64}/write{32,64} callbacks of every asic. Signed-off-by: Dafna Hirschfeld <[email protected]> Reviewed-by: Oded Gabbay <[email protected]> Signed-off-by: Oded Gabbay <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2022-05-22habanalabs: hl_ts_behavior can be statickernel test robot1-1/+1
drivers/misc/habanalabs/common/memory.c:2137:28: warning: symbol 'hl_ts_behavior' was not declared. Should it be static? Fixes: 4d530e7d121a ("habanalabs: convert ts to use unified memory manager") Reported-by: kernel test robot <[email protected]> Signed-off-by: kernel test robot <[email protected]> Reviewed-by: Oded Gabbay <[email protected]> Signed-off-by: Oded Gabbay <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2022-05-22habanalabs/gaudi: add debugfs to fetch internal sync statusOhad Sharabi6-16/+187
When Gaudi device is secured the monitors data in the configuration space is blocked from PCI access. As we need to enable user to get sync-manager monitors registers when debugging, this patch adds a debugfs that dumps the information to a binary file (blob). When a root user will trigger the dump, the driver will send request to the f/w to fill a data structure containing dump of all monitors registers. Signed-off-by: Ohad Sharabi <[email protected]> Reviewed-by: Oded Gabbay <[email protected]> Signed-off-by: Oded Gabbay <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2022-05-22habanalabs: rephrase device out-of-memory messageOhad Sharabi1-2/+3
The out of memory message is rephrased to more subtle expression as out of memory may be caused by the user in case of, for example, greedy allocation. In addition the user is also being notified by an error code. Signed-off-by: Ohad Sharabi <[email protected]> Reviewed-by: Oded Gabbay <[email protected]> Signed-off-by: Oded Gabbay <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2022-05-22habanalabs/gaudi: Use correct sram size macro for debugfsDafna Hirschfeld1-4/+4
We currently allow accessing the whole SRAM bar size with the macro SRAM_BAR_SIZE, but the actual size of the sram region is the macro SRAM_SIZE which is only a portion of the whole bar size. So when accessing the sram through debugfs, use the macro SRAM_SIZE for the sram size which is the correct macro. Signed-off-by: Dafna Hirschfeld <[email protected]> Reviewed-by: Oded Gabbay <[email protected]> Signed-off-by: Oded Gabbay <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2022-05-22habanalabs: add MMU prefetch to ASIC-specific codeOhad Sharabi5-7/+40
This is necessary pre-requisite for future ASIC support, where MMU TLB prefetch is supported. Signed-off-by: Ohad Sharabi <[email protected]> Reviewed-by: Oded Gabbay <[email protected]> Signed-off-by: Oded Gabbay <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2022-05-22habanalabs: convert ts to use unified memory managerYuri Nudelman6-235/+91
With the introduction of the unified memory manager infrastructure, the timestamp buffers can be converted to use it. Signed-off-by: Yuri Nudelman <[email protected]> Reviewed-by: Oded Gabbay <[email protected]> Signed-off-by: Oded Gabbay <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2022-05-22habanalabs: unified memory manager infrastructureYuri Nudelman3-1/+333
This is a part of overall refactoring attempt to separate nic and the core drivers. Currently, there are 4 different flows, that contain very similar code. These are the ts, nic, hwblocks and cb alloc/map flows. The similar aspect of all these flows is that they all contain a central store, with memory buffers inside, supporting the following set of operations: - Allocate buffer and return handle - Get buffer from the store with handle - Put the buffer (last put releases the buffer) - Map the buffer to the user This patch contains a generic data structure used to implement the above memory buffer store interface. Conversion of the existing code to use the new data structure will follow. Signed-off-by: Yuri Nudelman <[email protected]> Reviewed-by: Oded Gabbay <[email protected]> Signed-off-by: Oded Gabbay <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2022-05-22habanalabs: save f/w preboot major versionOfir Bitton2-10/+22
We need this property for doing backward compatibility hacks against the f/w. Signed-off-by: Ofir Bitton <[email protected]> Reviewed-by: Oded Gabbay <[email protected]> Signed-off-by: Oded Gabbay <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2022-05-22habanalabs: replace usage of found with dedicated list iterator variableJakob Koschel1-6/+5
To move the list iterator variable into the list_for_each_entry_*() macro in the future it should be avoided to use the list iterator variable after the loop body. To *never* use the list iterator variable after the loop it was concluded to use a separate iterator variable instead of a found boolean [1]. This removes the need to use a found variable and simply checking if the variable was set, can determine if the break/goto was hit. Link: https://lore.kernel.org/all/CAHk-=wgRr_D8CB-D9Kg-c=EHreAsk5SqXPwr9Y7k9sA6cWXJ6w@mail.gmail.com/ Signed-off-by: Jakob Koschel <[email protected]> Reviewed-by: Oded Gabbay <[email protected]> Signed-off-by: Oded Gabbay <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2022-05-22habanalabs: modify dma_mask to be ASIC specific propertyTomer Tayar5-30/+10
The required DMA mask is no longer based on input from the F/W, but it is fixed per ASIC according to its address space. As such, the per-ASIC function to get this value can be replaced with a property variable. Signed-off-by: Tomer Tayar <[email protected]> Reviewed-by: Oded Gabbay <[email protected]> Signed-off-by: Oded Gabbay <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2022-05-22habanalabs: parse full firmware versionsOfir Bitton1-2/+4
When parsing firmware versions strings, driver should not assume a specific length and parse up to the maximum supported version length. Signed-off-by: Ofir Bitton <[email protected]> Reviewed-by: Oded Gabbay <[email protected]> Signed-off-by: Oded Gabbay <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2022-05-22habanalabs/gaudi: avoid resetting max power in hard resetTomer Tayar1-2/+0
The default max power is deduced from the card type value in the CPU-CP info. This value is then set in the max power variable of the device structure. Getting the CPU-CP info is done as part of the late init phase which is called also during reset. This means that a max power value which is modified via sysfs will be reset during hard reset back to the default value. As the max power is updated in any case during device init in hl_sysfs_init(), this setting in late init can be removed, and the overriding during reset is thus avoided. Signed-off-by: Tomer Tayar <[email protected]> Reviewed-by: Oded Gabbay <[email protected]> Signed-off-by: Oded Gabbay <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2022-05-22habanalabs/gaudi: increase submission resourcesOfir Bitton1-2/+2
In order to allow user to have larger amount of submissions, we increase the DMA and NIC queue depth to 4K. Signed-off-by: Ofir Bitton <[email protected]> Reviewed-by: Oded Gabbay <[email protected]> Signed-off-by: Oded Gabbay <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2022-05-22habanalabs: expose compute ctx status through info ioctlOfir Bitton1-0/+2
In order for the user to know if he can try and open device, we expose the compute ctx state. The user can now know if the context is used by another process or whether the device is still ongoing through cleanup or reset and will be available soon. Signed-off-by: Ofir Bitton <[email protected]> Reviewed-by: Oded Gabbay <[email protected]> Signed-off-by: Oded Gabbay <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2022-05-22habanalabs: add new return code to device fd openOfir Bitton3-1/+20
In order to be more informative during device open, we are adding a new return code -EAGAIN that indicates device is still going through resource reclaiming and hence it cannot be used yet. Signed-off-by: Ofir Bitton <[email protected]> Reviewed-by: Oded Gabbay <[email protected]> Signed-off-by: Oded Gabbay <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2022-05-22habanalabs: add user API to get valid DRAM page sizesOhad Sharabi4-0/+40
Future devices will support multiple device memory page sizes. In addition, an API for the user was added for it to be able to control the device memory allocation page size. This patch is a complementary patch to inform the user of the available page size supported by the device. Signed-off-by: Ohad Sharabi <[email protected]> Reviewed-by: Oded Gabbay <[email protected]> Signed-off-by: Oded Gabbay <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2022-05-22habanalabs: convert all MMU masks/shifts to arraysOhad Sharabi6-92/+52
There is no need to hold each MMU mask/shift as a denoted structure member (e.g. hop0_mask). Instead converting it to array will result in smaller and more readable code. Signed-off-by: Ohad Sharabi <[email protected]> Reviewed-by: Oded Gabbay <[email protected]> Signed-off-by: Oded Gabbay <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2022-05-22habanalabs: change mmu_get_real_page_size to be ASIC-specificOhad Sharabi4-98/+112
This patch breaks the cumbersome implementation of "get real page size" along with it's multiple inner conditions and implement each case (according to the real complexity) inside an ASIC function. Signed-off-by: Ohad Sharabi <[email protected]> Reviewed-by: Oded Gabbay <[email protected]> Signed-off-by: Oded Gabbay <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2022-05-22habanalabs: add DRAM default page size to HW infoOhad Sharabi1-0/+1
When using the device memory allocation API the user ought to know what is the default allocation page size. Signed-off-by: Ohad Sharabi <[email protected]> Reviewed-by: Oded Gabbay <[email protected]> Signed-off-by: Oded Gabbay <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2022-05-22habanalabs: set non-0 value in dram default page sizeOhad Sharabi4-1/+8
Looking forward we will need to report to the user what is the default page size used. This will be done more conveniently by explicitly updating the property rather than to rely on a "0 meaning default" value. Signed-off-by: Ohad Sharabi <[email protected]> Reviewed-by: Oded Gabbay <[email protected]> Signed-off-by: Oded Gabbay <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
2022-05-19misc: fastrpc: fix list iterator in fastrpc_req_mem_unmap_implSrinivas Kandagatla1-4/+5
This is another instance of incorrect use of list iterator and checking it for NULL. The list iterator value 'map' will *always* be set and non-NULL by list_for_each_entry(), so it is incorrect to assume that the iterator value will be NULL if the list is empty (in this case, the check 'if (!map) {' will always be false and never exit as expected). To fix the bug, use a new variable 'iter' as the list iterator, while use the original variable 'map' as a dedicated pointer to point to the found element. Without this patch, Kernel crashes with below trace: Unable to handle kernel access to user memory outside uaccess routines at virtual address 0000ffff7fb03750 ... Call trace: fastrpc_map_create+0x70/0x290 [fastrpc] fastrpc_req_mem_map+0xf0/0x2dc [fastrpc] fastrpc_device_ioctl+0x138/0xc60 [fastrpc] __arm64_sys_ioctl+0xa8/0xec invoke_syscall+0x48/0x114 el0_svc_common.constprop.0+0xd4/0xfc do_el0_svc+0x28/0x90 el0_svc+0x3c/0x130 el0t_64_sync_handler+0xa4/0x130 el0t_64_sync+0x18c/0x190 Code: 14000016 f94000a5 eb05029f 54000260 (b94018a6) ---[ end trace 0000000000000000 ]--- Fixes: 5c1b97c7d7b7 ("misc: fastrpc: add support for FASTRPC_IOCTL_MEM_MAP/UNMAP") Cc: [email protected] Reported-by: Jan Jablonsky <[email protected]> Signed-off-by: Srinivas Kandagatla <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2022-05-19misc: alcor_pci: set NULL intfdata and clear pci masterShuah Khan1-1/+5
alcor_pci doesn't set driver data to NULL and clear pci master when probe fails. Doesn't clear pci master from remove interface. Clearing pci master is necessary to disable bus mastering and prevent DMAs after driver removal. Fix alcor_pci_probe() to set driver data to NULL and clear pci master from its error path. Fix alcor_pci_remove() to clear pci master. Signed-off-by: Shuah Khan <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2022-05-19Merge tag 'thunderbolt-for-v5.19-rc1' of ↵Greg Kroah-Hartman2-2/+2
git://git.kernel.org/pub/scm/linux/kernel/git/westeri/thunderbolt into usb-next Mika writes: thunderbolt: Changes for v5.19 merge window This includes following Thunderbolt/USB4 changes for the v5.19 merge window: * Improvements for Thunderbolt 1 DisplayPort tunneling * Link USB4 ports to their USB Type-C connectors * Lane bonding support for host-to-host (XDomain) connections * Buffer allocation improvement for devices with no DisplayPort adapters * Few cleanups and minor fixes. All these have been in linux-next with no reported issues except that there is a minor merge conflict with the kunit-next tree because one of the commits touches the driver KUnit tests. * tag 'thunderbolt-for-v5.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/westeri/thunderbolt: thunderbolt: Add KUnit test for devices with no DisplayPort adapters thunderbolt: Fix buffer allocation of devices with no DisplayPort adapters thunderbolt: Add support for XDomain lane bonding thunderbolt: Ignore port locked error in tb_port_wait_for_link_width() thunderbolt: Split setting link width and lane bonding into own functions thunderbolt: Move tb_port_state() prototype to correct place thunderbolt: Add debug logging when lane is enabled/disabled thunderbolt: Link USB4 ports to their USB Type-C connectors misc/mei: Add NULL check to component match callback functions thunderbolt: Use different lane for second DisplayPort tunnel thunderbolt: Dump path config space entries during discovery thunderbolt: Use decimal number with port numbers thunderbolt: Fix typo in comment thunderbolt: Replace usage of found with dedicated list iterator variable
2022-05-19Merge tag 'lkdtm-next' of ↵Greg Kroah-Hartman2-15/+99
https://git.kernel.org/pub/scm/linux/kernel/git/kees/linux into char-misc-next Kees writes: lkdtm updates for -next - Test for new usercopy memory regions - avoid GCC 12 warnings - update expected CONFIGs for selftests * tag 'lkdtm-next' of https://git.kernel.org/pub/scm/linux/kernel/git/kees/linux: lkdtm/heap: Hide allocation size from -Warray-bounds selftests/lkdtm: Add configs for stackleak and "after free" tests lkdtm/usercopy: Check vmalloc and >0-order folios lkdtm/usercopy: Rename "heap" to "slab" lkdtm: cfi: Fix type width for masking PAC bits
2022-05-17lkdtm/heap: Hide allocation size from -Warray-boundsKees Cook1-0/+1
With the kmalloc() size annotations, GCC is smart enough to realize that LKDTM is intentionally writing past the end of the buffer. This is on purpose, of course, so hide the buffer from the optimizer. Silences: ../drivers/misc/lkdtm/heap.c: In function 'lkdtm_SLAB_LINEAR_OVERFLOW': ../drivers/misc/lkdtm/heap.c:59:13: warning: array subscript 256 is outside array bounds of 'void[1020]' [-Warray-bounds] 59 | data[1024 / sizeof(u32)] = 0x12345678; | ~~~~^~~~~~~~~~~~~~~~~~~~ In file included from ../drivers/misc/lkdtm/heap.c:7: In function 'kmalloc', inlined from 'lkdtm_SLAB_LINEAR_OVERFLOW' at ../drivers/misc/lkdtm/heap.c:54:14: ../include/linux/slab.h:581:24: note: at offset 1024 into object of size 1020 allocated by 'kmem_cache_alloc_trace' 581 | return kmem_cache_alloc_trace( | ^~~~~~~~~~~~~~~~~~~~~~~ 582 | kmalloc_caches[kmalloc_type(flags)][index], | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 583 | flags, size); | ~~~~~~~~~~~~ Cc: Greg Kroah-Hartman <[email protected]> Cc: Arnd Bergmann <[email protected]> Signed-off-by: Kees Cook <[email protected]>
2022-05-17lkdtm/usercopy: Check vmalloc and >0-order foliosKees Cook1-0/+83
Add coverage for the recently added usercopy checks for vmalloc and folios, via USERCOPY_VMALLOC and USERCOPY_FOLIO respectively. Cc: Greg Kroah-Hartman <[email protected]> Cc: Matthew Wilcox (Oracle) <[email protected]> Cc: Arnd Bergmann <[email protected]> Signed-off-by: Kees Cook <[email protected]>
2022-05-11lkdtm/usercopy: Rename "heap" to "slab"Kees Cook1-15/+15
To more clearly distinguish between the various heap types, rename the slab tests to "slab". Cc: Arnd Bergmann <[email protected]> Cc: Greg Kroah-Hartman <[email protected]> Cc: Shuah Khan <[email protected]> Cc: [email protected] Signed-off-by: Kees Cook <[email protected]>
2022-05-11cxl/ocxl: Prepare cleanup of powerpc's asm/prom.hChristophe Leroy10-0/+12
powerpc's asm/prom.h brings some headers that it doesn't need itself. In order to clean it up, first add missing headers in users of asm/prom.h Signed-off-by: Christophe Leroy <[email protected]> Acked-by: Frederic Barrat <[email protected]> Acked-by: Andrew Donnellan <[email protected]> Signed-off-by: Michael Ellerman <[email protected]> Link: https://lore.kernel.org/r/a2bae89b280e7a7cb87889635d9911d6a245e780.1648833388.git.christophe.leroy@csgroup.eu
2022-05-09lkdtm: cfi: Fix type width for masking PAC bitsKees Cook1-1/+1
The masking for PAC bits wasn't handling 32-bit architectures correctly. Replace the u64 cast with uintptr_t. Link: https://lore.kernel.org/lkml/CAMuHMdVz-J-1ZQ08u0bsQihDkcRmEPrtX5B_oRJ+Ns5jrasnUw@mail.gmail.com Fixes: 2e53b877dc12 ("lkdtm: Add CFI_BACKWARD to test ROP mitigations") Cc: Greg Kroah-Hartman <[email protected]> Cc: Arnd Bergmann <[email protected]> Reported-by: kernel test robot <[email protected]> Reported-by: Geert Uytterhoeven <[email protected]> Tested-by: Geert Uytterhoeven <[email protected]> Tested-by: Randy Dunlap <[email protected]> Signed-off-by: Kees Cook <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2022-05-09misc: rtsx: set NULL intfdata when probe failsShuah Khan1-0/+1
rtsx_usb_probe() doesn't call usb_set_intfdata() to null out the interface pointer when probe fails. This leaves a stale pointer. Noticed the missing usb_set_intfdata() while debugging an unrelated invalid DMA mapping problem. Fix it with a call to usb_set_intfdata(..., NULL). Signed-off-by: Shuah Khan <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2022-05-09altera-stapl: Use swap() instead of open coding itJiapeng Chong1-40/+16
Clean the following coccicheck warning: ./drivers/misc/altera-stapl/altera.c:955:51-52: WARNING opportunity for swap(). Reported-by: Abaci Robot <[email protected]> Signed-off-by: Jiapeng Chong <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
2022-05-09misc: rtsx: add rts5261 efuse functionRicky WU1-53/+62
move rts5261_fetch_vendor_settings() to rts5261_init_from_hw() make sure it be called from S3 or D3 add more register setting when efuse is set read efuse setting to register on init flow Signed-off-by: Ricky Wu <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>