3 years agoext4 crypto: set up encryption info for new inodes in ext4_inherit_context()
Theodore Ts'o [Fri, 29 May 2015 01:39:32 +0000]
ext4 crypto: set up encryption info for new inodes in ext4_inherit_context()

Set up the encryption information for newly created inodes immediately
after they inherit their encryption context from their parent
directories.

Change-Id: Ie2a48cde918eaf8ad978a8a698de24627b363955
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Theodore Ts'o <tytso@google.com>

3 years agoext4 crypto: fix memory leaks in ext4_encrypted_zeroout
Theodore Ts'o [Fri, 29 May 2015 01:39:32 +0000]
ext4 crypto: fix memory leaks in ext4_encrypted_zeroout

ext4_encrypted_zeroout() could end up leaking a bio and bounce page.
Fortunately it's not used much.  While we're fixing things up,
refactor out common code into the static function alloc_bounce_page().

Change-Id: I44023c01de7ec97ad43bfa85cd7d3b97b22ee0c0
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Theodore Ts'o <tytso@google.com>

3 years agoext4 crypto: use per-inode tfm structure
Theodore Ts'o [Thu, 21 May 2015 15:24:12 +0000]
ext4 crypto: use per-inode tfm structure

As suggested by Herbert Xu, we shouldn't allocate a new tfm each time
we read or write a page.  Instead we can use a single tfm hanging off
the inode's crypt_info structure for all of our encryption needs for
that inode, since the tfm can be used by multiple crypto requests in
parallel.

Also use cmpxchg() to avoid races that could result in crypt_info
structure getting doubly allocated or doubly freed.

Change-Id: I4ae5c07d0e5d99ec1e26eeb49d833c4a284d9a5f
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Theodore Ts'o <tytso@google.com>

3 years agoext4 crypto: require CONFIG_CRYPTO_CTR if ext4 encryption is enabled
Theodore Ts'o [Tue, 12 May 2015 15:22:10 +0000]
ext4 crypto: require CONFIG_CRYPTO_CTR if ext4 encryption is enabled

On arm64 this is apparently needed for CTS mode to function correctly.
Otherwise attempts to use CTS return ENOENT.

Change-Id: I3f597f5f88e806dbeed75a7123c3d6bb7e608350
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: "Theodore Ts'o" <tytso@google.com>

3 years agoext4 crypto: shrink size of the ext4_crypto_ctx structure
Theodore Ts'o [Tue, 12 May 2015 15:22:09 +0000]
ext4 crypto: shrink size of the ext4_crypto_ctx structure

Some fields are only used when the crypto_ctx is being used on the
read path, some are only used on the write path, and some are only
used when the structure is on free list.  Optimize memory use by using
a union.

Change-Id: I66de766a0f1122463edf3280ff0c2923be2472b8
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: "Theodore Ts'o" <tytso@google.com>

3 years agoext4 crypto: get rid of ci_mode from struct ext4_crypt_info
Theodore Ts'o [Tue, 12 May 2015 15:22:08 +0000]
ext4 crypto: get rid of ci_mode from struct ext4_crypt_info

The ci_mode field was superfluous, and getting rid of it gets rid of
an unused hole in the structure.

Change-Id: I0f4c38a1162fa9c6da8a3529b7477ff5560c21df
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: "Theodore Ts'o" <tytso@google.com>

3 years agoext4 crypto: use slab caches
Theodore Ts'o [Tue, 12 May 2015 15:22:05 +0000]
ext4 crypto: use slab caches

Use slab caches the ext4_crypto_ctx and ext4_crypt_info structures for
slighly better memory efficiency and debuggability.

Change-Id: If47986e2e29fa181d113864dcd9d1cae79c72639
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: "Theodore Ts'o" <tytso@google.com>

3 years agoext4: clean up superblock encryption mode fields
Theodore Ts'o [Tue, 12 May 2015 15:21:03 +0000]
ext4: clean up superblock encryption mode fields

The superblock fields s_file_encryption_mode and s_dir_encryption_mode
are vestigal, so remove them as a cleanup.  While we're at it, allow
file systems with both encryption and inline_data enabled at the same
time to work correctly.  We can't have encrypted inodes with inline
data, but there's no reason to prohibit unencrypted inodes from using
the inline data feature.

Change-Id: Ia90b7e24bcf9ebabef529b710d70bd8ba71a17a4
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: "Theodore Ts'o" <tytso@google.com>

3 years agoext4 crypto: reorganize how we store keys in the inode
Theodore Ts'o [Mon, 4 May 2015 23:39:57 +0000]
ext4 crypto: reorganize how we store keys in the inode

This is a pretty massive patch which does a number of different things:

1) The per-inode encryption information is now stored in an allocated
   data structure, ext4_crypt_info, instead of directly in the node.
   This reduces the size usage of an in-memory inode when it is not
   using encryption.

2) We drop the ext4_fname_crypto_ctx entirely, and use the per-inode
   encryption structure instead.  This remove an unnecessary memory
   allocation and free for the fname_crypto_ctx as well as allowing us
   to reuse the ctfm in a directory for multiple lookups and file
   creations.

3) We also cache the inode's policy information in the ext4_crypt_info
   structure so we don't have to continually read it out of the
   extended attributes.

4) We now keep the keyring key in the inode's encryption structure
   instead of releasing it after we are done using it to derive the
   per-inode key.  This allows us to test to see if the key has been
   revoked; if it has, we prevent the use of the derived key and free
   it.

5) When an inode is released (or when the derived key is freed), we
   will use memset_explicit() to zero out the derived key, so it's not
   left hanging around in memory.  This implies that when a user logs
   out, it is important to first revoke the key, and then unlink it,
   and then finally, to use "echo 3 > /proc/sys/vm/drop_caches" to
   release any decrypted pages and dcache entries from the system
   caches.

6) All this, and we also shrink the number of lines of code by around
   100.  :-)

Change-Id: I948f7844d425c0ce616f800446ecb0b6bea686f8
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Theodore Ts'o <tytso@google.com>

3 years agoext4 crypto: separate kernel and userspace structure for the key
Theodore Ts'o [Mon, 4 May 2015 23:35:03 +0000]
ext4 crypto: separate kernel and userspace structure for the key

Use struct ext4_encryption_key only for the master key passed via the
kernel keyring.

For internal kernel space users, we now use struct ext4_crypt_info.
This will allow us to put information from the policy structure so we
can cache it and avoid needing to constantly looking up the extended
attribute.  We will do this in a spearate patch.  This patch is mostly
mechnical to make it easier for patch review.

Change-Id: I208472675d0550df5f60b3b58652a9a1b434caed
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Theodore Ts'o <tytso@google.com>

3 years agoext4 crypto: don't allocate a page when encrypting/decrypting file names
Theodore Ts'o [Mon, 4 May 2015 23:35:03 +0000]
ext4 crypto: don't allocate a page when encrypting/decrypting file names

Change-Id: Ib0deff3a9aff318d8f2be6b4a550168d4771ccc2
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Theodore Ts'o <tytso@google.com>

3 years agoext4 crypto: optimize filename encryption
Theodore Ts'o [Mon, 4 May 2015 23:35:03 +0000]
ext4 crypto: optimize filename encryption

Encrypt the filename as soon it is passed in by the user.  This avoids
our needing to encrypt the filename 2 or 3 times while in the process
of creating a filename.

Similarly, when looking up a directory entry, encrypt the filename
early, or if the encryption key is not available, base-64 decode the
file syystem so that the hash value and the last 16 bytes of the
encrypted filename is available in the new struct ext4_filename data
structure.

Change-Id: Ia76a5e51770840c57a53180cd89476f2e9b8c966
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Theodore Ts'o <tytso@google.com>

3 years agoext4 crypto: add padding to filenames before encrypting
Theodore Ts'o [Wed, 29 Apr 2015 16:13:02 +0000]
ext4 crypto: add padding to filenames before encrypting

