Clients consuming the 8-byte QoS header expect the flowID
in a different position in the header thus causing random address
dereference and a potential crash. Update the 8-byte QoS header
format structure as specified in the mandated QOS specification
CRs-Fixed: 625709
Change-Id: I58c662ff2f3adfe9584d19891339ea31ce0c8bd3
Signed-off-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
Adding initial support for ftrace events in order to help with
profiling and debugging. This initial set of events covers the
ingress and egress handlers.
Change-Id: I296d6fb9d009d8fdc2061e17d25e1275ee0a8a12
Signed-off-by: Harout Hedeshian <harouth@codeaurora.org>
This patch modifies the rmnet ioctls RMNET_IOCTL_GET_LLP,
RMNET_IOCTL_GET_QOS, RMNET_IOCTL_GET_OPMODE, RMNET_IOCTL_FLOW_ENABLE
and RMNET_IOCTL_FLOW_DISABLE to avoid putting integral data in pointers
and avoid casting between 32 and 64 bits types.
CRs-Fixed: 601207
Change-Id: I66edb785f6204f38b6f0ecccb2ceab36d5e38188
Acked-by: Sivan Reinstein <sivanr@qti.qualcomm.com>
Signed-off-by: Harout Hedeshian <harouth@codeaurora.org>
[subashab@codeaurora.org: remove driver specific changes]
Signed-off-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
The default value of tx_queue_len was 0 which was causing packet
drops because of queueing in tc.
This patch sets a fixed value for the tx_queue_len
CRs-Fixed: 609873
Change-Id: I51739e63223b563f7cf8838d88908db7dcc9bf3e
Signed-off-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
The lack of newline characters causes messy printouts over serial.
This patch corrects the problem for easier readability.
Change-Id: I38df34eb4a705d8c0fcd3243b7e756967bc7d5a9
Signed-off-by: Harout Hedeshian <harouth@codeaurora.org>
Added performance counters to various key places in RmNet Data
data path.
CRs-Fixed: 600629
Change-Id: Iba50c86665e181e09525e9538a540e09e526e16f
Signed-off-by: Harout Hedeshian <harouth@codeaurora.org>
Logging macros now enforce that function names are printed, and
newlines are inserted at the end. The start of log messages are
now standardize.
CRs-Fixed: 600629
Change-Id: I91dae00c331af80954b93eba1f7be2889c569276
Signed-off-by: Harout Hedeshian <harouth@codeaurora.org>
Added new parameter tail_spacing to
RMNET_NETLINK_SET_LINK_INGRESS_DATA_FORMAT in order to support
an additional fixed padding on packets. Required to support RNDIS
tethering.
CRs-Fixed: 579184
Change-Id: I58bbbfbaa68a28b25a96f52b04165285de9c24ef
Signed-off-by: Harout Hedeshian <harouth@codeaurora.org>
This patch modified the main ingress handler to not drop MAP packets
when in bridge mode. This is required to support bridging of MAP
packets between two endpoints.
CRs-Fixed: 590888
Change-Id: If0b6f6434ec95c36e0f46bbe70ea65fa50b03b15
Acked-by: David Arinzon <darinzon@qti.qualcomm.com>
Signed-off-by: Harout Hadeshian <harouth@codeaurora.org>
Gracefully handle device unregister notifications. Cleans
up any logical endpoints configured on a physical devices
and then unassociates it. Required to prevent crash if
references are held too long.
CRs-Fixed: 596227
Change-Id: I02d08e07e74510b7a8dffbefa99e651e0100db23
Signed-off-by: Harout Hedeshian <harouth@codeaurora.org>
Cleaned up refcount on get_dev_by_name.
Added new APIs to support cleanup of configuration and virtual devices.
Added explicit reference managment in association/un-association
and when setting/unsetting logical EP.
CRs-Fixed: 596227
Change-Id: Ic67bb649b0f0420d9a1e4bf5664ed63c0ff7d8bf
Signed-off-by: Harout Hadeshian <harouth@codeaurora.org>
Implement 8-byte QoS header support in order to fix alignment
issues on HSIC transport and increase throughput
CRs-Fixed: 579132
Change-Id: I3e53571d36bd71705abcb1473290929f8227e6f3
Signed-off-by: Harout Hedeshian <harouth@codeaurora.org>
Fix IOCTLs with invalid numbers. Addresses limitation in network
IOCTL code which prevents more than 16 user defined IOCTLs. All new
IOCTLs have been multiplexed into a single user defined ioctl. Required
to support RmNet Data features.
CRs-Fixed: 554883
Change-Id: Ic33bdf068f7e4014272d3b47ed7b07f5d4a6be2c
Signed-off-by: Harout Hedeshian <harouth@codeaurora.org>
Implement MAP based in-band flow control. Added 2 new configuration
messages to allow adding and deleting flow handles. Added handlers
in VND for flow control events. Added flow control command handler
in rmnet_map_commands.
CRs-fixed: 568534
Change-Id: Ica52e4ad89430c9fa5e2b38e389ee6bc91de2e9b
Signed-off-by: Harout Hedeshian <harouth@codeaurora.org>
Set the skb->protocol field to ETH_P_MAP for egress packets which
have MAP enabled. Required for lower level drivers to ensure that
only MAP packets are being transmitted.
CRs-Fixed: 554883
Change-Id: I6fa852344ef36e079cc610cbed152555aae9d6f2
Signed-off-by: Harout Hedeshian <harouth@codeaurora.org>
Run-time user space components can now specify virtual network device
name prefix at device creation. This will be used to support legacy
data services.
CRs-Fixed: 555507
Change-Id: Id34c2761f2060e66b05c521304d5151620ba5665
Signed-off-by: Harout Hedeshian <harouth@codeaurora.org>
Removed incorrect compiler macro comments in MAP header file.
Comments are now up fixed up to standards.
CRs-Fixed: 553399
Change-Id: I6373753e644f3801b7a25184e4cff5772f365a02
Signed-off-by: Harout Hedeshian <harouth@codeaurora.org>
RmNet Data driver provides a transport agnostic MAP (multiplexing and
aggregation protocol) support in embedded and bridge modes. Module
provides virtual network devices which can be attached to any IP-mode
physical device. This will be used to provide all MAP functionality
on future hardware in a single consistent location.
CRs-Fixed: 525675
Change-Id: I739947c9c3de008974dd485a74e9953ba2cbb75e
Signed-off-by: Harout Hedeshian <harouth@codeaurora.org>
[subashab@codeaurora.org: resolve trivial merge conflicts]
Signed-off-by: Subash Abhinov Kasiviswanathan <subashab@codeaurora.org>
Ion headers need to go to userspace. Export them via the staging tree
Change-Id: I9b622efaae3d0ed764ce064da228112c363c066d
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
There are several uapi headers required for android that are
in drivers/staging/android/uapi. Create symlinks for these files
in include/uapi/linux so that we can export them without messing
up Kbuild.
Signed-off-by: Jeremy Gebben <jgebben@codeaurora.org>
For sharing the memory between hlos and modem,
a new secure vmid is needed to be used in the
assign api. Define that.
Change-Id: Ibcddbafeb1fc430aae3fcda7c609bca4d81e57a9
Signed-off-by: Neeti Desai <neetid@codeaurora.org>
Buffers shared with hypervisor might undergo some cache maintenance on
the hypervisor side. Currently, we're passing a buffer that might not
be cache-aligned (source_vm_list), so when the hypervisor does some
cache maintenance on it they might be corrupting data. Fix this by
ensuring that all buffers being shared with the hypervisor are
cache-aligned by kmalloc'ing and memcpy'ing the source_vm_list before
sending it across.
Change-Id: I661f8ca852ade159e3432904086b060be8bfb806
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
It can be useful to convert secure VMID values into strings. Provide a
helper function to do so.
Change-Id: If907a0bac92c5d164154c0e5dfe67933115163c8
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
The hyp_assign_phys() api can be called by different
usecases where it is not guaranteed that the source vm is
always VMID_HLOS.
Pass the responsibility of setting the source_vm to
caller of the function.
Change-Id: I3851a6681f49d4bb6fa5b7a889a16a158497e9e6
Signed-off-by: Neeti Desai <neetid@codeaurora.org>
kmap_flush_unused does not flush kmap_atomic mappings which
are handled separately. Architectures may have use cases to require
these to be flushed. Add an option to let architectures define
kmap_atomic flushing to get rid of extra mappings.
Change-Id: I5a338ed9e215f0f0ad3ab58a3066d2f4c8ce3ba7
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>
When calling hyp_assign to free a secure buffer we need to pass
in RWX permissions so that when the Hypervisor unmaps the buffer
and maps it back to HLOS, the HLOS is able to use the same
memory for data and instructions.
Change-Id: I71e06a81df85891fecb11c5f197acd54979d2887
Signed-off-by: Shrenuj Bansal <shrenujb@codeaurora.org>
Buffers must be unmapped first and then freed. Without
this sequence, specifically for secure buffers, TZ throws
error on free if it finds persisting mapping. Fix this.
Change-Id: Iba09cb998b4f87da3e9eb1c2bc186453be02a278
Signed-off-by: Shiraz Hashim <shashim@codeaurora.org>
ion cache maintenance code while doing cache maintenance
on each sg is only considering page length which may not
always be correct. An sg node can have more than page
length contiguous pages.
Update the code to properly take care of any length sg.
Change-Id: Ifdf8a8fa26abfa5bd47185a1039880306246d587
Signed-off-by: Shiraz Hashim <shashim@codeaurora.org>
Let ION compile when CONFIG_CMA is not defined.
Change-Id: I6f3cf19a94e3f966c0973c9f8d765ecb752b7a48
Signed-off-by: Vinayak Menon <vinmenon@codeaurora.org>
If the hypervisor fails to assign the correct vmids to the
memory allocated, we should free the allocated memory. However
the free path depends on certain parameters of the ion_buffer
structure which have not yet been populated.
Update the function definition to accept the scatter gather list
instead of the ion buffer, since we are zero'ing the list
and not the buffer.
Change-Id: I68bef3af6c1b7e8092fbc0e878d3c825580f438e
Signed-off-by: Neeti Desai <neetid@codeaurora.org>
Currently it is difficult to test the real performance of
allocating from the ion system heap since the heap uses
a page pool. Customers regularly encounter
scenarios where the pool is empty and memory has to
be allocated from the system.
Add support for the ION_FLAG_POOL_FORCE_ALLOC flag so that
the pool can be bypassed in order to measure the performance
of non-pool system heap allocations.
Change-Id: Ia89910abf52282a9696bd5abb9270930078c66a3
Signed-off-by: Liam Mark <lmark@codeaurora.org>
This reverts commit afedf4f2f4c57d2("msm: ion: fix ion cache
maintenance issue") was causing device crash just after
launching camera or adrenotest app. revert the change
till original issue get fixed.
Change-Id: I32e9ff9610de7de8f24fae36ed14ff35a9806f0c
Signed-off-by: Fnu Yagyasen <yagya@codeaurora.org>
ion cache maintenance code while doing cache maintenance
on each sg is only considering page length which may not
always be correct. An sg node can have more than page
length contiguous pages.
Update the code to properly take care of any length sg.
Change-Id: Ied380fa32cbda5384bab8ec2625ceaf1010fd314
Signed-off-by: Shiraz Hashim <shashim@codeaurora.org>
During buffer allocation if the assign call fails, we call
ion_system_secure_heap_free, which in turn does an unassign
operation before freeing the buffer. We don't want to call
unassign if the assign failed.
Fix this by calling the underlying free function directly
during error handling.
Change-Id: I2deec6fd147c4200e16f3779e37330dca1d7d173
Signed-off-by: Neeti Desai <neetid@codeaurora.org>
Add the infrastructure to support a secure cma heap
needed for secure usecases. The new heap uses
the existing cma heap infrastructure, along with adding
the assign call to assign the correct VM to the buffers
during allocation and free.
Change-Id: I0c959f46ffa6eb67128b6794e9e60c470a3d292e
Signed-off-by: Neeti Desai <neetid@codeaurora.org>
When freeing a secure buffer, the RWX permissions need to be
passed as a parameter to the hyp_assign call. This will ensure
that when the hypervisor unmaps the buffer, HLOS can use it
for data as well as instructions.
Change-Id: I2f1e67dda8f3ebedee552a2908b7f57c18754d42
Signed-off-by: Neeti Desai <neetid@codeaurora.org>
Set the private page bit on each sg of secure buffers to inform
other entities, which import these buffers as an fd, that this
memory is secure.
Change-Id: I767c26fa1feca7505bbb3293cfdb4e09520496a6
Signed-off-by: Shrenuj Bansal <shrenujb@codeaurora.org>
Add new APIs to allow clients to map and unmap dma_buffers created by
ION. The call to the unmap API will not actually do the unmapping from the
IOMMU. The unmapping will occur when the ION/dma_buf buffer is actually
freed. This behavior can be disabled with DMA_ATTR_NO_DELAYED_UNMAP
Change-Id: Ic4dbd3b582eb0388020c650cab5fbb1dad67ae81
Signed-off-by: Olav Haugan <ohaugan@codeaurora.org>
Presently ion debug interface provides total memory held
in system heap for cached and uncached pool corresponding
to per page order list. Add additional logs to also print
total cumulative bytes held together in these pools so
that it can be accounted easily.
Change-Id: I07dbc45fa99870904cca9b2067b371f4d7247ec5
Signed-off-by: Shiraz Hashim <shashim@codeaurora.org>
The assign call apis have been updated by TZ to
include more usecases. Update the secure_buffer
api files with the same. The system secure heap
needs to be updated to reflect the change in
the api calls.
Change-Id: Idc784ddac222e6ad9f5defafc422e6e3fb88aa0c
Signed-off-by: Neeti Desai <neetid@codeaurora.org>
Move all function declarations and types to the header
file to make the macros and definitions available even
when the CONFIG_MSM_SECURE_BUFFER is not enabled. Rename
rid of the msm_ion_secure_table and msm_ion_unsecure_table
to something more generic.
Change-Id: Ia5ca0c52f971a67c7936c64b42cd2522aa1773fa
Signed-off-by: Neeti Desai <neetid@codeaurora.org>
The secure_buffer.c files does not have anything specific
to ion. The functions defined here might be needed by other
drivers as well. If the ion driver is disabled that might
not work. So move the file to a new location.
Change-Id: I3498de791c01019b7933feb65d196152887fcf24
Signed-off-by: Neeti Desai <neetid@codeaurora.org>
ion client can get created and destroyed dynamically.
Client data struct may not be in proper state if one core is reading
client information and other core is destroying the same client.
There is no synchronization between ion_debug_client_show() and
ion_client_destroy(), that leaves client data structures in
uncertain state and which may lead to system crash.
So add a check in ion_debug_client_show(), to verify whether the client
is part of ion device rb tree or not before retrieving client data.
CRs-Fixed: 743714
Change-Id: Ic4c2f9dff905d9bb8fbf2e56b7c6396dc01bdf8f
Signed-off-by: Prasad Sodagudi <psodagud@codeaurora.org>
We're currently using %lu and %ld to print some variables of type
dma_addr_t, which results in the following warning when dma_addr_t is
64-bits wide:
drivers/staging/android/ion/ion_chunk_heap.c: In function 'ion_chunk_heap_create':
drivers/staging/android/ion/ion_chunk_heap.c:176:2: warning: format '%lu' expects argument of type 'long unsigned int', but argument 3 has type 'dma_addr_t' [-Wformat=]
pr_info("%s: base %lu size %zu align %ld\n", __func__, chunk_heap->base,
^
drivers/staging/android/ion/ion_chunk_heap.c:176:2: warning: format '%ld' expects argument of type 'long int', but argument 5 has type 'dma_addr_t' [-Wformat=]
Fix this by using %pad as instructed in printk-formats.txt.
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
ION handle buffer size should be of type 'size_t' and not
'unsigned long'. Update the API signature of ion_handle_get_size
which reads and returns the size of the ION buffer.
Change-Id: I43040816724318f5f388f0b542be963d497a754b
Signed-off-by: Banajit Goswami <bgoswami@codeaurora.org>
show_ion_usage protects against modification with a down_read.
Close it by protecting with an up_read not an up_write.
Change-Id: I2acd29188cde13cc11b4f6c8d6e35082ba37c08a
Signed-off-by: Laura Abbott <lauraa@codeaurora.org>