Commit Graph

27 Commits

Author SHA1 Message Date
Kristof Provost
5cf32a6e95 vchiq: Use mallocarray() to provide kcalloc()
This means we now also provide integer overflow protection, like the
Linux kcalloc().
2018-01-07 13:41:06 +00:00
Alan Cox
01c0757bae Modernize the use of vm_page_unwire(). Since r288122, vm_page_unwire()
has returned TRUE when the wire count transitions to zero, eliminating
the need for callers to inspect the page's wire count.

MFC after:	1 week
2017-09-24 22:29:11 +00:00
Gleb Smirnoff
6286dc78d4 Remove unneeded include of vm_phys.h. 2017-04-17 16:51:04 +00:00
Ian Lepore
9fc7a59f2a Stop including sys/types.h from arm's machine/atomic.h, fix the places
where atomic.h was being included without ensuring that types.h (via
param.h) was included first, as required by atomic(9).
2017-02-11 01:07:46 +00:00
Oleksandr Tymoshenko
d6699bdec3 [vchi] replace non-reproducible __DATE__/__TIME__ with hardcoded string
Although vchiq_build_date and vchiq_build_time are not used in current
vchi driver at the moment, make sure these value will not leak into
build later on if at some point they will be refered in some new
imported code

PR:		215494
Reported by:	emaste
MFC after:	1 week
2016-12-26 02:51:03 +00:00
Luiz Otavio O Souza
7e9a160642 Reduce dmesg verbosity. 2016-11-15 00:58:31 +00:00
Bryan Drewery
28323add09 Fix improper use of "its".
Sponsored by:	Dell EMC Isilon
2016-11-08 23:59:41 +00:00
Oleksandr Tymoshenko
79f6c27f4c Make VCHI driver compatible with upstream DT
- Add compatibility string
- Compensate difference in base address between our custom DTB and upstream one
2016-10-12 03:08:58 +00:00
Oleksandr Tymoshenko
591ef90abd Update VCHIQ driver to upstream version 4eda74f2
PR:		211525
Submitted by:	Sylvain Garrigues <sylvain@sylvaingarrigues.com>
2016-08-31 01:04:57 +00:00
Michal Meloun
a89156f53f ARM: Use new ARMv6 naming conventions for cache and TLB functions
in all but ARMv4 specific files.
Expand ARMv6 compatibility stubs in cpu-v4.h. Use physical address
in L2 cache functions if ARM_L2_PIPT is defined.
2016-02-05 14:57:41 +00:00
Oleksandr Tymoshenko
ee8ce60b6b Fix order of last two arguments of mtx_init
Spotted by: jmcneill@NetBSD.org
2016-01-14 20:25:22 +00:00
Svatopluk Kraus
477f6d2e17 Fix inconsistent use of malloc type for cdev private data.
Remove M_VCHIQ malloc type, now not used anywhere.

Reviewed by:	gonzo
Approved by:	kib (mentor)
2015-11-23 13:23:53 +00:00
Svatopluk Kraus
780fefef0b Fix slots DMA memory handling. It's similar to r290553.
Discussed with:	gonzo
Approved by:	kib (mentor)
2015-11-10 10:56:52 +00:00
Svatopluk Kraus
72683266d0 Fix pagelist bus_dmamap_t map handling. Memory for pagelist is allocated
by bus_dmamem_alloc() which creates associated bus_dmamap_t map for us.
When this memory is freed by bus_dmamem_free(), the map is freed as well.

Thus there is no need to free it explicitly by bus_dmamap_destroy(),
which leads to double freeing.

Discussed with:	gonzo
Approved by:	kib (mentor)
2015-11-08 18:48:35 +00:00
Oleksandr Tymoshenko
038cbcf51c vchiq interrupt is MP safe, add respective flag to bus_setup_intr 2015-11-08 03:54:15 +00:00
Oleksandr Tymoshenko
e88b3f2e48 Fix locking for VCHI driver by matching sleepable/non-sleepable APIs:
- Emulate Linux mutex API using sx(9) locks with only exclusive operations
    instead of mutex(9), in Linux mutexes are sleepable.
- Emulate Linux rwlock_t using rwlock(9) instead of sx(9). rwlock_t
    in Linux are spin locks
2015-11-08 03:53:31 +00:00
Oleksandr Tymoshenko
ff4cdb1595 Fix cache issues with bulk transfers
- Use pmap_quick_enter_page/pmap_quick_remove_page to bounce non-cacheline
    aligned head and tail fragments
- Switch from static fragment size to configurable one, newer firmware
    passes cache line size as cache_line_size DTB parameter.

With these changes both RPi and RPi2 pass functinal part of vchiq_test
2015-11-03 05:25:06 +00:00
Oleksandr Tymoshenko
a0b8746173 Synchronize with latest upstream VCHI code:
- Add LIB_VERSION ioctl
- Add CLOSE_DELIVERED ioctl
- Bump code version

Upstream version: 3782f2ad42c08f4d32f64138f8be7341afc380f5
2015-11-01 22:17:39 +00:00
Oleksandr Tymoshenko
c26ee519d1 Fix BULK read transfer if destination buffer is not cache line-aligned.
We can't use copyout because destination memory is userland address
in another process but we have reference to respective page so map
the page into kernel address space and copy fragments there
2015-10-30 01:19:04 +00:00
Jung-uk Kim
fd90e2ed54 CALLOUT_MPSAFE has lost its meaning since r141428, i.e., for more than ten
years for head.  However, it is continuously misused as the mpsafe argument
for callout_init(9).  Deprecate the flag and clean up callout_init() calls
to make them more consistent.

Differential Revision:	https://reviews.freebsd.org/D2613
Reviewed by:	jhb
MFC after:	2 weeks
2015-05-22 17:05:21 +00:00
Andrew Turner
2fb34dae14 Use the dsb macro to use the correct instruction when building for ARMv7. 2015-03-19 11:34:51 +00:00
Oleksandr Tymoshenko
e6c4672e82 Fix build without INVARIANTS/INVARIANT_SUPPORT:
- Replace "emulation" of return in lmutex_lock_interruptible macros by
    proper static/inline function.

Submitted by:	Guy Yur
2015-02-13 02:10:09 +00:00
Oleksandr Tymoshenko
b5d689899d - Perform bus_dmamap_sync on pagelist structure
- Wire pages of bulk transfer buffer when preparing pagelist
2015-02-12 04:31:17 +00:00
Oleksandr Tymoshenko
10e99e6057 Do not mark shared structures as __packed, it leads to race condition
If structure packed as __packed clang (and probably gcc) generates
code that loads word fields (e.g. tx_pos)  byte-by-byte and if it's
modified by VideoCore in the same time as ARM loads the value result
is going to be mixed combination of bytes from previous value and
new one.
2015-02-09 02:31:27 +00:00
Oleksandr Tymoshenko
e6bf0bdb36 Remove unused variables 2015-02-09 02:27:33 +00:00
Oleksandr Tymoshenko
4676e354fd Act as a bus in attach method: probe and attach devices 2015-02-08 01:12:23 +00:00
Oleksandr Tymoshenko
262f27b29e Import VCHI driver for Broadcom's VideoCore IV GPU
Differential Revision:	D1753
2015-02-05 19:54:03 +00:00