This obscures the length of the filenames, to decrease the amount of
information leakage.  By default, we pad the filenames to the next 4
byte boundaries.  This costs nothing, since the directory entries are
aligned to 4 byte boundaries anyway.  Filenames can also be padded to
8, 16, or 32 bytes, which will consume more directory space.

Change-Id: I2d4ab2b76797ab93fada683f405e3876e0cff9dc
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Theodore Ts'o <tytso@google.com>

3 years agoext4 crypto: simplify and speed up filename encryption
Theodore Ts'o [Wed, 29 Apr 2015 16:13:00 +0000]
ext4 crypto: simplify and speed up filename encryption

Avoid using SHA-1 when calculating the user-visible filename when the
encryption key is available, and avoid decrypting lots of filenames
when searching for a directory entry in a directory block.

Change-Id: Ifff4c07a80740112e2e984d2da3105e2fe41ab68
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Theodore Ts'o <tytso@google.com>

3 years agoext4 crypto: sync up the mainline 4.1-rc1 merge
Theodore Ts'o [Wed, 29 Apr 2015 16:12:50 +0000]
ext4 crypto: sync up the mainline 4.1-rc1 merge

There were some last minute changes that weren't reflected in the ext4
crypto patches that we were syncing with flounder.  They were mostly
whitespace changes, plus an error handling bugfix if there was a
normal (non-crypto-related) bugs when adding a directory entry to an
inode while creating a file.

Change-Id: I01e1f8ee07aef2f826a27efcbfa85a825000f2bc
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Signed-off-by: Theodore Ts'o <tytso@google.com>

3 years agoext4 crypto: enable encryption feature flag
Theodore Ts'o [Wed, 15 Apr 2015 00:57:49 +0000]
ext4 crypto: enable encryption feature flag

Also add the test dummy encryption mode flag so we can more easily
test the encryption patches using xfstests.

Change-Id: Iaae44110ab5870e5da60aca76197828f0ebc139b
Signed-off-by: Michael Halcrow <mhalcrow@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Theodore Ts'o <tytso@google.com>

3 years agoext4 crypto: Add symlink encryption
Theodore Ts'o [Wed, 15 Apr 2015 00:56:49 +0000]
ext4 crypto: Add symlink encryption

Change-Id: Iea4299ef61fb5493db679115d75534474785bb78
Signed-off-by: Uday Savagaonkar <savagaon@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Theodore Ts'o <tytso@google.com>

3 years agoext4 crypto: enable filename encryption
Michael Halcrow [Wed, 15 Apr 2015 00:55:49 +0000]
ext4 crypto: enable filename encryption

Change-Id: Ic3ee64ce59dc349944acc5cf0140c89796009c7f
Signed-off-by: Uday Savagaonkar <savagaon@google.com>
Signed-off-by: Ildar Muslukhov <ildarm@google.com>
Signed-off-by: Michael Halcrow <mhalcrow@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Theodore Ts'o <tytso@google.com>

3 years agoext4 crypto: filename encryption modifications
Michael Halcrow [Wed, 15 Apr 2015 00:54:49 +0000]
ext4 crypto: filename encryption modifications

Modifies htree_dirblock_to_tree, dx_make_map, ext4_match search_dir,
and ext4_find_dest_de to support fname crypto.  Filename encryption
feature is not yet enabled at this patch.

Change-Id: Icd1089bd7762de78341b75fb501770f16d7b018d
Signed-off-by: Uday Savagaonkar <savagaon@google.com>
Signed-off-by: Ildar Muslukhov <ildarm@google.com>
Signed-off-by: Michael Halcrow <mhalcrow@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Theodore Ts'o <tytso@google.com>

3 years agoext4 crypto: partial update to namei.c for fname crypto
Michael Halcrow [Wed, 15 Apr 2015 00:53:49 +0000]
ext4 crypto: partial update to namei.c for fname crypto

Modifies dx_show_leaf and dx_probe to support fname encryption.
Filename encryption not yet enabled.

Change-Id: I1787ba58fc6a8cfff83e59f4b00829030cb95e42
Signed-off-by: Uday Savagaonkar <savagaon@google.com>
Signed-off-by: Ildar Muslukhov <ildarm@google.com>
Signed-off-by: Michael Halcrow <mhalcrow@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Theodore Ts'o <tytso@google.com>

3 years agoext4 crypto: insert encrypted filenames into a leaf directory block
Michael Halcrow [Wed, 15 Apr 2015 00:52:49 +0000]
ext4 crypto: insert encrypted filenames into a leaf directory block

Change-Id: Idc42ab8360930e42d7a6999215f9016412298b66
Signed-off-by: Uday Savagaonkar <savagaon@google.com>
Signed-off-by: Ildar Muslukhov <ildarm@google.com>
Signed-off-by: Michael Halcrow <mhalcrow@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Theodore Ts'o <tytso@google.com>

3 years agoext4 crypto: teach ext4_htree_store_dirent() to store decrypted filenames
Theodore Ts'o [Wed, 15 Apr 2015 00:51:49 +0000]
ext4 crypto: teach ext4_htree_store_dirent() to store decrypted filenames

For encrypted directories, we need to pass in a separate parameter for
the decrypted filename, since the directory entry contains the
encrypted filename.

Change-Id: I7290eb0979d9e9d9d65ee07bbf11223b3382394f
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Theodore Ts'o <tytso@google.com>

3 years agoext4 crypto: filename encryption facilities
Michael Halcrow [Wed, 15 Apr 2015 00:50:49 +0000]
ext4 crypto: filename encryption facilities

Change-Id: I3747c17790c296dbef4ee8d8d4405796ef462aa8
Signed-off-by: Uday Savagaonkar <savagaon@google.com>
Signed-off-by: Ildar Muslukhov <ildarm@google.com>
Signed-off-by: Michael Halcrow <mhalcrow@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Theodore Ts'o <tytso@google.com>

3 years agoext4 crypto: implement the ext4 decryption read path
Michael Halcrow [Wed, 15 Apr 2015 00:49:49 +0000]
ext4 crypto: implement the ext4 decryption read path

Change-Id: I66c32c7fa9ad6269f3ea929d773a2b35bccb2290
Signed-off-by: Michael Halcrow <mhalcrow@google.com>
Signed-off-by: Ildar Muslukhov <ildarm@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Theodore Ts'o <tytso@google.com>

3 years agoext4 crypto: implement the ext4 encryption write path
Michael Halcrow [Wed, 15 Apr 2015 00:48:49 +0000]
ext4 crypto: implement the ext4 encryption write path

Pulls block_write_begin() into fs/ext4/inode.c because it might need
to do a low-level read of the existing data, in which case we need to
decrypt it.

Change-Id: If317411eb54d5fb8d0b5570289e2cbefe78b389d
Signed-off-by: Michael Halcrow <mhalcrow@google.com>
Signed-off-by: Ildar Muslukhov <ildarm@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Theodore Ts'o <tytso@google.com>

3 years agoext4 crypto: inherit encryption policies on inode and directory create
Michael Halcrow [Wed, 15 Apr 2015 00:47:49 +0000]
ext4 crypto: inherit encryption policies on inode and directory create

Change-Id: I117081ed17bd60e76b3bc938daf1404ceffb94c2
Signed-off-by: Michael Halcrow <mhalcrow@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Theodore Ts'o <tytso@google.com>

3 years agoext4 crypto: enforce context consistency
Theodore Ts'o [Wed, 15 Apr 2015 00:46:49 +0000]
ext4 crypto: enforce context consistency

Enforce the following inheritance policy:

1) An unencrypted directory may contain encrypted or unencrypted files
or directories.

2) All files or directories in a directory must be protected using the
same key as their containing directory.

As a result, assuming the following setup:

mke2fs -t ext4 -Fq -O encrypt /dev/vdc
mount -t ext4 /dev/vdc /vdc
mkdir /vdc/a /vdc/b /vdc/c
echo foo | e4crypt add_key /vdc/a
echo bar | e4crypt add_key /vdc/b
for i in a b c ; do cp /etc/motd /vdc/$i/motd-$i ; done

Then we will see the following results:

cd /vdc
mv a b # will fail; /vdc/a and /vdc/b have different keys
mv b/motd-b a # will fail, see above
ln a/motd-a b # will fail, see above
mv c a      # will fail; all inodes in an encrypted directory
       # must be encrypted
ln c/motd-c b # will fail, see above
mv a/motd-a c # will succeed
mv c/motd-a a # will succeed

Change-Id: I5a7ff5cbec6258855402d579f994f381b8779e2c
Signed-off-by: Michael Halcrow <mhalcrow@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Theodore Ts'o <tytso@google.com>

3 years agoext4 crypto: add encryption key management facilities
Michael Halcrow [Wed, 15 Apr 2015 00:45:49 +0000]
ext4 crypto: add encryption key management facilities

Change-Id: I4e59c73febff7041c9db6c58c775413e2f5bd0e8
Signed-off-by: Michael Halcrow <mhalcrow@google.com>
Signed-off-by: Ildar Muslukhov <muslukhovi@gmail.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Theodore Ts'o <tytso@google.com>

3 years agoext4 crypto: add ext4 encryption facilities
Michael Halcrow [Wed, 15 Apr 2015 00:44:49 +0000]
ext4 crypto: add ext4 encryption facilities

On encrypt, we will re-assign the buffer_heads to point to a bounce
page rather than the control_page (which is the original page to write
that contains the plaintext). The block I/O occurs against the bounce
page.  On write completion, we re-assign the buffer_heads to the
original plaintext page.

On decrypt, we will attach a read completion callback to the bio
struct. This read completion will decrypt the read contents in-place
prior to setting the page up-to-date.

The current encryption mode, AES-256-XTS, lacks cryptographic
integrity. AES-256-GCM is in-plan, but we will need to devise a
mechanism for handling the integrity data.

Change-Id: I6e0569c9f19a82c75f4b545ad04ff7fdd1908d74
Signed-off-by: Michael Halcrow <mhalcrow@google.com>
Signed-off-by: Ildar Muslukhov <ildarm@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Theodore Ts'o <tytso@google.com>

3 years agoext4 crypto: add encryption policy and password salt support
Michael Halcrow [Wed, 15 Apr 2015 00:34:38 +0000]
ext4 crypto: add encryption policy and password salt support

Change-Id: I1a48fadd5f5ab6188ee93709a9c86ac75da2c220
Signed-off-by: Michael Halcrow <mhalcrow@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Ildar Muslukhov <muslukhovi@gmail.com>
Signed-off-by: Theodore Ts'o <tytso@google.com>

3 years agoext4 crypto: add encryption xattr support
Michael Halcrow [Mon, 13 Apr 2015 03:50:45 +0000]
ext4 crypto: add encryption xattr support

Change-Id: I8ab9c1e751751e27ad3075b70bf792d141c96236
Signed-off-by: Michael Halcrow <mhalcrow@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Theodore Ts'o <tytso@google.com>

3 years agoext4 crypto: export ext4_empty_dir()
Michael Halcrow [Mon, 13 Apr 2015 03:50:45 +0000]
ext4 crypto: export ext4_empty_dir()

Required for future encryption xattr changes.

Change-Id: I40325ae4d7509104e1482d3404ebc6d43e678b6a
Signed-off-by: Michael Halcrow <mhalcrow@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Theodore Ts'o <tytso@google.com>

3 years agoext4 crypto: add ext4 encryption Kconfig
Theodore Ts'o [Mon, 13 Apr 2015 03:50:45 +0000]
ext4 crypto: add ext4 encryption Kconfig

Change-Id: I343b76ce9c2a2f5cd887db3f0ff2c9dee329c15f
Signed-off-by: Michael Halcrow <mhalcrow@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Theodore Ts'o <tytso@google.com>

3 years agoext4 crypto: reserve codepoints used by the ext4 encryption feature
Theodore Ts'o [Mon, 13 Apr 2015 03:50:44 +0000]
ext4 crypto: reserve codepoints used by the ext4 encryption feature

Change-Id: I729993a48b2acd13449b8e7625d8c640905a8974
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Theodore Ts'o <tytso@google.com>

3 years agoext4 crypto: add ext4_mpage_readpages()
Theodore Ts'o [Wed, 8 Apr 2015 10:35:05 +0000]
ext4 crypto: add ext4_mpage_readpages()

This takes code from fs/mpage.c and optimizes it for ext4.  Its
primary reason is to allow us to more easily add encryption to ext4's
read path in an efficient manner.

Change-Id: I7d3a27c9768c1487dd374754b40ea6fe64589593
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Theodore Ts'o <tytso@google.com>

3 years agoext4: use old legacy direct I/O interface for 3.18 backport
Theodore Ts'o [Thu, 22 Jan 2015 20:40:07 +0000]
ext4: use old legacy direct I/O interface for 3.18 backport

Signed-off-by: Theodore Ts'o <tytso@mit.edu>

3 years agonon-ext4 portions of "direct-io: Implement generic deferred AIO completions"
Theodore Ts'o [Thu, 22 Jan 2015 20:20:55 +0000]
non-ext4 portions of "direct-io: Implement generic deferred AIO completions"

Originally from 7b7a8665edd8db73

Signed-off-by: Theodore Ts'o <tytso@mit.edu>

3 years agoext4: revert to old read/write/aio interface for 3.18 backport
Theodore Ts'o [Thu, 22 Jan 2015 19:59:19 +0000]
ext4: revert to old read/write/aio interface for 3.18 backport

Signed-off-by: Theodore Ts'o <tytso@mit.edu>

3 years agoext4: revert to old invalidatepage call function signature
Theodore Ts'o [Thu, 22 Jan 2015 19:50:42 +0000]
ext4: revert to old invalidatepage call function signature

Signed-off-by: Theodore Ts'o <tytso@mit.edu>

3 years agoext4: remove tmpfile, rename2, set_acl operations for 3.18 backport
Theodore Ts'o [Thu, 22 Jan 2015 19:49:04 +0000]
ext4: remove tmpfile, rename2, set_acl operations for 3.18 backport

Also switch to the rename operation.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>

3 years agosync: don't block the flusher thread waiting on IO
Dave Chinner [Tue, 2 Jul 2013 12:38:35 +0000]
sync: don't block the flusher thread waiting on IO

When sync does it's WB_SYNC_ALL writeback, it issues data Io and
then immediately waits for IO completion. This is done in the
context of the flusher thread, and hence completely ties up the
flusher thread for the backing device until all the dirty inodes
have been synced. On filesystems that are dirtying inodes constantly
and quickly, this means the flusher thread can be tied up for
minutes per sync call and hence badly affect system level write IO
performance as the page cache cannot be cleaned quickly.

We already have a wait loop for IO completion for sync(2), so cut
this out of the flusher thread and delegate it to wait_sb_inodes().
Hence we can do rapid IO submission, and then wait for it all to
complete.

Effect of sync on fsmark before the patch:

FSUse%        Count         Size    Files/sec     App Overhead
.....
     0       640000         4096      35154.6          1026984
     0       720000         4096      36740.3          1023844
     0       800000         4096      36184.6           916599
     0       880000         4096       1282.7          1054367
     0       960000         4096       3951.3           918773
     0      1040000         4096      40646.2           996448
     0      1120000         4096      43610.1           895647
     0      1200000         4096      40333.1           921048

And a single sync pass took:

  real    0m52.407s
  user    0m0.000s
  sys     0m0.090s

After the patch, there is no impact on fsmark results, and each
individual sync(2) operation run concurrently with the same fsmark
workload takes roughly 7s:

  real    0m6.930s
  user    0m0.000s
  sys     0m0.039s

IOWs, sync is 7-8x faster on a busy filesystem and does not have an
adverse impact on ongoing async data write operations.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
(cherry picked from commit 7747bd4bceb3079572695d3942294a6c7b265557)

3 years agofs: add inode_set_flags() for ext4 3.18 backport
Theodore Ts'o [Thu, 22 Jan 2015 19:10:26 +0000]
fs: add inode_set_flags() for ext4 3.18 backport

Excerpted from commit 5f16f3225b062

Signed-off-by: Theodore Ts'o <tytso@mit.edu>

3 years agoext4: use old interface for ext4_readdir()
Theodore Ts'o [Thu, 22 Jan 2015 19:08:16 +0000]
ext4: use old interface for ext4_readdir()

Signed-off-by: Theodore Ts'o <tytso@mit.edu>

3 years agoext4: fix up bio->bi_iter.bi_sector
Theodore Ts'o [Thu, 22 Jan 2015 18:39:38 +0000]
ext4: fix up bio->bi_iter.bi_sector

Signed-off-by: Theodore Ts'o <tytso@mit.edu>

3 years agosched: add bit_wait_io for 3.18 ext4 backport
Theodore Ts'o [Thu, 22 Jan 2015 18:05:19 +0000]
sched: add bit_wait_io for 3.18 ext4 backport

Excerpted from commit 743162013: "sched: Remove proliferation of
wait_on_bit() action functions"

Signed-off-by: Theodore Ts'o <tytso@mit.edu>

3 years agobuffer_head.h: add getblk_unmovable() for 3.18 ext4 backport
Theodore Ts'o [Thu, 22 Jan 2015 17:51:46 +0000]
buffer_head.h: add getblk_unmovable() for 3.18 ext4 backport

Signed-off-by: Theodore Ts'o <tytso@mit.edu>

3 years agoext4: backport mm portion of: fix data integrity sync in ordered mode
Theodore Ts'o [Thu, 22 Jan 2015 17:38:11 +0000]
ext4: backport mm portion of: fix data integrity sync in ordered mode

Commit 1c8349a17137: "ext4: fix data integrity sync in ordered mode"
included changes to include/linux/page-flags.h and
mm/page-writeback.c.  Apply them as part of the 3.18 ext4 backport.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>

3 years agoext4: use old truncate_pagecache() interface for ext4 3.18 backport
Theodore Ts'o [Thu, 22 Jan 2015 17:26:16 +0000]
ext4: use old truncate_pagecache() interface for ext4 3.18 backport

Signed-off-by: Theodore Ts'o <tytso@mit.edu>

3 years agoext4: use old percpu_counter_init() function signature
Theodore Ts'o [Thu, 22 Jan 2015 17:20:19 +0000]
ext4: use old percpu_counter_init() function signature

Older kernels don't pass in a gfp_flags argument.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>

3 years agoext4: use the old shrinker API
Theodore Ts'o [Thu, 22 Jan 2015 17:17:17 +0000]
ext4: use the old shrinker API

Signed-off-by: Theodore Ts'o <tytso@mit.edu>

3 years agoext4: disable ext4 acl handling for 3.18 backport
Theodore Ts'o [Thu, 22 Jan 2015 17:15:47 +0000]
ext4: disable ext4 acl handling for 3.18 backport

The ACL code changes too much between 3.18 and 3.10; so disable acl
handling so we don't have make things actually work.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>

3 years agouapi: add new system call ABI codepoints for ext4 3.18 backport
Theodore Ts'o [Thu, 22 Jan 2015 17:13:14 +0000]
uapi: add new system call ABI codepoints for ext4 3.18 backport

note: this doesn't guarantee that functionality provided by
FALLOC_FL_COLLAPSE_RANGE, FALLOC_FL_ZERO_RANGE, and FIEMAP_FLAG_CACHE
to necessarily _work_; it only allows ext4 from 3.18 to *compile*.

Fortunately, these are exotic bits of functionality that most people
never use.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>

3 years agomm.h: add truncate_inode_pages_final() for 3.18 ext4 backport
Theodore Ts'o [Thu, 22 Jan 2015 17:12:30 +0000]
mm.h: add truncate_inode_pages_final() for 3.18 ext4 backport

3 years agobitops.h: add smp_mb__after_atomic() for 3.18 backport
Theodore Ts'o [Thu, 22 Jan 2015 17:11:54 +0000]
bitops.h: add smp_mb__after_atomic() for 3.18 backport

Signed-off-by: Theodore Ts'o <tytso@mit.edu>

3 years agobuffer_head.h: add sb_bread_unmovable() for 3.18 ext4 backport
Theodore Ts'o [Thu, 22 Jan 2015 17:11:18 +0000]
buffer_head.h: add sb_bread_unmovable() for 3.18 ext4 backport

Signed-off-by: Theodore Ts'o <tytso@mit.edu>

3 years agopercpu: add raw_cpu_ptr() for 3.18 ext4 backport
Theodore Ts'o [Thu, 22 Jan 2015 17:10:43 +0000]
percpu: add raw_cpu_ptr() for 3.18 ext4 backport

3 years agomm: add find_get_page_flags() for 3.18 ext4 backport
Theodore Ts'o [Thu, 22 Jan 2015 17:09:47 +0000]
mm: add find_get_page_flags() for 3.18 ext4 backport

Signed-off-by: Theodore Ts'o <tytso@mit.edu>

3 years agoinclude/linux/fs.h: add dir_emit() and dir_relax() for 3.18 backport
Theodore Ts'o [Thu, 22 Jan 2015 17:08:39 +0000]
include/linux/fs.h: add dir_emit() and dir_relax() for 3.18 backport

Signed-off-by: Theodore Ts'o <tytso@mit.edu>

3 years agofs: add {lock,unlock}_two_nondirectories for 3.18 backport
Theodore Ts'o [Thu, 22 Jan 2015 17:06:09 +0000]
fs: add {lock,unlock}_two_nondirectories for 3.18 backport

Signed-off-by: Theodore Ts'o <tytso@mit.edu>

3 years agorbtree: add rbtree_postorder_for_each_entry_safe() helper
Cody P Schafer [Wed, 11 Sep 2013 21:25:11 +0000]
rbtree: add rbtree_postorder_for_each_entry_safe() helper

Because deletion (of the entire tree) is a relatively common use of the
rbtree_postorder iteration, and because doing it safely means fiddling
with temporary storage, provide a helper to simplify postorder rbtree
iteration.

Signed-off-by: Cody P Schafer <cody@linux.vnet.ibm.com>
Reviewed-by: Seth Jennings <sjenning@linux.vnet.ibm.com>
Cc: David Woodhouse <David.Woodhouse@intel.com>
Cc: Rik van Riel <riel@redhat.com>
Cc: Michel Lespinasse <walken@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

3 years agorbtree: add postorder iteration functions
Cody P Schafer [Wed, 11 Sep 2013 21:25:10 +0000]
rbtree: add postorder iteration functions

Postorder iteration yields all of a node's children prior to yielding the
node itself, and this particular implementation also avoids examining the
leaf links in a node after that node has been yielded.

In what I expect will be its most common usage, postorder iteration allows
the deletion of every node in an rbtree without modifying the rbtree nodes
(no _requirement_ that they be nulled) while avoiding referencing child
nodes after they have been "deleted" (most commonly, freed).

I have only updated zswap to use this functionality at this point, but
numerous bits of code (most notably in the filesystem drivers) use a hand
rolled postorder iteration that NULLs child links as it traverses the
tree.  Each of those instances could be replaced with this common
implementation.

1 & 2 add rbtree postorder iteration functions.
3 adds testing of the iteration to the rbtree runtime tests
4 allows building the rbtree runtime tests as builtins
5 updates zswap.

This patch:

Add postorder iteration functions for rbtree.  These are useful for safely
freeing an entire rbtree without modifying the tree at all.

Signed-off-by: Cody P Schafer <cody@linux.vnet.ibm.com>
Reviewed-by: Seth Jennings <sjenning@linux.vnet.ibm.com>
Cc: David Woodhouse <David.Woodhouse@intel.com>
Cc: Rik van Riel <riel@redhat.com>
Cc: Michel Lespinasse <walken@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

3 years agoext4: insert 3.18 version of fs/ext4, fs/jbd2 and associated header files
Ian Chang [Tue, 10 May 2016 04:37:37 +0000]
ext4: insert 3.18 version of fs/ext4, fs/jbd2 and associated header files

This will cause ext3 and gfs2 to not compile correctly, but allows us
to get a modern version of ext4 into 3.10.  This makes it easier to
backport newer features such as ext4 encryption into a downrev kernel.
It also fixes a number of xfstest failures that were fixed since 3.10.

The subsequent commits will fix up the 3.18 ext4 codebase so it will
compile against 3.10.

Change-Id: I866e28baf4f11e5ef3fbb3ea9f205a18f4576303
Signed-off-by: Ian Chang <ianc@nvidia.com>

3 years agoselinux: Android kernel compatibility with M userspace
Jeff Vander Stoep [Thu, 22 Oct 2015 16:30:40 +0000]
selinux: Android kernel compatibility with M userspace

NOT intended for new Android devices - this commit is unnecessary
for a target device that does not have a previous M variant.

DO NOT upstream. Android only.

Motivation:

This commit mitigates a mismatch between selinux kernel and
selinux userspace. The selinux ioctl white-listing binary policy
format that was accepted into Android M differs slightly from what
was later accepted into the upstream kernel. This leaves Android
master branch kernels incompatible with Android M releases. This
patch restores backwards compatibility. This is important because:

1. kernels may be updated on a different cycle than the rest of the
   OS e.g. security patching.
2. Android M bringup may still be ongoing for some devices. The
   same kernel should work for both M and master.

Backwards compatibility is achieved by checking for an Android M
policy characteristic during initial policy read and converting to
upstream policy format. The inverse conversion is done for policy
write as required for CTS testing.

Bug: 22846070
Change-Id: I2f1ee2eee402f37cf3c9df9f9e03c1b9ddec1929
Signed-off-by: Jeff Vander Stoep <jeffv@google.com>
Signed-off-by: Roger Ma <roma@nvidia.com>
Reviewed-on: http://git-master/r/1155637

3 years agoselinux: extended permissions for ioctls
Jeff Vander Stoep [Fri, 10 Jul 2015 21:19:56 +0000]
selinux: extended permissions for ioctls

(cherry picked from commit fa1aa143ac4a682c7f5fd52a3cf05f5a6fe44a0a)

Add extended permissions logic to selinux. Extended permissions
provides additional permissions in 256 bit increments. Extend the
generic ioctl permission check to use the extended permissions for
per-command filtering. Source/target/class sets including the ioctl
permission may additionally include a set of commands. Example:

allowxperm <source> <target>:<class> ioctl unpriv_app_socket_cmds
auditallowxperm <source> <target>:<class> ioctl priv_gpu_cmds

Where unpriv_app_socket_cmds and priv_gpu_cmds are macros
representing commonly granted sets of ioctl commands.

When ioctl commands are omitted only the permissions are checked.
This feature is intended to provide finer granularity for the ioctl
permission that may be too imprecise. For example, the same driver
may use ioctls to provide important and benign functionality such as
driver version or socket type as well as dangerous capabilities such
as debugging features, read/write/execute to physical memory or
access to sensitive data. Per-command filtering provides a mechanism
to reduce the attack surface of the kernel, and limit applications
to the subset of commands required.

The format of the policy binary has been modified to include ioctl
commands, and the policy version number has been incremented to
POLICYDB_VERSION_XPERMS_IOCTL=30 to account for the format
change.

The extended permissions logic is deliberately generic to allow
components to be reused e.g. netlink filters

Signed-off-by: Jeff Vander Stoep <jeffv@google.com>
Acked-by: Nick Kralevich <nnk@google.com>
Signed-off-by: Paul Moore <pmoore@redhat.com>
Bug: 22846070
Change-Id: I7c6bdc0362657b47aa1388936c5a1300bc5c0b42
Signed-off-by: Roger Ma <roma@nvidia.com>
Reviewed-on: http://git-master/r/1155636

3 years agoselinux: remove unnecessary pointer reassignment
Jeff Vander Stoep [Thu, 26 Feb 2015 21:54:17 +0000]
selinux: remove unnecessary pointer reassignment

(cherry pick from commit 83d4a806ae46397f606de7376b831524bd3a21e5)

Commit f01e1af445fa ("selinux: don't pass in NULL avd to avc_has_perm_noaudit")
made this pointer reassignment unnecessary. Avd should continue to reference
the stack-based copy.

Signed-off-by: Jeff Vander Stoep <jeffv@google.com>
Acked-by: Stephen Smalley <sds@tycho.nsa.gov>
[PM: tweaked subject line]
Signed-off-by: Paul Moore <pmoore@redhat.com>
Bug: 22846070
Change-Id: I8fcba45a5acc4de862bd5b3f07bf4980f67133c4
Signed-off-by: Roger Ma <roma@nvidia.com>
Reviewed-on: http://git-master/r/1155634

3 years agoRevert "SELinux: per-command whitelisting of ioctls"
Jeff Vander Stoep [Thu, 30 Jul 2015 04:10:52 +0000]
Revert "SELinux: per-command whitelisting of ioctls"

This reverts commit ba733f9857b966459316d0cd33b8da2e22f62d7d.

Bug: 22846070
Change-Id: I4b5d9ce72996b7cf5b972dbcae22fbd6aff05149
Signed-off-by: Jeff Vander Stoep <jeffv@google.com>
Signed-off-by: Roger Ma <roma@nvidia.com>
Reviewed-on: http://git-master/r/1155632

3 years agosecurity: add ioctl specific auditing to lsm_audit
Jeff Vander Stoep [Fri, 10 Jul 2015 21:19:55 +0000]
security: add ioctl specific auditing to lsm_audit

(cherry pick from commit 671a2781ff01abf4fdc8904881fc3abd3a8279af)

Add information about ioctl calls to the LSM audit data. Log the
file path and command number.

Signed-off-by: Jeff Vander Stoep <jeffv@google.com>
Acked-by: Nick Kralevich <nnk@google.com>
[PM: subject line tweak]
Signed-off-by: Paul Moore <pmoore@redhat.com>
Bug: 22846070
Change-Id: I88a6ecdd59297a315a6fb9c82c0a798bdb6bafaa
Signed-off-by: Roger Ma <roma@nvidia.com>
Reviewed-on: http://git-master/r/1155635

3 years agoRevert "SELinux: use deletion-safe iterator to free list"
Jeff Vander Stoep [Thu, 30 Jul 2015 04:10:11 +0000]
Revert "SELinux: use deletion-safe iterator to free list"

This reverts commit e623b152f30f6f1204919315df37244d69e5d55e.

Bug: 22846070
Change-Id: Ief7a906b613adcf316e734270a1da2fbd1ce6cb8
Signed-off-by: Jeff Vander Stoep <jeffv@google.com>
Signed-off-by: Roger Ma <roma@nvidia.com>
Reviewed-on: http://git-master/r/1155631

3 years agoRevert "SELinux: ss: Fix policy write for ioctl operations"
Jeff Vander Stoep [Thu, 30 Jul 2015 04:09:33 +0000]
Revert "SELinux: ss: Fix policy write for ioctl operations"

This reverts commit 6bdf36786e225facf5ad2ed383a29ffd488e60ac.

Bug: 22846070
Change-Id: I47ae4ef40c688d96e2e5062506998808b9e4f603
Signed-off-by: Jeff Vander Stoep <jeffv@google.com>
Signed-off-by: Roger Ma <roma@nvidia.com>
Reviewed-on: http://git-master/r/1155630

3 years ago[Android-N] Add default value
Eric Zhang [Fri, 26 Feb 2016 03:21:38 +0000]
[Android-N] Add default value

Bug 1733015

Change-Id: Ied6bdffa0c45e5bf8e38239b3a75b1c64899fe6c
Signed-off-by: Eric Zhang <ericz@nvidia.com>
Reviewed-on: http://git-master/r/1020420
Reviewed-on: http://git-master/r/1122271
Reviewed-by: David Pearce <dpearce@nvidia.com>
Tested-by: David Pearce <dpearce@nvidia.com>
Reviewed-on: http://git-master/r/1155638
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Roger Ma <roma@nvidia.com>
Tested-by: Roger Ma <roma@nvidia.com>

3 years agoRevert "security: lsm_audit: add ioctl specific auditing"
Jeff Vander Stoep [Thu, 30 Jul 2015 04:11:21 +0000]
Revert "security: lsm_audit: add ioctl specific auditing"

This reverts commit b9417e527039f72073a0d368955bd1267f92ba70.

Bug: 22846070
Change-Id: I11d8880135a32b54e8eb8b95091b0226aa16735e
Signed-off-by: Jeff Vander Stoep <jeffv@google.com>
Signed-off-by: Roger Ma <roma@nvidia.com>
Reviewed-on: http://git-master/r/1155633

3 years agoarch: arm64: boot: dts: HDMI support
Bhanu Murthy V [Mon, 28 Mar 2016 20:23:02 +0000]
arch: arm64: boot: dts: HDMI support

Support HDMI for 8 CSI lanes with single
video node.

Bug 200169351

Change-Id: I4ab57f2554eda284029ba8c3ebe7a3a8a2d73e56
Signed-off-by: Bhanu Murthy V <bmurthyv@nvidia.com>
Reviewed-on: http://git-master/r/1116576
(cherry picked from commit 698e4ec3eb74df562ccde8f96638871f201e8413)
Reviewed-on: http://git-master/r/1149892
(cherry picked from commit bb87e10ec4af49e8c805b860978872ed19be9573)
Signed-off-by: Bryan Wu <pengw@nvidia.com>
Reviewed-on: http://git-master/r/1153888
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Jihoon Bang <jbang@nvidia.com>

3 years agodrivers: media: camera: Graph parsing update
Bhanu Murthy V [Tue, 8 Mar 2016 08:52:53 +0000]
drivers: media: camera: Graph parsing update

Current set of APIs provided by media controller
asynchronization sub-device registration allows
graph linking only when the last expected
sub-device is registered with framework.
The current change does graph linking for the
sub-devices registered when VI driver is
being registered.

Change addresses the problem of missing modules
in platforms. Unregsiters video node if no
modules are found.

Bug 1737952
Bug 200191959

Change-Id: I311395a331da1ce7668c5cda45535edf4046e0e6
Signed-off-by: Bhanu Murthy V <bmurthyv@nvidia.com>
(cherry picked from commit 01fa10a9d8e1c81184ebb7c190bebb5694102ff1)
Reviewed-on: http://git-master/r/1129868
Signed-off-by: Bryan Wu <pengw@nvidia.com>
Reviewed-on: http://git-master/r/1026377
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Jihoon Bang <jbang@nvidia.com>

3 years agomedia: tc358840: add 720p support in edid
Ahung Cheng [Mon, 28 Mar 2016 18:55:28 +0000]
media: tc358840: add 720p support in edid

bug 200169351

Change-Id: Icbc05b28e5829e5aabbd11c145118d987ed1d4bf
Signed-off-by: Ahung Cheng <ahcheng@nvidia.com>
Reviewed-on: http://git-master/r/1116539
(cherry picked from commit d6b422e406f31531efc112ca3a5e062434abd277)
Signed-off-by: Bryan Wu <pengw@nvidia.com>
Reviewed-on: http://git-master/r/1147957
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Jihoon Bang <jbang@nvidia.com>

3 years agotegra: adsp: Max ADSP clock at APM active
Viswanath L [Wed, 25 May 2016 08:06:24 +0000]
tegra: adsp: Max ADSP clock at APM active

Spike ADSP freq. to max when app transitions to active so that ADSP
does not starve

Bug 200196267

Change-Id: I11863b2449cfecc47aefd9bc41059b634b3b2acd
Signed-off-by: Viswanath L <viswanathl@nvidia.com>
Reviewed-on: http://git-master/r/1142024
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Viraj Karandikar <vkarandikar@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Ravindra Lokhande <rlokhande@nvidia.com>

3 years agoadsp: dfs: override adsp dfs and reinit actmon
Puneet Saxena [Wed, 18 May 2016 10:03:28 +0000]
adsp: dfs: override adsp dfs and reinit actmon

To fix sudden adsp freq scaling, exporting an adsp_dfs
interface. The interface overrides actmon requested
freq and reinitialize actmon to settle down at suitable freq
as per the current load.

Bug 200198367
Bug 200196267

Change-Id: Iad542e527f50ff365225f23128e398cd9c216a5b
Signed-off-by: Puneet Saxena <puneets@nvidia.com>
Signed-off-by: Viswanath L <viswanathl@nvidia.com>
Reviewed-on: http://git-master/r/1149683
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Viraj Karandikar <vkarandikar@nvidia.com>
Reviewed-by: Ravindra Lokhande <rlokhande@nvidia.com>

3 years agovideo: tegra: Add deep color support
Santosh Reddy Galma [Mon, 19 Oct 2015 11:08:14 +0000]
video: tegra: Add deep color support

This change adds support for YUV422, YUV444 and RGB444 deep color
formats. It also fixes the associated masks and values.

Bug 1750555

Change-Id: Iea8551df9783a1f5c05679d971d62cb5d8ef3ba8
Signed-off-by: Aly Hirani <ahirani@nvidia.com>
Signed-off-by: Michael I. Gold <gold@nvidia.com>
Reviewed-on: http://git-master/r/1134544
(cherry picked from commit 8a923dc3bdcb2c94344374acfcd65f542793b3f9)
Reviewed-on: http://git-master/r/1152722
Reviewed-by: Vinayak Pane <vpane@nvidia.com>

3 years agohid: jarvis: Fix error in printing seq num
Ankita Garg [Fri, 13 May 2016 01:16:51 +0000]
hid: jarvis: Fix error in printing seq num

The driver prints out the sequence number from
wrong byte offset of sbc_input[1] instead of
sbc_input[0]

Bug 1765850

Change-Id: I6d39c903ef314d00170c7504f3cc98242fc896fb
Signed-off-by: Ankita Garg <ankitag@nvidia.com>
Reviewed-on: http://git-master/r/1147751
(cherry picked from commit 79a9bdf3250fe05c746dc1a0ee44c54692bd18f2)
Reviewed-on: http://git-master/r/1152012
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Raymond Poudrier <rapoudrier@nvidia.com>

3 years agomedia: ov5693: remove 1296x972 mode table
Bryan Wu [Mon, 25 Apr 2016 20:25:37 +0000]
media: ov5693: remove 1296x972 mode table

Bug 1736471

Change-Id: I47a539eb5e31feee7f5d32f48337204d3547beb2
Signed-off-by: Bryan Wu <pengw@nvidia.com>
(cherry picked from commit 8c93380639ac5b3061a3a90e6e1a7ed65a40c889)
Reviewed-on: http://git-master/r/1132089
Signed-off-by: Bryan Wu <pengw@nvidia.com>
Reviewed-on: http://git-master/r/1141923
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Wenjia Zhou <wenjiaz@nvidia.com>
Reviewed-by: Jihoon Bang <jbang@nvidia.com>

3 years agoALSA: hda: Allow 192khz for EAC3 capable sinks
Rahul Mittal [Fri, 13 May 2016 09:20:15 +0000]
ALSA: hda: Allow 192khz for EAC3 capable sinks

If the sink is eac3 decode capable, but not supporting 192khz
in its ELD, ALSA card doesn't add 192khz in supported rates.
Add 192khz in ALSA card for eac3 decode capable sinks, so
that user-space can open pcm device and play EAC3 content.

Bug 1764782

Change-Id: Iac5cdc5eb0acd448cec88ab0cacecc9c8a77c155
Signed-off-by: Rahul Mittal <rmittal@nvidia.com>
Reviewed-on: http://git-master/r/1147326
(cherry picked from commit cd5587dc8015dce523a408950b4a4114b71ee846)
Reviewed-on: http://git-master/r/1151760
GVS: Gerrit_Virtual_Submit
Reviewed-by: Sumit Bhattacharya <sumitb@nvidia.com>

3 years agonet: wireless: bcmdhd abort ongoing-scan for disconnection
nagaraj [Wed, 27 Apr 2016 19:42:56 +0000]
net: wireless: bcmdhd abort ongoing-scan for disconnection

Original commit message:
sometimes we cannot get WLC_E_DEAUTH due to ongoing-scan
We need to abort ongoing-scan for disconnection

Bug: 18634452
Signed-off-by: Ecco park <eccopark@broadcom.com>
Link: https://android.googlesource.com/kernel/common.git/+/87466a9b218b4b0ad04efce8354589822478ea00%5E!/

Bug 200186891
Bug 200190639
Bug 200191534

Signed-off-by: Nagaraj Annaiah <nannaiah@nvidia.com>
Change-Id: I7494dca90087014d82da8282dd139d509b0ed796
Reviewed-on: http://git-master/r/1139859
(cherry picked from commit 241f350a0c3418d0968cd2e33e236a7e9b6ff505)
Reviewed-on: http://git-master/r/1147077
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>

3 years agospi: tegra: Update cmd1 before cs enable
Krishna Yarlagadda [Wed, 11 May 2016 11:19:35 +0000]
spi: tegra: Update cmd1 before cs enable

SPI mode has to be selected before enabling chip select
Write to register only if mode is different than default

Also set mode bits of default chip select during setup

Bug 1731138

Change-Id: I4dd18fbc0da03a4218914028590846baaf5a2a8e
Signed-off-by: Krishna Yarlagadda <kyarlagadda@nvidia.com>
Reviewed-on: http://git-master/r/1145631
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>

3 years agospi: tegra: read back register before start xfer
Krishna Yarlagadda [Wed, 11 May 2016 11:22:50 +0000]
spi: tegra: read back register before start xfer

Writes to SPI registers are not ensured to be in order.
Read register just before enabling transfer to ensure
all previous writes to any SPI registers are complete

Bug 1731138

Change-Id: I8872ffff98dcccc3a1c3087348fbff00fd401c85
Signed-off-by: Krishna Yarlagadda <kyarlagadda@nvidia.com>
Reviewed-on: http://git-master/r/1145632
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>

3 years agospi: tegra: option to disable runtime pm
Krishna Yarlagadda [Wed, 11 May 2016 09:38:10 +0000]
spi: tegra: option to disable runtime pm

Runtime pm calls can be a overhead for smaller SPI transfers
where each microsecond counts. SPI takes very less power and
can ignore runtime power management.
Provided a dt option to disable runtime power management and
run with clocks always on.

Bug 1731138

Change-Id: Ia4b8c092e43208388cb09a82f603bbba6a6b7f9d
Signed-off-by: Krishna Yarlagadda <kyarlagadda@nvidia.com>
Reviewed-on: http://git-master/r/1145630
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>

3 years agospi: tegra: Support autosuspend delay
Krishna Yarlagadda [Wed, 11 May 2016 05:26:24 +0000]
spi: tegra: Support autosuspend delay

After each meassage transfer the spi block is disabled
which requires a sync at each new transfer. The use of
pm_runtime_put_autosupend instead of pm_runtime_put will
disable the block only after a certain amount of time

Bug 1731138

Change-Id: I668c37d56c765c3f9118795998501109dcb6a03f
Signed-off-by: Krishna Yarlagadda <kyarlagadda@nvidia.com>
Reviewed-on: http://git-master/r/1145629
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>

3 years agospi: tegra: set INTR_MASK only once
Krishna Yarlagadda [Wed, 11 May 2016 04:54:16 +0000]
spi: tegra: set INTR_MASK only once

INTR_MASK does not change for each transfer and all interrupts
are enabled always. Write to register only during setup and resume

Bug 1731138

Change-Id: I53f600bd86cb7d605c3f26f6dbbf25ec28346f71
Signed-off-by: Krishna Yarlagadda <kyarlagadda@nvidia.com>
Reviewed-on: http://git-master/r/1145628
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>

3 years agospi: tegra: write to DMA_CTL only when needed
Krishna Yarlagadda [Wed, 11 May 2016 04:06:44 +0000]
spi: tegra: write to DMA_CTL only when needed

SPI_DMA_CTL register control interrupts for chips
before T210. Write to this register only for those
chips

Bug 1731138

Change-Id: Ie0979ea15e01faca9e4ee0643499ce7ee5bffb68
Signed-off-by: Krishna Yarlagadda <kyarlagadda@nvidia.com>
Reviewed-on: http://git-master/r/1145627
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>

3 years agomedia: mipi_cal: fix building errors for T124
Bryan Wu [Fri, 20 May 2016 00:55:21 +0000]
media: mipi_cal: fix building errors for T124

Bug 1686313

Change-Id: I92fe398998cbd877c7e39f81687bf24cacb90293
Signed-off-by: Bryan Wu <pengw@nvidia.com>
Reviewed-on: http://git-master/r/1150781
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Jihoon Bang <jbang@nvidia.com>

3 years agodrivers:media:platform:tegra: Fix pll_d clk_get
Wenjia Zhou [Thu, 19 May 2016 01:01:46 +0000]
drivers:media:platform:tegra: Fix pll_d clk_get

NVHOST_VI_IOCTL_ENABLE_TPG need pll_d clk, however when dev_id is present, it
has higher priority than con_id, thus causing clk_get return unexpected result.
Remove dev_id to make sure "pll_d" is returned.

bug 1686313

Change-Id: Iceb12835ffeca3c3fd309fbd496a42974263fc61
Signed-off-by: Wenjia Zhou <wenjiaz@nvidia.com>
Reviewed-on: http://git-master/r/1150109
Reviewed-by: Bryan Wu <pengw@nvidia.com>
Tested-by: Bryan Wu <pengw@nvidia.com>
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Jihoon Bang <jbang@nvidia.com>

3 years agodrivers: media: camera: Ring buffer management
Bhanu Murthy V [Sat, 16 Apr 2016 02:54:08 +0000]
drivers: media: camera: Ring buffer management

Implement ring buffer which holds two buffers
before delivering frames from VI. This is to
ensure there is no performance impact using
single thread and memory write of the buffer
is complete.

Add logic to store buffers at the start,
release one buffer every frame once the queue
has only one free slot left.

Free all buffers once the stop streaming
is signalled.
Clean up for two thread implementation and
improve state mechanism in single thread

Bug 200092604
Bug 1736471

Change-Id: Ia9784ee0c7925b5ec4dd6ca5f0b3354af8323662
Signed-off-by: Bhanu Murthy V <bmurthyv@nvidia.com>
(cherry picked from commit 39a3d10573140a98aea3b67044f056772fa2be9f)
Reviewed-on: http://git-master/r/1127760
Signed-off-by: Bryan Wu <pengw@nvidia.com>
Reviewed-on: http://git-master/r/1141924
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Jihoon Bang <jbang@nvidia.com>

3 years agodrivers: media: camera: CSI closure for hotplug
Bhanu Murthy V [Sun, 17 Apr 2016 01:33:33 +0000]
drivers: media: camera: CSI closure for hotplug

Adds required routine for CSI HW to reach
idle state after hotplug. Resolves the mc-err
and zero writing issue in case of resolution
change.

Bug 200092604
Bug 1736471

Change-Id: I265736b185c3de206edcae017703840ae006e368
Signed-off-by: Bhanu Murthy V <bmurthyv@nvidia.com>
(cherry picked from commit 96fa5e4ae547dbe7af15bbefd47d6118566da806)
Reviewed-on: http://git-master/r/1127813
Signed-off-by: Bryan Wu <pengw@nvidia.com>
Reviewed-on: http://git-master/r/1141922
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Jihoon Bang <jbang@nvidia.com>

3 years agodrivers: media: camera: Hotplug fixes
Bhanu Murthy V [Wed, 13 Apr 2016 19:47:40 +0000]
drivers: media: camera: Hotplug fixes

Add check to block immediate hotplug event being
processed before start of streaming.
Do sync point re-init to a clean state before
starting streaming.

Bug 200092604

Change-Id: I4be38edff61eb06e1bd52a63ba288610ca7bb52d
Signed-off-by: Bhanu Murthy V <bmurthyv@nvidia.com>
Signed-off-by: Jihoon Bang <jbang@nvidia.com>
(cherry picked from commit 1d76ef9f6822d88b2e486ecfb21429494e7abdff)
Reviewed-on: http://git-master/r/1126327
Signed-off-by: Bryan Wu <pengw@nvidia.com>
Reviewed-on: http://git-master/r/1141921
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit

3 years agomedia:platform:tegra: Add mipical in VI
Wenjia Zhou [Thu, 7 Apr 2016 23:21:41 +0000]
media:platform:tegra: Add mipical in VI

Call mipi calibration in start_streaming call

bug 1686313

Change-Id: Ifbfc5f9125e5c5fec0ad959da0b54ad6a05379c0
Signed-off-by: Wenjia Zhou <wenjiaz@nvidia.com>
(cherry picked from commit 0fecec602ec32b13ee1d6fdad72cf166cdbe166b)
Reviewed-on: http://git-master/r/1122127
Signed-off-by: Bryan Wu <pengw@nvidia.com>
Reviewed-on: http://git-master/r/1141916
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Jihoon Bang <jbang@nvidia.com>

3 years agomedia:platform:tegra: Aggregate VI LA BW
Wenjia Zhou [Wed, 13 Apr 2016 22:35:20 +0000]
media:platform:tegra: Aggregate VI LA BW

Add an aggregation function in tegra_vi. It will combine camera userspace VI LA
bw request and V4L2 usecase.

Bug 1736471

Change-Id: Ic9255cb4fdfc5260f1478bda622d8b43d3b8f447
Signed-off-by: Wenjia Zhou <wenjiaz@nvidia.com>
(cherry picked from commit 2deba04c9d680b17c31671548f792d0ae575f838)
Reviewed-on: http://git-master/r/1126384
Signed-off-by: Bryan Wu <pengw@nvidia.com>
Reviewed-on: http://git-master/r/1141907
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Jihoon Bang <jbang@nvidia.com>

3 years agomedia: tegra: adding enumerations to csi driver
Bryan Wu [Wed, 30 Mar 2016 23:57:22 +0000]
media: tegra: adding enumerations to csi driver

Adding support for enum_framesize and enum_frameinterval to csi driver.
Now just support TPG and need to revisit support for real sensors

Bug 1736471

Change-Id: I73ad38a394b44661a01e672ff16ef4fdf98140f5
Signed-off-by: David Wang <davidw@nvidia.com>
Signed-off-by: Bryan Wu <pengw@nvidia.com>
(cherry picked from commit c0f605b124b7fd0ca4502fb74c8d8f47e96bc48b)
Reviewed-on: http://git-master/r/1118014
Signed-off-by: Bryan Wu <pengw@nvidia.com>
Reviewed-on: http://git-master/r/1141904
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Jihoon Bang <jbang@nvidia.com>

3 years agomedia: tegra: return busy when tpg is opened
Bryan Wu [Mon, 4 Apr 2016 21:32:44 +0000]
media: tegra: return busy when tpg is opened

When TPG device channel is opened, openning a real sensor should get a
device busy failure and vice versa.

Bug 1736471

Change-Id: Idb2d68a96d1f5463f154e4604a310c133f127ac2
Signed-off-by: Bryan Wu <pengw@nvidia.com>
(cherry picked from commit 547df5f7ffbc0c420bd524cacfabbbc4355298de)
Reviewed-on: http://git-master/r/1119974
Signed-off-by: Bryan Wu <pengw@nvidia.com>
Reviewed-on: http://git-master/r/1141903
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Jihoon Bang <jbang@nvidia.com>

3 years agomedia: tegra: move TPG setup before bypass check
Bryan Wu [Fri, 1 Apr 2016 01:13:34 +0000]
media: tegra: move TPG setup before bypass check

Bypass mode doesn't want to treat TPG as a sepecial subdevice but
handle it as a normal sensor. So move TPG programming before bypass
check will setup TPG register in kernel even for bypass mode.

Bug 1736471

Change-Id: Ifaf829e55bf207e30fb1671b2f492deba0343ea6
Signed-off-by: Bryan Wu <pengw@nvidia.com>
(cherry picked from commit cd56a2248f435e62e9aec3e7c81e6f3f5029736c)
Reviewed-on: http://git-master/r/1119252
Signed-off-by: Bryan Wu <pengw@nvidia.com>
Reviewed-on: http://git-master/r/1141902
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Jihoon Bang <jbang@nvidia.com>

3 years agomedia: tegra: add completion sync
Bryan Wu [Fri, 8 Apr 2016 06:52:26 +0000]
media: tegra: add completion sync

When stop streaming, 2 kernel threads need synchronization. Using
completion framework in kernel to sync between kthreads.

Also remove lock and flags for HDMI unplug operation, which can be
achieved by completion sync.

Bug 1736471

Change-Id: I10df7499426a6d7b5489d836590f095f2d1baf12
Reviewed-on: http://git-master/r/1122379
Signed-off-by: Bryan Wu <pengw@nvidia.com>
Signed-off-by: Ahung Cheng <ahcheng@nvidia.com>
(cherry picked from commit 2caab0bb07458efecd8934493677477a129d5d5e)
Reviewed-on: http://git-master/r/1124256
Signed-off-by: Bryan Wu <pengw@nvidia.com>
Reviewed-on: http://git-master/r/1141898
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Jihoon Bang <jbang@nvidia.com>

3 years agomedia: tegra: revise tpg set/get_fmt ops
Ken Chang [Tue, 12 Apr 2016 08:00:48 +0000]
media: tegra: revise tpg set/get_fmt ops

Reuse the working *_mbus_fmt callbacks in set_fmt
and get_fmt pad ops.

This change also adds input_status callback, returns
the status based on the current tpg mode.

Bug 200184502

Change-Id: I9ad5f67465fa3d8a2d956d55e3c7cf5e08dd0cd7
Signed-off-by: Ken Chang <kenc@nvidia.com>
(cherry picked from commit 3131eba1e9a94c8666bd7ad726750d5573dd7880)
Reviewed-on: http://git-master/r/1124154
Signed-off-by: Bryan Wu <pengw@nvidia.com>
Reviewed-on: http://git-master/r/1141897
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Jihoon Bang <jbang@nvidia.com>

3 years agomedia: tegra: camera: revise try_fmt callback
Ken Chang [Thu, 7 Apr 2016 07:40:31 +0000]
media: tegra: camera: revise try_fmt callback

Return a supported format for invalid formats with return
code '0'. Return -EINVAL only for the mbus format code is
not supported.

Bug 200184502

Change-Id: Iaecb17162625fd70454143b436e841c36d8556d4
Signed-off-by: Ken Chang <kenc@nvidia.com>
(cherry picked from commit 9265594cf94bf7dfadb3a939428732ed65035166)
Reviewed-on: http://git-master/r/1121723
Signed-off-by: Bryan Wu <pengw@nvidia.com>
Reviewed-on: http://git-master/r/1141896
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Jihoon Bang <jbang@nvidia.com>