Re: [PATCH 8/9] fs/ext4: Introduce DAX inode flag
On Thu, May 14, 2020 at 08:43:35AM +0200, Jan Kara wrote: > On Wed 13-05-20 14:41:55, Ira Weiny wrote: > > On Wed, May 13, 2020 at 04:47:06PM +0200, Jan Kara wrote: > > > > > > So I think you'll have to check > > > whether DAX flag is being changed, > > > > ext4_dax_dontcache() does check if the flag is being changed. > > Yes, but if you call it after inode flags change, you cannot determine that > just from flags and EXT4_I(inode)->i_flags. So that logic needs to change. I just caught this email... just after sending V1. I've moved where ext4_dax_dontcache() is called. I think it is ok now with the current check. LMK if I've messed it up... :-/ Ira > > Honza > > -- > Jan Kara > SUSE Labs, CR
[PATCH V1 6/9] fs/ext4: Only change S_DAX on inode load
From: Ira Weiny To prevent complications with in memory inodes we only set S_DAX on inode load. FS_XFLAG_DAX can be changed at any time and S_DAX will change after inode eviction and reload. Add init bool to ext4_set_inode_flags() to indicate if the inode is being newly initialized. Assert that S_DAX is not set on an inode which is just being loaded. Reviewed-by: Jan Kara Signed-off-by: Ira Weiny --- Changes from RFC: Change J_ASSERT() to WARN_ON_ONCE() Fix bug which would clear S_DAX incorrectly --- fs/ext4/ext4.h | 2 +- fs/ext4/ialloc.c | 2 +- fs/ext4/inode.c | 13 ++--- fs/ext4/ioctl.c | 3 ++- fs/ext4/super.c | 4 ++-- fs/ext4/verity.c | 2 +- 6 files changed, 17 insertions(+), 9 deletions(-) diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index 1a3daf2d18ef..86a0994332ce 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h @@ -2692,7 +2692,7 @@ extern int ext4_can_truncate(struct inode *inode); extern int ext4_truncate(struct inode *); extern int ext4_break_layouts(struct inode *); extern int ext4_punch_hole(struct inode *inode, loff_t offset, loff_t length); -extern void ext4_set_inode_flags(struct inode *); +extern void ext4_set_inode_flags(struct inode *, bool init); extern int ext4_alloc_da_blocks(struct inode *inode); extern void ext4_set_aops(struct inode *inode); extern int ext4_writepage_trans_blocks(struct inode *); diff --git a/fs/ext4/ialloc.c b/fs/ext4/ialloc.c index 4b8c9a9bdf0c..7941c140723f 100644 --- a/fs/ext4/ialloc.c +++ b/fs/ext4/ialloc.c @@ -1116,7 +1116,7 @@ struct inode *__ext4_new_inode(handle_t *handle, struct inode *dir, ei->i_block_group = group; ei->i_last_alloc_group = ~0; - ext4_set_inode_flags(inode); + ext4_set_inode_flags(inode, true); if (IS_DIRSYNC(inode)) ext4_handle_sync(handle); if (insert_inode_locked(inode) < 0) { diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index d3a4c2ed7a1c..23e42a223235 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -4419,11 +4419,13 @@ static bool ext4_should_enable_dax(struct inode *inode) return false; } -void ext4_set_inode_flags(struct inode *inode) +void ext4_set_inode_flags(struct inode *inode, bool init) { unsigned int flags = EXT4_I(inode)->i_flags; unsigned int new_fl = 0; + WARN_ON_ONCE(IS_DAX(inode) && init); + if (flags & EXT4_SYNC_FL) new_fl |= S_SYNC; if (flags & EXT4_APPEND_FL) @@ -4434,8 +4436,13 @@ void ext4_set_inode_flags(struct inode *inode) new_fl |= S_NOATIME; if (flags & EXT4_DIRSYNC_FL) new_fl |= S_DIRSYNC; - if (ext4_should_enable_dax(inode)) + + /* Because of the way inode_set_flags() works we must preserve S_DAX +* here if already set. */ + new_fl |= (inode->i_flags & S_DAX); + if (init && ext4_should_enable_dax(inode)) new_fl |= S_DAX; + if (flags & EXT4_ENCRYPT_FL) new_fl |= S_ENCRYPTED; if (flags & EXT4_CASEFOLD_FL) @@ -4649,7 +4656,7 @@ struct inode *__ext4_iget(struct super_block *sb, unsigned long ino, * not initialized on a new filesystem. */ } ei->i_flags = le32_to_cpu(raw_inode->i_flags); - ext4_set_inode_flags(inode); + ext4_set_inode_flags(inode, true); inode->i_blocks = ext4_inode_blocks(raw_inode, ei); ei->i_file_acl = le32_to_cpu(raw_inode->i_file_acl_lo); if (ext4_has_feature_64bit(sb)) diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c index 5813e5e73eab..145083e8cd1e 100644 --- a/fs/ext4/ioctl.c +++ b/fs/ext4/ioctl.c @@ -381,7 +381,8 @@ static int ext4_ioctl_setflags(struct inode *inode, ext4_clear_inode_flag(inode, i); } - ext4_set_inode_flags(inode); + ext4_set_inode_flags(inode, false); + inode->i_ctime = current_time(inode); err = ext4_mark_iloc_dirty(handle, inode, &iloc); diff --git a/fs/ext4/super.c b/fs/ext4/super.c index d0434b513919..5ec900fdf73c 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -1344,7 +1344,7 @@ static int ext4_set_context(struct inode *inode, const void *ctx, size_t len, ext4_set_inode_flag(inode, EXT4_INODE_ENCRYPT); ext4_clear_inode_state(inode, EXT4_STATE_MAY_INLINE_DATA); - ext4_set_inode_flags(inode); + ext4_set_inode_flags(inode, false); } return res; } @@ -1367,7 +1367,7 @@ static int ext4_set_context(struct inode *inode, const void *ctx, size_t len, ctx, len, 0); if (!res) { ext4_set_inode_flag(inode, EXT4_INODE_ENCRYPT); - ext4_set_inode_flags(inode); + ext4_set_inode_flags(inode, false); res = ext4_mark_inode_dirty(handle, inode); if (res)
Re: [PATCH] kobject: Make sure the parent does not get released before its children
On Wed, May 13, 2020 at 04:14:51PM -0700, Randy Dunlap wrote: > On 5/13/20 2:30 PM, Brendan Higgins wrote: > > On Wed, May 13, 2020 at 8:18 AM Heikki Krogerus > > wrote: > >> > >> In the function kobject_cleanup(), kobject_del(kobj) is > >> called before the kobj->release(). That makes it possible to > >> release the parent of the kobject before the kobject itself. > >> > >> To fix that, adding function __kboject_del() that does > >> everything that kobject_del() does except release the parent > >> reference. kobject_cleanup() then calls __kobject_del() > >> instead of kobject_del(), and separately decrements the > >> reference count of the parent kobject after kobj->release() > >> has been called. > >> > >> Reported-by: Naresh Kamboju > >> Reported-by: kernel test robot > >> Fixes: 7589238a8cf3 ("Revert "software node: Simplify > >> software_node_release() function"") > >> Cc: Brendan Higgins > >> Cc: Randy Dunlap > >> Suggested-by: "Rafael J. Wysocki" > >> Signed-off-by: Heikki Krogerus > > > > Reviewed-by: Brendan Higgins > > Tested-by: Brendan Higgins > > > > Acked-by: Randy Dunlap > Tested-by: Randy Dunlap Thanks guys. Sorry about the mix-up. Br, -- heikki
[PATCH V1 2/9] fs/ext4: Disallow verity if inode is DAX
From: Ira Weiny Verity and DAX are incompatible. Changing the DAX mode due to a verity flag change is wrong without a corresponding address_space_operations update. Make the 2 options mutually exclusive by returning an error if DAX was set first. (Setting DAX is already disabled if Verity is set first.) Signed-off-by: Ira Weiny --- Changes: remove WARN_ON_ONCE Add documentation for DAX/Verity exclusivity --- Documentation/filesystems/ext4/verity.rst | 7 +++ fs/ext4/verity.c | 3 +++ 2 files changed, 10 insertions(+) diff --git a/Documentation/filesystems/ext4/verity.rst b/Documentation/filesystems/ext4/verity.rst index 3e4c0ee0e068..51ab1aa17e59 100644 --- a/Documentation/filesystems/ext4/verity.rst +++ b/Documentation/filesystems/ext4/verity.rst @@ -39,3 +39,10 @@ is encrypted as well as the data itself. Verity files cannot have blocks allocated past the end of the verity metadata. + +Verity and DAX +-- + +Verity and DAX are not compatible and attempts to set both of these flags on a +file will fail. + diff --git a/fs/ext4/verity.c b/fs/ext4/verity.c index dc5ec724d889..f05a09fb2ae4 100644 --- a/fs/ext4/verity.c +++ b/fs/ext4/verity.c @@ -113,6 +113,9 @@ static int ext4_begin_enable_verity(struct file *filp) handle_t *handle; int err; + if (IS_DAX(inode)) + return -EINVAL; + if (ext4_verity_in_progress(inode)) return -EBUSY; -- 2.25.1
[PATCH V1 1/9] fs/ext4: Narrow scope of DAX check in setflags
From: Ira Weiny When preventing DAX and journaling on an inode. Use the effective DAX check rather than the mount option. This will be required to support per inode DAX flags. Reviewed-by: Jan Kara Signed-off-by: Ira Weiny --- fs/ext4/ioctl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c index bfc1281fc4cb..5813e5e73eab 100644 --- a/fs/ext4/ioctl.c +++ b/fs/ext4/ioctl.c @@ -393,9 +393,9 @@ static int ext4_ioctl_setflags(struct inode *inode, if ((jflag ^ oldflags) & (EXT4_JOURNAL_DATA_FL)) { /* * Changes to the journaling mode can cause unsafe changes to -* S_DAX if we are using the DAX mount option. +* S_DAX if the inode is DAX */ - if (test_opt(inode->i_sb, DAX)) { + if (IS_DAX(inode)) { err = -EBUSY; goto flags_out; } -- 2.25.1
[PATCH V1 3/9] fs/ext4: Disallow encryption if inode is DAX
From: Ira Weiny Encryption and DAX are incompatible. Changing the DAX mode due to a change in Encryption mode is wrong without a corresponding address_space_operations update. Make the 2 options mutually exclusive by returning an error if DAX was set first. Furthermore, clarify the documentation of the exclusivity and how that will work. Signed-off-by: Ira Weiny --- Changes: remove WARN_ON_ONCE Add documentation to the encrypt doc WRT DAX --- Documentation/filesystems/fscrypt.rst | 4 +++- fs/ext4/super.c | 10 +- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/Documentation/filesystems/fscrypt.rst b/Documentation/filesystems/fscrypt.rst index aa072112cfff..1475b8d52fef 100644 --- a/Documentation/filesystems/fscrypt.rst +++ b/Documentation/filesystems/fscrypt.rst @@ -1038,7 +1038,9 @@ astute users may notice some differences in behavior: - The ext4 filesystem does not support data journaling with encrypted regular files. It will fall back to ordered data mode instead. -- DAX (Direct Access) is not supported on encrypted files. +- DAX (Direct Access) is not supported on encrypted files. Attempts to enable + DAX on an encrypted file will fail. Mount options will _not_ enable DAX on + encrypted files. - The st_size of an encrypted symlink will not necessarily give the length of the symlink target as required by POSIX. It will actually diff --git a/fs/ext4/super.c b/fs/ext4/super.c index bf5fcb477f66..9873ab27e3fa 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -1320,7 +1320,7 @@ static int ext4_set_context(struct inode *inode, const void *ctx, size_t len, if (inode->i_ino == EXT4_ROOT_INO) return -EPERM; - if (WARN_ON_ONCE(IS_DAX(inode) && i_size_read(inode))) + if (IS_DAX(inode)) return -EINVAL; res = ext4_convert_inline_data(inode); @@ -1344,10 +1344,6 @@ static int ext4_set_context(struct inode *inode, const void *ctx, size_t len, ext4_set_inode_flag(inode, EXT4_INODE_ENCRYPT); ext4_clear_inode_state(inode, EXT4_STATE_MAY_INLINE_DATA); - /* -* Update inode->i_flags - S_ENCRYPTED will be enabled, -* S_DAX may be disabled -*/ ext4_set_inode_flags(inode); } return res; @@ -1371,10 +1367,6 @@ static int ext4_set_context(struct inode *inode, const void *ctx, size_t len, ctx, len, 0); if (!res) { ext4_set_inode_flag(inode, EXT4_INODE_ENCRYPT); - /* -* Update inode->i_flags - S_ENCRYPTED will be enabled, -* S_DAX may be disabled -*/ ext4_set_inode_flags(inode); res = ext4_mark_inode_dirty(handle, inode); if (res) -- 2.25.1
[PATCH V1 7/9] fs/ext4: Make DAX mount option a tri-state
From: Ira Weiny We add 'always', 'never', and 'inode' (default). '-o dax' continue to operate the same. Specifically we introduce a 2nd DAX mount flag EXT4_MOUNT2_DAX_NEVER and set it and EXT4_MOUNT_DAX_ALWAYS appropriately. We also force EXT4_MOUNT2_DAX_NEVER if !CONFIG_FS_DAX. https://lore.kernel.org/lkml/20200405061945.ga94...@iweiny-desk2.sc.intel.com/ Signed-off-by: Ira Weiny --- Changes from RFC: Combine remount check for DAX_NEVER with DAX_ALWAYS Update ext4_should_enable_dax() --- fs/ext4/ext4.h | 1 + fs/ext4/inode.c | 2 ++ fs/ext4/super.c | 43 +-- 3 files changed, 40 insertions(+), 6 deletions(-) diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index 86a0994332ce..01d1de838896 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h @@ -1168,6 +1168,7 @@ struct ext4_inode_info { blocks */ #define EXT4_MOUNT2_HURD_COMPAT0x0004 /* Support HURD-castrated file systems */ +#define EXT4_MOUNT2_DAX_NEVER 0x0008 /* Do not allow Direct Access */ #define EXT4_MOUNT2_EXPLICIT_JOURNAL_CHECKSUM 0x0008 /* User explicitly specified journal checksum */ diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 23e42a223235..140b1930e2f4 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -4400,6 +4400,8 @@ int ext4_get_inode_loc(struct inode *inode, struct ext4_iloc *iloc) static bool ext4_should_enable_dax(struct inode *inode) { + if (test_opt2(inode->i_sb, DAX_NEVER)) + return false; if (!S_ISREG(inode->i_mode)) return false; if (ext4_should_journal_data(inode)) diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 5ec900fdf73c..e01a040a58a9 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -1505,6 +1505,7 @@ enum { Opt_jqfmt_vfsold, Opt_jqfmt_vfsv0, Opt_jqfmt_vfsv1, Opt_quota, Opt_noquota, Opt_barrier, Opt_nobarrier, Opt_err, Opt_usrquota, Opt_grpquota, Opt_prjquota, Opt_i_version, Opt_dax, + Opt_dax_str, Opt_stripe, Opt_delalloc, Opt_nodelalloc, Opt_warn_on_error, Opt_nowarn_on_error, Opt_mblk_io_submit, Opt_lazytime, Opt_nolazytime, Opt_debug_want_extra_isize, @@ -1570,6 +1571,7 @@ static const match_table_t tokens = { {Opt_barrier, "barrier"}, {Opt_nobarrier, "nobarrier"}, {Opt_i_version, "i_version"}, + {Opt_dax_str, "dax=%s"}, {Opt_dax, "dax"}, {Opt_stripe, "stripe=%u"}, {Opt_delalloc, "delalloc"}, @@ -1767,6 +1769,7 @@ static const struct mount_opts { {Opt_min_batch_time, 0, MOPT_GTE0}, {Opt_inode_readahead_blks, 0, MOPT_GTE0}, {Opt_init_itable, 0, MOPT_GTE0}, + {Opt_dax_str, 0, MOPT_STRING}, {Opt_dax, EXT4_MOUNT_DAX_ALWAYS, MOPT_SET}, {Opt_stripe, 0, MOPT_GTE0}, {Opt_resuid, 0, MOPT_GTE0}, @@ -2076,13 +2079,32 @@ static int handle_mount_opt(struct super_block *sb, char *opt, int token, } sbi->s_jquota_fmt = m->mount_opt; #endif - } else if (token == Opt_dax) { + } else if (token == Opt_dax || token == Opt_dax_str) { #ifdef CONFIG_FS_DAX - ext4_msg(sb, KERN_WARNING, - "DAX enabled. Warning: EXPERIMENTAL, use at your own risk"); - sbi->s_mount_opt |= m->mount_opt; + char *tmp = match_strdup(&args[0]); + + if (!tmp || !strcmp(tmp, "always")) { + ext4_msg(sb, KERN_WARNING, + "DAX enabled. Warning: EXPERIMENTAL, use at your own risk"); + sbi->s_mount_opt |= EXT4_MOUNT_DAX_ALWAYS; + sbi->s_mount_opt2 &= ~EXT4_MOUNT2_DAX_NEVER; + } else if (!strcmp(tmp, "never")) { + sbi->s_mount_opt2 |= EXT4_MOUNT2_DAX_NEVER; + sbi->s_mount_opt &= ~EXT4_MOUNT_DAX_ALWAYS; + } else if (!strcmp(tmp, "inode")) { + sbi->s_mount_opt &= ~EXT4_MOUNT_DAX_ALWAYS; + sbi->s_mount_opt2 &= ~EXT4_MOUNT2_DAX_NEVER; + } else { + ext4_msg(sb, KERN_WARNING, "DAX invalid option."); + kfree(tmp); + return -1; + } + + kfree(tmp); #else ext4_msg(sb, KERN_INFO, "dax option not supported"); + sbi->s_mount_opt2 |= EXT4_MOUNT2_DAX_NEVER; + sbi->s_mount_opt &= ~EXT4_MOUNT_DAX_ALWAYS; return -1; #endif } else if (token == Opt_data_err_abort) { @@ -2306,6 +2328,13 @@ static int _ext4_show_options(struct seq_file *seq, struct super_block *sb, if (DUMMY_ENCRYPTION_ENABLED(sbi)) SEQ_OPTS_PUTS("test_dummy_encryption"); + if (test_opt2(sb, DAX_NEVER)) +
[PATCH V1 0/9] Enable ext4 support for per-file/directory DAX operations
From: Ira Weiny Enable the same per file DAX support in ext4 as was done for xfs. This series builds and depends on the V11 series for xfs.[1] This passes the same xfstests test as XFS. The only issue is that this modifies the old mount option parsing code rather than waiting for the new parsing code to be finalized. This series starts with 3 fixes which include making Verity and Encrypt truly mutually exclusive from DAX. I think these first 3 patches should be picked up for 5.8 regardless of what is decided regarding the mount parsing. [1] https://lore.kernel.org/lkml/20200428002142.404144-1-ira.we...@intel.com/ Changes from V0: Collect reviews Fix up setting don't cache in ioctl code Add FS_DAX_FL flag for consistency To: linux-e...@vger.kernel.org To: "Theodore Y. Ts'o" To: Jan Kara Cc: "Darrick J. Wong" Cc: Dan Williams Cc: Dave Chinner Cc: Christoph Hellwig Cc: linux-kernel@vger.kernel.org Cc: linux-...@vger.kernel.org Cc: linux-fsde...@vger.kernel.org Ira Weiny (9): fs/ext4: Narrow scope of DAX check in setflags fs/ext4: Disallow verity if inode is DAX fs/ext4: Disallow encryption if inode is DAX fs/ext4: Change EXT4_MOUNT_DAX to EXT4_MOUNT_DAX_ALWAYS fs/ext4: Update ext4_should_use_dax() fs/ext4: Only change S_DAX on inode load fs/ext4: Make DAX mount option a tri-state fs/ext4: Introduce DAX inode flag Documentation/dax: Update DAX enablement for ext4 Documentation/filesystems/dax.txt | 6 +- Documentation/filesystems/ext4/verity.rst | 7 +++ Documentation/filesystems/fscrypt.rst | 4 +- fs/ext4/ext4.h| 20 --- fs/ext4/ialloc.c | 2 +- fs/ext4/inode.c | 27 +++-- fs/ext4/ioctl.c | 31 +-- fs/ext4/super.c | 67 +++ fs/ext4/verity.c | 5 +- include/uapi/linux/fs.h | 1 + 10 files changed, 125 insertions(+), 45 deletions(-) -- 2.25.1
[PATCH V1 4/9] fs/ext4: Change EXT4_MOUNT_DAX to EXT4_MOUNT_DAX_ALWAYS
From: Ira Weiny In prep for the new tri-state mount option which then introduces EXT4_MOUNT_DAX_NEVER. Reviewed-by: Jan Kara Signed-off-by: Ira Weiny --- Changes: New patch --- fs/ext4/ext4.h | 4 ++-- fs/ext4/inode.c | 2 +- fs/ext4/super.c | 12 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index 91eb4381cae5..1a3daf2d18ef 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h @@ -1123,9 +1123,9 @@ struct ext4_inode_info { #define EXT4_MOUNT_MINIX_DF0x00080 /* Mimics the Minix statfs */ #define EXT4_MOUNT_NOLOAD 0x00100 /* Don't use existing journal*/ #ifdef CONFIG_FS_DAX -#define EXT4_MOUNT_DAX 0x00200 /* Direct Access */ +#define EXT4_MOUNT_DAX_ALWAYS 0x00200 /* Direct Access */ #else -#define EXT4_MOUNT_DAX 0 +#define EXT4_MOUNT_DAX_ALWAYS 0 #endif #define EXT4_MOUNT_DATA_FLAGS 0x00C00 /* Mode for data writes: */ #define EXT4_MOUNT_JOURNAL_DATA0x00400 /* Write data to journal */ diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 2a4aae6acdcb..a10ff12194db 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -4400,7 +4400,7 @@ int ext4_get_inode_loc(struct inode *inode, struct ext4_iloc *iloc) static bool ext4_should_use_dax(struct inode *inode) { - if (!test_opt(inode->i_sb, DAX)) + if (!test_opt(inode->i_sb, DAX_ALWAYS)) return false; if (!S_ISREG(inode->i_mode)) return false; diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 9873ab27e3fa..d0434b513919 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -1767,7 +1767,7 @@ static const struct mount_opts { {Opt_min_batch_time, 0, MOPT_GTE0}, {Opt_inode_readahead_blks, 0, MOPT_GTE0}, {Opt_init_itable, 0, MOPT_GTE0}, - {Opt_dax, EXT4_MOUNT_DAX, MOPT_SET}, + {Opt_dax, EXT4_MOUNT_DAX_ALWAYS, MOPT_SET}, {Opt_stripe, 0, MOPT_GTE0}, {Opt_resuid, 0, MOPT_GTE0}, {Opt_resgid, 0, MOPT_GTE0}, @@ -3974,7 +3974,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) "both data=journal and dioread_nolock"); goto failed_mount; } - if (test_opt(sb, DAX)) { + if (test_opt(sb, DAX_ALWAYS)) { ext4_msg(sb, KERN_ERR, "can't mount with " "both data=journal and dax"); goto failed_mount; @@ -4084,7 +4084,7 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) goto failed_mount; } - if (sbi->s_mount_opt & EXT4_MOUNT_DAX) { + if (sbi->s_mount_opt & EXT4_MOUNT_DAX_ALWAYS) { if (ext4_has_feature_inline_data(sb)) { ext4_msg(sb, KERN_ERR, "Cannot use DAX on a filesystem" " that may contain inline data"); @@ -5404,7 +5404,7 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data) err = -EINVAL; goto restore_opts; } - if (test_opt(sb, DAX)) { + if (test_opt(sb, DAX_ALWAYS)) { ext4_msg(sb, KERN_ERR, "can't mount with " "both data=journal and dax"); err = -EINVAL; @@ -5425,10 +5425,10 @@ static int ext4_remount(struct super_block *sb, int *flags, char *data) goto restore_opts; } - if ((sbi->s_mount_opt ^ old_opts.s_mount_opt) & EXT4_MOUNT_DAX) { + if ((sbi->s_mount_opt ^ old_opts.s_mount_opt) & EXT4_MOUNT_DAX_ALWAYS) { ext4_msg(sb, KERN_WARNING, "warning: refusing change of " "dax flag with busy inodes while remounting"); - sbi->s_mount_opt ^= EXT4_MOUNT_DAX; + sbi->s_mount_opt ^= EXT4_MOUNT_DAX_ALWAYS; } if (sbi->s_mount_flags & EXT4_MF_FS_ABORTED) -- 2.25.1
[PATCH V1 8/9] fs/ext4: Introduce DAX inode flag
From: Ira Weiny Add a flag to preserve FS_XFLAG_DAX in the ext4 inode. Set the flag to be user visible and changeable. Set the flag to be inherited. Allow applications to change the flag at any time. Finally, on regular files, flag the inode to not be cached to facilitate changing S_DAX on the next creation of the inode. Signed-off-by: Ira Weiny --- Change from V0: Add FS_DAX_FL to include/uapi/linux/fs.h to be consistent Move ext4_dax_dontcache() to ext4_ioctl_setflags() This ensures that it is only set when the flags are going to be set and not if there is an error Also this sets don't cache in the FS_IOC_SETFLAGS case Change from RFC: use new d_mark_dontcache() Allow caching if ALWAYS/NEVER is set Rebased to latest Linus master Change flag to unused 0x0100 update ext4_should_enable_dax() --- fs/ext4/ext4.h | 13 + fs/ext4/inode.c | 4 +++- fs/ext4/ioctl.c | 24 +++- include/uapi/linux/fs.h | 1 + 4 files changed, 36 insertions(+), 6 deletions(-) diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index 01d1de838896..715f8f2029b2 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h @@ -415,13 +415,16 @@ struct flex_groups { #define EXT4_VERITY_FL 0x0010 /* Verity protected inode */ #define EXT4_EA_INODE_FL 0x0020 /* Inode used for large EA */ /* 0x0040 was formerly EXT4_EOFBLOCKS_FL */ + +#define EXT4_DAX_FL0x0100 /* Inode is DAX */ + #define EXT4_INLINE_DATA_FL0x1000 /* Inode has inline data. */ #define EXT4_PROJINHERIT_FL0x2000 /* Create with parents projid */ #define EXT4_CASEFOLD_FL 0x4000 /* Casefolded file */ #define EXT4_RESERVED_FL 0x8000 /* reserved for ext4 lib */ -#define EXT4_FL_USER_VISIBLE 0x705BDFFF /* User visible flags */ -#define EXT4_FL_USER_MODIFIABLE0x604BC0FF /* User modifiable flags */ +#define EXT4_FL_USER_VISIBLE 0x715BDFFF /* User visible flags */ +#define EXT4_FL_USER_MODIFIABLE0x614BC0FF /* User modifiable flags */ /* Flags we can manipulate with through EXT4_IOC_FSSETXATTR */ #define EXT4_FL_XFLAG_VISIBLE (EXT4_SYNC_FL | \ @@ -429,14 +432,16 @@ struct flex_groups { EXT4_APPEND_FL | \ EXT4_NODUMP_FL | \ EXT4_NOATIME_FL | \ -EXT4_PROJINHERIT_FL) +EXT4_PROJINHERIT_FL | \ +EXT4_DAX_FL) /* Flags that should be inherited by new inodes from their parent. */ #define EXT4_FL_INHERITED (EXT4_SECRM_FL | EXT4_UNRM_FL | EXT4_COMPR_FL |\ EXT4_SYNC_FL | EXT4_NODUMP_FL | EXT4_NOATIME_FL |\ EXT4_NOCOMPR_FL | EXT4_JOURNAL_DATA_FL |\ EXT4_NOTAIL_FL | EXT4_DIRSYNC_FL |\ - EXT4_PROJINHERIT_FL | EXT4_CASEFOLD_FL) + EXT4_PROJINHERIT_FL | EXT4_CASEFOLD_FL |\ + EXT4_DAX_FL) /* Flags that are appropriate for regular files (all but dir-specific ones). */ #define EXT4_REG_FLMASK (~(EXT4_DIRSYNC_FL | EXT4_TOPDIR_FL | EXT4_CASEFOLD_FL |\ diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 140b1930e2f4..105cf04f7940 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -4400,6 +4400,8 @@ int ext4_get_inode_loc(struct inode *inode, struct ext4_iloc *iloc) static bool ext4_should_enable_dax(struct inode *inode) { + unsigned int flags = EXT4_I(inode)->i_flags; + if (test_opt2(inode->i_sb, DAX_NEVER)) return false; if (!S_ISREG(inode->i_mode)) @@ -4418,7 +4420,7 @@ static bool ext4_should_enable_dax(struct inode *inode) if (test_opt(inode->i_sb, DAX_ALWAYS)) return true; - return false; + return flags & EXT4_DAX_FL; } void ext4_set_inode_flags(struct inode *inode, bool init) diff --git a/fs/ext4/ioctl.c b/fs/ext4/ioctl.c index 145083e8cd1e..d6d018ea8e94 100644 --- a/fs/ext4/ioctl.c +++ b/fs/ext4/ioctl.c @@ -292,6 +292,21 @@ static int ext4_ioctl_check_immutable(struct inode *inode, __u32 new_projid, return 0; } +static void ext4_dax_dontcache(struct inode *inode, unsigned int flags) +{ + struct ext4_inode_info *ei = EXT4_I(inode); + + if (S_ISDIR(inode->i_mode)) + return; + + if (test_opt2(inode->i_sb, DAX_NEVER) || + test_opt(inode->i_sb, DAX_ALWAYS)) + return; + + if ((ei->i_flags ^ flags) & EXT4_DAX_FL) + d_mark_dontcache(inode); +} + static int ext4_ioctl_setflags(struct inode *inode, unsigned int flags) { @@ -369,6
[PATCH V1 5/9] fs/ext4: Update ext4_should_use_dax()
From: Ira Weiny S_DAX should only be enabled when the underlying block device supports dax. Change ext4_should_use_dax() to check for device support prior to the over riding mount option. While we are at it change the function to ext4_should_enable_dax() as this better reflects the ask as well as matches xfs. Reviewed-by: Jan Kara Signed-off-by: Ira Weiny --- Changes from RFC Change function name to 'should enable' Clean up bool conversion Reorder this for better bisect-ability --- fs/ext4/inode.c | 14 +- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index a10ff12194db..d3a4c2ed7a1c 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c @@ -4398,10 +4398,8 @@ int ext4_get_inode_loc(struct inode *inode, struct ext4_iloc *iloc) !ext4_test_inode_state(inode, EXT4_STATE_XATTR)); } -static bool ext4_should_use_dax(struct inode *inode) +static bool ext4_should_enable_dax(struct inode *inode) { - if (!test_opt(inode->i_sb, DAX_ALWAYS)) - return false; if (!S_ISREG(inode->i_mode)) return false; if (ext4_should_journal_data(inode)) @@ -4412,7 +4410,13 @@ static bool ext4_should_use_dax(struct inode *inode) return false; if (ext4_test_inode_flag(inode, EXT4_INODE_VERITY)) return false; - return true; + if (!bdev_dax_supported(inode->i_sb->s_bdev, + inode->i_sb->s_blocksize)) + return false; + if (test_opt(inode->i_sb, DAX_ALWAYS)) + return true; + + return false; } void ext4_set_inode_flags(struct inode *inode) @@ -4430,7 +4434,7 @@ void ext4_set_inode_flags(struct inode *inode) new_fl |= S_NOATIME; if (flags & EXT4_DIRSYNC_FL) new_fl |= S_DIRSYNC; - if (ext4_should_use_dax(inode)) + if (ext4_should_enable_dax(inode)) new_fl |= S_DAX; if (flags & EXT4_ENCRYPT_FL) new_fl |= S_ENCRYPTED; -- 2.25.1
Re: [PATCH] net: stmmac: fix num_por initialization
On Thu, May 14, 2020 at 11:59 AM Vinod Koul wrote: > > Driver missed initializing num_por which is por values that driver Nit: s/is/is one of the/ ? > configures to hardware. In order to get this values, add a new structure Nit: s/this/these > ethqos_emac_driver_data which holds por and num_por values and populate > that in driver probe. > > Fixes: a7c30e62d4b8 ("net: stmmac: Add driver for Qualcomm ethqos") > Reported-by: Rahul Ankushrao Kawadgave > Signed-off-by: Vinod Koul Otherwise, Reviewed-by: Amit Kucheria > --- > .../ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c | 17 +++-- > 1 file changed, 15 insertions(+), 2 deletions(-) > > diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c > b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c > index e0a5fe83d8e0..bfc4a92f1d92 100644 > --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c > +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c > @@ -75,6 +75,11 @@ struct ethqos_emac_por { > unsigned int value; > }; > > +struct ethqos_emac_driver_data { > + const struct ethqos_emac_por *por; > + unsigned int num_por; > +}; > + > struct qcom_ethqos { > struct platform_device *pdev; > void __iomem *rgmii_base; > @@ -171,6 +176,11 @@ static const struct ethqos_emac_por emac_v2_3_0_por[] = { > { .offset = RGMII_IO_MACRO_CONFIG2, .value = 0x2060 }, > }; > > +static const struct ethqos_emac_driver_data emac_v2_3_0_data = { > + .por = emac_v2_3_0_por, > + .num_por = ARRAY_SIZE(emac_v2_3_0_por), > +}; > + > static int ethqos_dll_configure(struct qcom_ethqos *ethqos) > { > unsigned int val; > @@ -442,6 +452,7 @@ static int qcom_ethqos_probe(struct platform_device *pdev) > struct device_node *np = pdev->dev.of_node; > struct plat_stmmacenet_data *plat_dat; > struct stmmac_resources stmmac_res; > + const struct ethqos_emac_driver_data *data; > struct qcom_ethqos *ethqos; > struct resource *res; > int ret; > @@ -471,7 +482,9 @@ static int qcom_ethqos_probe(struct platform_device *pdev) > goto err_mem; > } > > - ethqos->por = of_device_get_match_data(&pdev->dev); > + data = of_device_get_match_data(&pdev->dev); > + ethqos->por = data->por; > + ethqos->num_por = data->num_por; > > ethqos->rgmii_clk = devm_clk_get(&pdev->dev, "rgmii"); > if (IS_ERR(ethqos->rgmii_clk)) { > @@ -526,7 +539,7 @@ static int qcom_ethqos_remove(struct platform_device > *pdev) > } > > static const struct of_device_id qcom_ethqos_match[] = { > - { .compatible = "qcom,qcs404-ethqos", .data = &emac_v2_3_0_por}, > + { .compatible = "qcom,qcs404-ethqos", .data = &emac_v2_3_0_data}, > { } > }; > MODULE_DEVICE_TABLE(of, qcom_ethqos_match); > -- > 2.25.4 >
[PATCH V1 9/9] Documentation/dax: Update DAX enablement for ext4
From: Ira Weiny Update the document to reflect ext4 and xfs now behave the same. Signed-off-by: Ira Weiny --- Changes from RFC: Update with ext2 text... --- Documentation/filesystems/dax.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Documentation/filesystems/dax.txt b/Documentation/filesystems/dax.txt index 735fb4b54117..265c4f808dbf 100644 --- a/Documentation/filesystems/dax.txt +++ b/Documentation/filesystems/dax.txt @@ -25,7 +25,7 @@ size when creating the filesystem. Currently 3 filesystems support DAX: ext2, ext4 and xfs. Enabling DAX on them is different. -Enabling DAX on ext4 and ext2 +Enabling DAX on ext2 - When mounting the filesystem, use the "-o dax" option on the command line or @@ -33,8 +33,8 @@ add 'dax' to the options in /etc/fstab. This works to enable DAX on all files within the filesystem. It is equivalent to the '-o dax=always' behavior below. -Enabling DAX on xfs +Enabling DAX on xfs and ext4 + Summary --- -- 2.25.1
mm/memory.c: Add update local tlb for smp race
If there are two threads hitting page fault at the address, one thread updates pte entry and local tlb, the other thread can update local tlb also, rather than give up and let page fault happening again. modified: mm/memory.c Signed-off-by: Bibo Mao --- mm/memory.c | 30 ++ 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/mm/memory.c b/mm/memory.c index f703fe8..3a741ce 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -2436,11 +2436,10 @@ static inline bool cow_user_page(struct page *dst, struct page *src, if (!likely(pte_same(*vmf->pte, vmf->orig_pte))) { /* * Other thread has already handled the fault -* and we don't need to do anything. If it's -* not the case, the fault will be triggered -* again on the same address. +* and update local tlb only */ ret = false; + update_mmu_cache(vma, addr, vmf->pte); goto pte_unlock; } @@ -2463,8 +2462,9 @@ static inline bool cow_user_page(struct page *dst, struct page *src, vmf->pte = pte_offset_map_lock(mm, vmf->pmd, addr, &vmf->ptl); locked = true; if (!likely(pte_same(*vmf->pte, vmf->orig_pte))) { - /* The PTE changed under us. Retry page fault. */ + /* The PTE changed under us. update local tlb */ ret = false; + update_mmu_cache(vma, addr, vmf->pte); goto pte_unlock; } @@ -2704,6 +2704,7 @@ static vm_fault_t wp_page_copy(struct vm_fault *vmf) } flush_cache_page(vma, vmf->address, pte_pfn(vmf->orig_pte)); entry = mk_pte(new_page, vma->vm_page_prot); + entry = pte_mkyoung(entry); entry = maybe_mkwrite(pte_mkdirty(entry), vma); /* * Clear the pte entry and flush it first, before updating the @@ -2752,6 +2753,7 @@ static vm_fault_t wp_page_copy(struct vm_fault *vmf) new_page = old_page; page_copied = 1; } else { + update_mmu_cache(vma, vmf->address, vmf->pte); mem_cgroup_cancel_charge(new_page, memcg, false); } @@ -2812,6 +2814,7 @@ vm_fault_t finish_mkwrite_fault(struct vm_fault *vmf) * pte_offset_map_lock. */ if (!pte_same(*vmf->pte, vmf->orig_pte)) { + update_mmu_cache(vmf->vma, vmf->address, vmf->pte); pte_unmap_unlock(vmf->pte, vmf->ptl); return VM_FAULT_NOPAGE; } @@ -2936,6 +2939,7 @@ static vm_fault_t do_wp_page(struct vm_fault *vmf) vmf->pte = pte_offset_map_lock(vma->vm_mm, vmf->pmd, vmf->address, &vmf->ptl); if (!pte_same(*vmf->pte, vmf->orig_pte)) { + update_mmu_cache(vma, vmf->address, vmf->pte); unlock_page(vmf->page); pte_unmap_unlock(vmf->pte, vmf->ptl); put_page(vmf->page); @@ -3341,8 +3345,10 @@ static vm_fault_t do_anonymous_page(struct vm_fault *vmf) vma->vm_page_prot)); vmf->pte = pte_offset_map_lock(vma->vm_mm, vmf->pmd, vmf->address, &vmf->ptl); - if (!pte_none(*vmf->pte)) + if (!pte_none(*vmf->pte)) { + update_mmu_cache(vma, vmf->address, vmf->pte); goto unlock; + } ret = check_stable_address_space(vma->vm_mm); if (ret) goto unlock; @@ -3373,13 +3379,16 @@ static vm_fault_t do_anonymous_page(struct vm_fault *vmf) __SetPageUptodate(page); entry = mk_pte(page, vma->vm_page_prot); + entry = pte_mkyoung(entry); if (vma->vm_flags & VM_WRITE) entry = pte_mkwrite(pte_mkdirty(entry)); vmf->pte = pte_offset_map_lock(vma->vm_mm, vmf->pmd, vmf->address, &vmf->ptl); - if (!pte_none(*vmf->pte)) + if (!pte_none(*vmf->pte)) { + update_mmu_cache(vma, vmf->address, vmf->pte); goto release; + } ret = check_stable_address_space(vma->vm_mm); if (ret) @@ -3646,11 +3655,14 @@ vm_fault_t alloc_set_pte(struct vm_fault *vmf, struct mem_cgroup *memcg, } /* Re-check under ptl */ - if (unlikely(!pte_none(*vmf->pte))) + if (unlikely(!pte_none(*vmf->pte))) { + update_mmu_cache(vma, vmf->address, vmf->pte); return VM_FAULT_NOPAGE; + } flush_ic
Re: [virtio-dev] [PATCH v3 00/15] virtio-mem: paravirtualized memory
Hi David, I got a kernel warning with v2 and v3. // start a QEMU that is get from https://github.com/davidhildenbrand/qemu/tree/virtio-mem-v2 and setup a file as a ide disk. /home/teawater/qemu/qemu/x86_64-softmmu/qemu-system-x86_64 -machine pc-i440fx-2.1,accel=kvm,usb=off -cpu host -no-reboot -nographic -device ide-hd,drive=hd -drive if=none,id=hd,file=/home/teawater/old.img,format=raw -kernel /home/teawater/kernel/bk2/arch/x86/boot/bzImage -append "console=ttyS0 root=/dev/sda nokaslr swiotlb=noforce" -m 1g,slots=10,maxmem=2G -smp 1 -s -monitor unix:/home/teawater/qemu/m,server,nowait // Setup virtio-mem and plug 256m memory in qemu monitor: object_add memory-backend-ram,id=mem1,size=256m device_add virtio-mem-pci,id=vm0,memdev=mem1 qom-set vm0 requested-size 256M // Go back to the terminal and access file system will got following kernel warning. [ 19.515549] pci :00:04.0: [1af4:1015] type 00 class 0x00ff00 [ 19.516227] pci :00:04.0: reg 0x10: [io 0x-0x007f] [ 19.517196] pci :00:04.0: BAR 0: assigned [io 0x1000-0x107f] [ 19.517843] virtio-pci :00:04.0: enabling device ( -> 0001) [ 19.535957] PCI Interrupt Link [LNKD] enabled at IRQ 11 [ 19.536507] virtio-pci :00:04.0: virtio_pci: leaving for legacy driver [ 19.537528] virtio_mem virtio0: start address: 0x1 [ 19.538094] virtio_mem virtio0: region size: 0x1000 [ 19.538621] virtio_mem virtio0: device block size: 0x20 [ 19.539186] virtio_mem virtio0: memory block size: 0x800 [ 19.539752] virtio_mem virtio0: subblock size: 0x40 [ 19.540357] virtio_mem virtio0: plugged size: 0x0 [ 19.540834] virtio_mem virtio0: requested size: 0x0 [ 20.170441] virtio_mem virtio0: plugged size: 0x0 [ 20.170933] virtio_mem virtio0: requested size: 0x1000 [ 20.172247] Built 1 zonelists, mobility grouping on. Total pages: 266012 [ 20.172955] Policy zone: Normal / # ls [ 26.724565] [ cut here ] [ 26.725047] ata_piix :00:01.1: DMA addr 0x00010fc14000+49152 overflow (mask , bus limit 0). [ 26.726024] WARNING: CPU: 0 PID: 179 at /home/teawater/kernel/linux2/kernel/dma/direct.c:364 dma_direct_map_page+0x118/0x130 [ 26.727141] Modules linked in: [ 26.727456] CPU: 0 PID: 179 Comm: ls Not tainted 5.6.0-rc5-next-20200311+ #9 [ 26.728163] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.13.0-0-gf21b5a4aeb02-prebuilt.qemu.org 04/01/2014 [ 26.729305] RIP: 0010:dma_direct_map_page+0x118/0x130 [ 26.729825] Code: 8b 1f e8 3b 70 59 00 48 8d 4c 24 08 48 89 c6 4c 89 2c 24 4d 89 e1 49 89 e8 48 89 da 48 c7 c7 08 6c 34 82 31 c0 e8 d8 8e f7 ff <00 [ 26.731683] RSP: :c9213838 EFLAGS: 00010082 [ 26.732205] RAX: RBX: 88803ebeb1b0 RCX: 82665148 [ 26.732913] RDX: 0001 RSI: 0092 RDI: 0046 [ 26.733621] RBP: c000 R08: 01df R09: 01df [ 26.734338] R10: R11: c92135a8 R12: [ 26.735054] R13: R14: R15: 88803d55f5b0 [ 26.735772] FS: 024e9880() GS:88803ec0() knlGS: [ 26.736579] CS: 0010 DS: ES: CR0: 80050033 [ 26.737162] CR2: 005bfc7f CR3: 000107e12004 CR4: 00360ef0 [ 26.737879] DR0: DR1: DR2: [ 26.738591] DR3: DR6: fffe0ff0 DR7: 0400 [ 26.739307] Call Trace: [ 26.739564] dma_direct_map_sg+0x64/0xb0 [ 26.739969] ? ata_scsi_write_same_xlat+0x350/0x350 [ 26.740461] ata_qc_issue+0x214/0x260 [ 26.740839] ata_scsi_queuecmd+0x16a/0x490 [ 26.741255] scsi_queue_rq+0x679/0xa60 [ 26.741639] blk_mq_dispatch_rq_list+0x90/0x510 [ 26.742099] ? elv_rb_del+0x1f/0x30 [ 26.742456] ? deadline_remove_request+0x6a/0xb0 [ 26.742926] blk_mq_do_dispatch_sched+0x78/0x100 [ 26.743397] blk_mq_sched_dispatch_requests+0xf9/0x170 [ 26.743924] __blk_mq_run_hw_queue+0x7e/0x130 [ 26.744365] __blk_mq_delay_run_hw_queue+0x107/0x150 [ 26.744874] blk_mq_run_hw_queue+0x61/0x100 [ 26.745299] blk_mq_sched_insert_requests+0x71/0x110 [ 26.745798] blk_mq_flush_plug_list+0x14b/0x210 [ 26.746258] blk_flush_plug_list+0xbf/0xe0 [ 26.746675] blk_finish_plug+0x27/0x40 [ 26.747056] read_pages+0x7c/0x190 [ 26.747399] __do_page_cache_readahead+0x19c/0x1b0 [ 26.747886] filemap_fault+0x54e/0x9a0 [ 26.748268] ? alloc_set_pte+0x102/0x610 [ 26.748673] ? walk_component+0x64/0x2e0 [ 26.749072] ? filemap_map_pages+0xfa/0x3f0 [ 26.749498] ext4_filemap_fault+0x2c/0x3b [ 26.749911] __do_fault+0x38/0xb0 [ 26.750251] __handle_mm_fault+0xd2a/0x16d0 [ 26.750678] handle_mm_fault+0xe2/0x1f0 [ 26.751069] do_page_fault+0x250/0x590 [ 26.751448] async_page_fault+0x34/0x40 [ 26.751841] RIP: 0033:0x5bfc7f [ 26.752155] Code: Bad RIP value. [ 2
Re: [PATCH 8/9] fs/ext4: Introduce DAX inode flag
On Wed 13-05-20 14:41:55, Ira Weiny wrote: > On Wed, May 13, 2020 at 04:47:06PM +0200, Jan Kara wrote: > > > > So I think you'll have to check > > whether DAX flag is being changed, > > ext4_dax_dontcache() does check if the flag is being changed. Yes, but if you call it after inode flags change, you cannot determine that just from flags and EXT4_I(inode)->i_flags. So that logic needs to change. Honza -- Jan Kara SUSE Labs, CR
[PATCH] firmware: qcom_scm: Prefer initialisation during the descriptor declaration
qcom_scm_iommu_secure_ptbl_init() initialises the args twice, once while declaring the struct, and then again by assignment. Remove the duplicate assignment. Similarly, move arginfo initialisation to the declaration in __qcom_scm_is_call_available for consistency with other .arginfo initialisation in the file. Fixes: 9a434cee773a ("firmware: qcom_scm: Dynamically support SMCCC and legacy conventions") Signed-off-by: Amit Kucheria --- drivers/firmware/qcom_scm.c | 8 +--- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/drivers/firmware/qcom_scm.c b/drivers/firmware/qcom_scm.c index 6ba132be1b6e..eae9c28679cc 100644 --- a/drivers/firmware/qcom_scm.c +++ b/drivers/firmware/qcom_scm.c @@ -228,10 +228,10 @@ static int __qcom_scm_is_call_available(struct device *dev, u32 svc_id, .svc = QCOM_SCM_SVC_INFO, .cmd = QCOM_SCM_INFO_IS_CALL_AVAIL, .owner = ARM_SMCCC_OWNER_SIP, + .arginfo = QCOM_SCM_ARGS(1), }; struct qcom_scm_res res; - desc.arginfo = QCOM_SCM_ARGS(1); switch (__get_convention()) { case SMC_CONVENTION_ARM_32: case SMC_CONVENTION_ARM_64: @@ -742,12 +742,6 @@ int qcom_scm_iommu_secure_ptbl_init(u64 addr, u32 size, u32 spare) }; int ret; - desc.args[0] = addr; - desc.args[1] = size; - desc.args[2] = spare; - desc.arginfo = QCOM_SCM_ARGS(3, QCOM_SCM_RW, QCOM_SCM_VAL, -QCOM_SCM_VAL); - ret = qcom_scm_call(__scm->dev, &desc, NULL); /* the pg table has been initialized already, ignore the error */ -- 2.20.1
Re: stable-rc 5.4: libhugetlbfs fallocate_stress.sh: Unable to handle kernel paging request at virtual address ffff00006772f000
On Wed 13-05-20 23:11:40, Naresh Kamboju wrote: > While running libhugetlbfs fallocate_stress.sh on stable-rc 5.4 branch kernel > on arm64 hikey device. The following kernel Internal error: Oops: > crash dump noticed. Is the same problem reproducible on vanilla 5.4 without any stable patches? > > fallocate_stress.sh (2M: 64): > [ 129.706506] Unable to handle kernel paging request at virtual > address 6772f000 > [ 129.714638] Mem abort info: > [ 129.717553] ESR = 0x9647 > [ 129.720726] EC = 0x25: DABT (current EL), IL = 32 bits > [ 129.726188] SET = 0, FnV = 0 > [ 129.729338] EA = 0, S1PTW = 0 > [ 129.732573] Data abort info: > [ 129.735546] ISV = 0, ISS = 0x0047 > [ 129.739493] CM = 0, WnR = 1 > [ 129.742534] swapper pgtable: 4k pages, 48-bit VAs, pgdp=013ad000 > [ 129.749409] [6772f000] pgd=77ff7003, > pud=77e0d003, pmd=77cd1003, pte=00686772f713 > [ 129.760294] Internal error: Oops: 9647 [#1] PREEMPT SMP > [ 129.765988] Modules linked in: wl18xx wlcore mac80211 cfg80211 > hci_uart snd_soc_audio_graph_card adv7511 crct10dif_ce wlcore_sdio > btbcm snd_soc_simple_card_utils cec kirin_drm bluetooth drm_kms_helper > dw_drm_dsi rfkill drm fuse > [ 129.786626] CPU: 1 PID: 1263 Comm: fallocate_stres Not tainted > 5.4.41-rc1-00091-g132220af41e6 #1 > [ 129.795601] Hardware name: HiKey Development Board (DT) > [ 129.800940] pstate: 8005 (Nzcv daif -PAN -UAO) > [ 129.805847] pc : clear_page+0x10/0x24 > [ 129.809594] lr : __cpu_clear_user_page+0xc/0x18 > [ 129.814225] sp : 800012a1bbe0 > [ 129.817609] x29: 800012a1bbe0 x28: fe00017d8000 > [ 129.823039] x27: 73070268 x26: 800011adf000 > [ 129.828466] x25: 800011ae06c8 x24: 1000 > [ 129.833893] x23: x22: fe00017d8000 > [ 129.839320] x21: x20: 06a0 > [ 129.844747] x19: 37945400 x18: > [ 129.850174] x17: x16: > [ 129.855602] x15: x14: > [ 129.861031] x13: x12: > [ 129.866458] x11: x10: 800012a1bbd0 > [ 129.871886] x9 : 0200 x8 : 0001 > [ 129.877314] x7 : x6 : 0080 > [ 129.882741] x5 : 0036 x4 : 0220 > [ 129.888170] x3 : 4bc0 x2 : 0004 > [ 129.893597] x1 : 0040 x0 : 6772f000 > [ 129.899025] Call trace: > [ 129.901530] clear_page+0x10/0x24 > [ 129.904926] clear_subpage+0x54/0x90 > [ 129.908580] clear_huge_page+0x6c/0x208 > [ 129.912503] hugetlbfs_fallocate+0x2e0/0x4a0 > [ 129.916869] vfs_fallocate+0x1b8/0x2e0 > [ 129.920699] ksys_fallocate+0x44/0x90 > [ 129.924446] __arm64_sys_fallocate+0x1c/0x28 > [ 129.928811] el0_svc_common.constprop.0+0x68/0x160 > [ 129.933708] el0_svc_handler+0x20/0x80 > [ 129.937539] el0_svc+0x8/0xc > [ 129.940488] Code: d53b00e1 12000c21 d2800082 9ac12041 (d50b7420) > [ 129.946719] ---[ end trace df98e92a449be749 ]--- > [ 129.959274] note: fallocate_stres[1263] exited with preempt_count 1 > > ref: > https://qa-reports.linaro.org/lkft/linux-stable-rc-5.4-oe/build/v5.4.40-91-g132220af41e6/testrun/1428986/log > https://qa-reports.linaro.org/lkft/linux-stable-rc-5.4-oe/build/v5.4.40-91-g132220af41e6/testrun/1428986/ > > kernel config: > https://builds.tuxbuild.com/SqvcoklXmvQsC70j6rfcgA/kernel.config > > -- > Linaro LKFT > https://lkft.linaro.org -- Michal Hocko SUSE Labs
Re: linux-next: build failure after merge of the opp tree
On 14-05-20, 11:58, Stephen Rothwell wrote: > Hi all, > > After merging the opp tree, today's linux-next build (x86_64 allmodconfig) > failed like this: > > x86_64-linux-gnu-ld: drivers/opp/core.o: in function > `dev_pm_opp_put_opp_table': > (.text+0x76e): undefined reference to `icc_put' > x86_64-linux-gnu-ld: drivers/opp/core.o: in function `dev_pm_opp_set_rate': > (.text+0x2c59): undefined reference to `icc_set_bw' > x86_64-linux-gnu-ld: drivers/opp/of.o: in function > `dev_pm_opp_of_find_icc_paths': > (.text+0x3ca): undefined reference to `of_icc_get_by_index' > x86_64-linux-gnu-ld: (.text+0x441): undefined reference to `icc_set_tag' > x86_64-linux-gnu-ld: (.text+0x542): undefined reference to `icc_put' > > Caused by commit > > 12fa389dcf86 ("OPP: Add support for parsing interconnect bandwidth") > > I have used the opp tree from next-20200512 for today. There is some issue with Kconfig dependencies, we are working on it and until then I have removed the patches from linux-next branch. -- viresh
[PATCH net-next] hinic: update huawei ethernet driver maintainer
update huawei ethernet driver maintainer from aviad to Bin luo Signed-off-by: Luo bin --- MAINTAINERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MAINTAINERS b/MAINTAINERS index e581ae499057..8e51860e0204 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -7811,7 +7811,7 @@ F: Documentation/devicetree/bindings/iio/humidity/hts221.txt F: drivers/iio/humidity/hts221* HUAWEI ETHERNET DRIVER -M: Aviad Krawczyk +M: Bin Luo L: net...@vger.kernel.org S: Supported F: Documentation/networking/hinic.rst -- 2.17.1
Re: [PATCH v29 00/20] Intel SGX foundations
On 2020-05-14 00:14, Jarkko Sakkinen wrote: > General question: maybe it would be easiest that I issue a pull request > once everyone feels that the series is ready to be pulled and stop sending > new versions of the series? Sounds good -- Jethro Beekman | Fortanix smime.p7s Description: S/MIME Cryptographic Signature
Re: Validating dma_mmap_coherent() parameters before calling (was Re: WARNING in memtype_reserve)
On Thu, May 14, 2020 at 08:27:50AM +0200, Greg KH wrote: > On Thu, May 14, 2020 at 08:14:17AM +0200, Christoph Hellwig wrote: > > Guys, can you please start formal thread on this? I have no > > idea where this came from and what the rationale is. Btw, if the > > pfn is crap in dma_direct_mmap then the dma_addr_t passed in is > > crap, as it is derived from that. What is the caller, and how is > > this triggered? > > > Ok, to summarize, commit 2bef9aed6f0e ("usb: usbfs: correct kernel->user > page attribute mismatch") changed a call from remap_pfn_range() to > dma_mmap_coherent() for usb data buffers being sent from userspace. I only need to look at the commit for 3 seconds to tell you that it is completely buggy. While using dma_mmap_coherent is fundamentally the right thing and absolutely required for dma_alloc_* allocations, USB also uses it's own local gen pool allocator or plain kmalloc for not DMA capable controller. This need to use remap_pfn_range. I'm pretty sure you hit one of those cases. The logic should be something like: if (hcd->localmem_pool || !hcd_uses_dma(hcd)) remap_pfn_range() else dma_mmap_coherent()
Re: [PATCH] i2c: mediatek: Add i2c ac-timing adjust support
> > Last question: You seem to be the one doing major updates to this > > driver. Thanks for that! Are you maybe interested in becoming the > > maintainer for this driver? I think there won't be much patches to > > review and reports to handle but it will speed up processing for me. > > Yes, It is my honor to be the maintainer for this driver. Awesome! :) Can you prepare a patch for MAINTAINERS or shall I? signature.asc Description: PGP signature
[PATCH] net: stmmac: fix num_por initialization
Driver missed initializing num_por which is por values that driver configures to hardware. In order to get this values, add a new structure ethqos_emac_driver_data which holds por and num_por values and populate that in driver probe. Fixes: a7c30e62d4b8 ("net: stmmac: Add driver for Qualcomm ethqos") Reported-by: Rahul Ankushrao Kawadgave Signed-off-by: Vinod Koul --- .../ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c | 17 +++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c index e0a5fe83d8e0..bfc4a92f1d92 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-qcom-ethqos.c @@ -75,6 +75,11 @@ struct ethqos_emac_por { unsigned int value; }; +struct ethqos_emac_driver_data { + const struct ethqos_emac_por *por; + unsigned int num_por; +}; + struct qcom_ethqos { struct platform_device *pdev; void __iomem *rgmii_base; @@ -171,6 +176,11 @@ static const struct ethqos_emac_por emac_v2_3_0_por[] = { { .offset = RGMII_IO_MACRO_CONFIG2, .value = 0x2060 }, }; +static const struct ethqos_emac_driver_data emac_v2_3_0_data = { + .por = emac_v2_3_0_por, + .num_por = ARRAY_SIZE(emac_v2_3_0_por), +}; + static int ethqos_dll_configure(struct qcom_ethqos *ethqos) { unsigned int val; @@ -442,6 +452,7 @@ static int qcom_ethqos_probe(struct platform_device *pdev) struct device_node *np = pdev->dev.of_node; struct plat_stmmacenet_data *plat_dat; struct stmmac_resources stmmac_res; + const struct ethqos_emac_driver_data *data; struct qcom_ethqos *ethqos; struct resource *res; int ret; @@ -471,7 +482,9 @@ static int qcom_ethqos_probe(struct platform_device *pdev) goto err_mem; } - ethqos->por = of_device_get_match_data(&pdev->dev); + data = of_device_get_match_data(&pdev->dev); + ethqos->por = data->por; + ethqos->num_por = data->num_por; ethqos->rgmii_clk = devm_clk_get(&pdev->dev, "rgmii"); if (IS_ERR(ethqos->rgmii_clk)) { @@ -526,7 +539,7 @@ static int qcom_ethqos_remove(struct platform_device *pdev) } static const struct of_device_id qcom_ethqos_match[] = { - { .compatible = "qcom,qcs404-ethqos", .data = &emac_v2_3_0_por}, + { .compatible = "qcom,qcs404-ethqos", .data = &emac_v2_3_0_data}, { } }; MODULE_DEVICE_TABLE(of, qcom_ethqos_match); -- 2.25.4
Re: [PATCH 27/33] sctp: export sctp_setsockopt_bindx
On Wed, May 13, 2020 at 03:00:58PM -0300, Marcelo Ricardo Leitner wrote: > On Wed, May 13, 2020 at 08:26:42AM +0200, Christoph Hellwig wrote: > > And call it directly from dlm instead of going through kernel_setsockopt. > > The advantage on using kernel_setsockopt here is that sctp module will > only be loaded if dlm actually creates a SCTP socket. With this > change, sctp will be loaded on setups that may not be actually using > it. It's a quite big module and might expose the system. True. Not that the intent is to kill kernel space callers of setsockopt, as I plan to remove the set_fs address space override used for it. So if always pulling in sctp is not an option for the DLM maintainers we'd have to do tricks using symbol_get() or similar. The same would also apply for ipv6, although I'm not sure how common modular ipv6 is in practice.
Validating dma_mmap_coherent() parameters before calling (was Re: WARNING in memtype_reserve)
On Thu, May 14, 2020 at 08:14:17AM +0200, Christoph Hellwig wrote: > Guys, can you please start formal thread on this? I have no > idea where this came from and what the rationale is. Btw, if the > pfn is crap in dma_direct_mmap then the dma_addr_t passed in is > crap, as it is derived from that. What is the caller, and how is > this triggered? Ok, to summarize, commit 2bef9aed6f0e ("usb: usbfs: correct kernel->user page attribute mismatch") changed a call from remap_pfn_range() to dma_mmap_coherent() for usb data buffers being sent from userspace. Details on why this was changed is in the commit changelog, but this has triggered a WARN_ON() in memtype_reserve when I think some odd data buffers were sent to it by syzbot fuzzing. The warning caught the wrong data, but triggered syzbot. So, the question is, should all callers of dma_mmap_coherent() validate the parms better before it is called, or should the call chain here properly sanitize things on their own. Note, usbfs is not the only direct-from-userspace caller of dma_mmap_coherent(), it's also used in other userspace apis (frame buffer drivers, fastrpc, some SoC drivers) but it looks like nothing has fuzzed those apis before to trigger this. Does that help explain things better? thanks, greg k-h
Re: remove kernel_setsockopt and kernel_getsockopt
On Wed, May 13, 2020 at 10:38:59AM -0700, Joe Perches wrote: > It might be useful to show overall object size change. > > More EXPORT_SYMBOL uses increase object size a little. > > And not sure it matters much except it reduces overall object > size, but these patches remove (unnecessary) logging on error > and that could be mentioned in the cover letter too. The intent here is not to reduce code size. The intent is to kill of set_fs users so that we can eventually remove set_fs entirely.
Re: [PATCH 21/33] ipv4: add ip_sock_set_mtu_discover
On Wed, May 13, 2020 at 02:17:41PM +0100, David Howells wrote: > Christoph Hellwig wrote: > > > + ip_sock_set_mtu_discover(conn->params.local->socket->sk, > > + IP_PMTUDISC_DONT); > > Um... The socket in question could be an AF_INET6 socket, not an AF_INET4 > socket - I presume it will work in that case. If so: Yes, the implementation of that sockopt, including the inet_sock structure where these options are set is shared between ipv4 and ipv6.
Re: [PATCH] net: phy: realtek: clear interrupt during init for rtl8211f
On Wed, 13 May 2020 20:45:13 +0200 Heiner Kallweit wrote: > > On 13.05.2020 08:51, Jisheng Zhang wrote: > > Hi, > > > > On Tue, 12 May 2020 20:43:40 +0200 Heiner Kallweit wrote: > > > >> > >> > >> On 12.05.2020 12:46, Jisheng Zhang wrote: > >>> The PHY Register Accessible Interrupt is enabled by default, so > >>> there's such an interrupt during init. In PHY POLL mode case, the > >>> INTB/PMEB pin is alway active, it is not good. Clear the interrupt by > >>> calling rtl8211f_ack_interrupt(). > >> > >> As you say "it's not good" w/o elaborating a little bit more on it: > >> Do you face any actual issue? Or do you just think that it's not nice? > > > > > > The INTB/PMEB pin can be used in two different modes: > > INTB: used for interrupt > > PMEB: special mode for Wake-on-LAN > > > > The PHY Register Accessible Interrupt is enabled by > > default, there's always such an interrupt during the init. In PHY POLL mode > > case, the pin is always active. If platforms plans to use the INTB/PMEB pin > > as WOL, then the platform will see WOL active. It's not good. > > > The platform should listen to this pin only once WOL has been configured and > the pin has been switched to PMEB function. For the latter you first would > have to implement the set_wol callback in the PHY driver. > Or where in which code do you plan to switch the pin function to PMEB? I think it's better to switch the pin function in set_wol callback. But this is another story. No matter WOL has been configured or not, keeping the INTB/PMEB pin active is not good. what do you think? > One more thing to consider when implementing set_wol would be that the PHY > supports two WOL options: > 1. INT/PMEB configured as PMEB > 2. INT/PMEB configured as INT and WOL interrupt source active > > > > >> I'm asking because you don't provide a Fixes tag and you don't > >> annotate your patch as net or net-next. > > > > should be Fixes: 3447cf2e9a11 ("net/phy: Add support for Realtek RTL8211F") > > > >> Once you provide more details we would also get an idea whether a > >> change would have to be made to phylib, because what you describe > >> doesn't seem to be specific to this one PHY model. > > > > Nope, we don't need this change in phylib, this is specific to rtl8211f > > > > Thanks, > > Jisheng > > > Heiner
Re: [dm-devel] [PATCH] dm zoned: Avoid 64-bit division error in dmz_fixup_devices
On 2020/05/14 14:07, Nathan Chancellor wrote: > When building arm32 allyesconfig: > > ld.lld: error: undefined symbol: __aeabi_uldivmod referenced by dm-zoned-target.c md/dm-zoned-target.o:(dmz_ctr) in archive drivers/built-in.a > > dmz_fixup_devices uses DIV_ROUND_UP with variables of type sector_t. As > such, it should be using DIV_ROUND_UP_SECTOR_T, which handles this > automatically. > > Fixes: 70978208ec91 ("dm zoned: metadata version 2") > Signed-off-by: Nathan Chancellor > --- > drivers/md/dm-zoned-target.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/drivers/md/dm-zoned-target.c b/drivers/md/dm-zoned-target.c > index ea43f6892ced..9c4fd4b04878 100644 > --- a/drivers/md/dm-zoned-target.c > +++ b/drivers/md/dm-zoned-target.c > @@ -803,8 +803,9 @@ static int dmz_fixup_devices(struct dm_target *ti) > > if (reg_dev) { > reg_dev->zone_nr_sectors = zoned_dev->zone_nr_sectors; > - reg_dev->nr_zones = DIV_ROUND_UP(reg_dev->capacity, > - reg_dev->zone_nr_sectors); > + reg_dev->nr_zones = > + DIV_ROUND_UP_SECTOR_T(reg_dev->capacity, > + reg_dev->zone_nr_sectors);> > zoned_dev->zone_offset = reg_dev->nr_zones; > } > return 0; > > base-commit: e098d7762d602be640c53565ceca342f81e55ad2 > Looks good. Reviewed-by: Damien Le Moal -- Damien Le Moal Western Digital Research
[PATCH 2/2] dt-bindings: rtc: Convert MXC RTC V2 to json-schema
Convert the MXC RTC V2 binding to DT schema format using json-schema. Signed-off-by: Anson Huang --- .../devicetree/bindings/rtc/rtc-mxc_v2.txt | 17 .../devicetree/bindings/rtc/rtc-mxc_v2.yaml| 46 ++ 2 files changed, 46 insertions(+), 17 deletions(-) delete mode 100644 Documentation/devicetree/bindings/rtc/rtc-mxc_v2.txt create mode 100644 Documentation/devicetree/bindings/rtc/rtc-mxc_v2.yaml diff --git a/Documentation/devicetree/bindings/rtc/rtc-mxc_v2.txt b/Documentation/devicetree/bindings/rtc/rtc-mxc_v2.txt deleted file mode 100644 index 79d7e87..000 --- a/Documentation/devicetree/bindings/rtc/rtc-mxc_v2.txt +++ /dev/null @@ -1,17 +0,0 @@ -* i.MX53 Secure Real Time Clock (SRTC) - -Required properties: -- compatible: should be: "fsl,imx53-rtc" -- reg: physical base address of the controller and length of memory mapped - region. -- clocks: should contain the phandle for the rtc clock -- interrupts: rtc alarm interrupt - -Example: - -rtc@53fa4000 { - compatible = "fsl,imx53-rtc"; - reg = <0x53fa4000 0x4000>; - interrupts = <24>; - clocks = <&clks IMX5_CLK_SRTC_GATE>; -}; diff --git a/Documentation/devicetree/bindings/rtc/rtc-mxc_v2.yaml b/Documentation/devicetree/bindings/rtc/rtc-mxc_v2.yaml new file mode 100644 index 000..2d1a306 --- /dev/null +++ b/Documentation/devicetree/bindings/rtc/rtc-mxc_v2.yaml @@ -0,0 +1,46 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/rtc/rtc-mxc_v2.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: i.MX53 Secure Real Time Clock (SRTC) + +allOf: + - $ref: "rtc.yaml#" + +maintainers: + - Patrick Bruenn + +properties: + compatible: +enum: + - fsl,imx53-rtc + + reg: +maxItems: 1 + + clocks: +maxItems: 1 + + interrupts: +maxItems: 1 + +required: + - compatible + - reg + - clocks + - interrupts + +additionalProperties: false + +examples: + - | +#include + +rtc@53fa4000 { +compatible = "fsl,imx53-rtc"; +reg = <0x53fa4000 0x4000>; +interrupts = <24>; +clocks = <&clks IMX5_CLK_SRTC_GATE>; +}; -- 2.7.4
[PATCH V3 8/8] phy: tegra: xusb: Enable charger detect for Tegra210
Tegra210 SoC supports charger detect, set corresponding soc flag. Signed-off-by: Nagarjuna Kristam Acked-by: Thierry Reding --- V3: - Used supports_charger_detect name instead of charger_detect. - Added Acked-by updates to commit message. --- V2: - Patch re-based. --- drivers/phy/tegra/xusb-tegra210.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/phy/tegra/xusb-tegra210.c b/drivers/phy/tegra/xusb-tegra210.c index 80c4349..db2a1ab 100644 --- a/drivers/phy/tegra/xusb-tegra210.c +++ b/drivers/phy/tegra/xusb-tegra210.c @@ -2353,6 +2353,7 @@ const struct tegra_xusb_padctl_soc tegra210_xusb_padctl_soc = { .supply_names = tegra210_xusb_padctl_supply_names, .num_supplies = ARRAY_SIZE(tegra210_xusb_padctl_supply_names), .need_fake_usb3_port = true, + .supports_charger_detect = true, }; EXPORT_SYMBOL_GPL(tegra210_xusb_padctl_soc); -- 2.7.4
[PATCH V3 2/8] usb: gadget: tegra-xudc: Add vbus_draw support
Register vbus_draw to gadget ops and update corresponding vbus draw current to usb_phy. Signed-off-by: Nagarjuna Kristam --- V3: - Propogated usb_phy->set_power error to vbus_draw caller. --- V2: - Patch re-based. --- drivers/usb/gadget/udc/tegra-xudc.c | 17 + 1 file changed, 17 insertions(+) diff --git a/drivers/usb/gadget/udc/tegra-xudc.c b/drivers/usb/gadget/udc/tegra-xudc.c index 52a6add..53e2d1c 100644 --- a/drivers/usb/gadget/udc/tegra-xudc.c +++ b/drivers/usb/gadget/udc/tegra-xudc.c @@ -492,6 +492,7 @@ struct tegra_xudc { bool powergated; struct usb_phy **usbphy; + struct usb_phy *curr_usbphy; struct notifier_block vbus_nb; struct completion disconnect_complete; @@ -719,6 +720,7 @@ static int tegra_xudc_vbus_notify(struct notifier_block *nb, if (!xudc->suspended && phy_index != -1) { xudc->curr_utmi_phy = xudc->utmi_phy[phy_index]; xudc->curr_usb3_phy = xudc->usb3_phy[phy_index]; + xudc->curr_usbphy = usbphy; schedule_work(&xudc->usb_role_sw_work); } @@ -2042,6 +2044,20 @@ static int tegra_xudc_gadget_stop(struct usb_gadget *gadget) return 0; } +static int tegra_xudc_gadget_vbus_draw(struct usb_gadget *gadget, + unsigned int m_a) +{ + int ret = 0; + struct tegra_xudc *xudc = to_xudc(gadget); + + dev_dbg(xudc->dev, "%s: %u mA\n", __func__, m_a); + + if (xudc->curr_usbphy->chg_type == SDP_TYPE) + ret = usb_phy_set_power(xudc->curr_usbphy, m_a); + + return ret; +} + static int tegra_xudc_set_selfpowered(struct usb_gadget *gadget, int is_on) { struct tegra_xudc *xudc = to_xudc(gadget); @@ -2058,6 +2074,7 @@ static struct usb_gadget_ops tegra_xudc_gadget_ops = { .pullup = tegra_xudc_gadget_pullup, .udc_start = tegra_xudc_gadget_start, .udc_stop = tegra_xudc_gadget_stop, + .vbus_draw = tegra_xudc_gadget_vbus_draw, .set_selfpowered = tegra_xudc_set_selfpowered, }; -- 2.7.4
[PATCH V3 7/8] phy: tegra: xusb: Enable charger detect for Tegra186
Tegra186 SoC supports charger detect, set corresponding soc flag. Signed-off-by: Nagarjuna Kristam Acked-by: Thierry Reding --- V3: - Used supports_charger_detect name instead of charger_detect. - Added Acked-by updates to commit message. --- V2: - Patch re-based. --- drivers/phy/tegra/xusb-tegra186.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/phy/tegra/xusb-tegra186.c b/drivers/phy/tegra/xusb-tegra186.c index 59b78a7..da61721 100644 --- a/drivers/phy/tegra/xusb-tegra186.c +++ b/drivers/phy/tegra/xusb-tegra186.c @@ -1041,6 +1041,7 @@ const struct tegra_xusb_padctl_soc tegra186_xusb_padctl_soc = { .ops = &tegra186_xusb_padctl_ops, .supply_names = tegra186_xusb_padctl_supply_names, .num_supplies = ARRAY_SIZE(tegra186_xusb_padctl_supply_names), + .supports_charger_detect = true, }; EXPORT_SYMBOL_GPL(tegra186_xusb_padctl_soc); #endif -- 2.7.4
[PATCH V3 0/8] Tegra XUSB charger detect support
This patch series adds charger detect support on XUSB hardware used in Tegra210 and Tegra186 SoCs. This patchset is composed with : - dt bindings of XUSB Pad Controller - Tegra XUSB device mode driver to add vbus_draw support - Tegra PHY driver for charger detect support Tests done: - Connect USB cable from ubuntu host to micro-B port of DUT to detect SDP_TYPE charger - Connect USB cable from external powered USB hub(which inturn connects to ubuntu host) to micro-B port of DUT to detect CDP_TYPE charger. - Connect USB cable from USB charger to micro-B port of DUT to detect DCP_TYPE charger. DUT: Jetson-tx1, Jetson tx2. V3: - Added ACKed-by details for PHY driver and DT changes. - Functions and its arguments are aligned. - Tabs are used for alignment of MACRO's - For vbus_draw USDC callback, usb_phy set_power error is propogated. - Fixed various comments given by thierry. V2: - Added ACKed-by details for DT patches. - All patches rebased. Nagarjuna Kristam (8): dt-bindings: phy: tegra-xusb: Add charger-detect property usb: gadget: tegra-xudc: Add vbus_draw support phy: tegra: xusb: Add support for UTMI pad power control phy: tegra: xusb: Add USB2 pad power control support for Tegra210 phy: tegra: xusb: Add soc ops API to enable UTMI PAD protection phy: tegra: xusb: Add support for charger detect phy: tegra: xusb: Enable charger detect for Tegra186 phy: tegra: xusb: Enable charger detect for Tegra210 .../bindings/phy/nvidia,tegra124-xusb-padctl.txt | 4 + drivers/phy/tegra/Makefile | 2 +- drivers/phy/tegra/cd.c | 283 + drivers/phy/tegra/xusb-tegra186.c | 92 +-- drivers/phy/tegra/xusb-tegra210.c | 223 +++- drivers/phy/tegra/xusb.c | 80 ++ drivers/phy/tegra/xusb.h | 22 ++ drivers/usb/gadget/udc/tegra-xudc.c| 17 ++ 8 files changed, 638 insertions(+), 85 deletions(-) create mode 100644 drivers/phy/tegra/cd.c -- 2.7.4
[PATCH V3 1/8] dt-bindings: phy: tegra-xusb: Add charger-detect property
Add nvidia,charger-detect boolean property for Tegra210 and Tegra186 platforms. This property is used to inform driver to perform charger detection on corresponding USB 2 port. Signed-off-by: Nagarjuna Kristam Acked-by: Rob Herring Acked-by: Thierry Reding --- V3: - Added Acked-by updates to commit message. --- V2: - Added Acked-by updates to commit message. --- Documentation/devicetree/bindings/phy/nvidia,tegra124-xusb-padctl.txt | 4 1 file changed, 4 insertions(+) diff --git a/Documentation/devicetree/bindings/phy/nvidia,tegra124-xusb-padctl.txt b/Documentation/devicetree/bindings/phy/nvidia,tegra124-xusb-padctl.txt index 38c5fa2..9b2d2dd 100644 --- a/Documentation/devicetree/bindings/phy/nvidia,tegra124-xusb-padctl.txt +++ b/Documentation/devicetree/bindings/phy/nvidia,tegra124-xusb-padctl.txt @@ -190,6 +190,10 @@ Required properties for OTG/Peripheral capable USB2 ports: and peripheral roles. Connector should be added as subnode. See usb/usb-conn-gpio.txt. +Optional properties for OTG/Peripheral capable USB2 ports: +- nvidia,charger-detect: A boolean property whose presence inform driver to + perform charger-detect activity. + Optional properties: - nvidia,internal: A boolean property whose presence determines that a port is internal. In the absence of this property the port is considered to be -- 2.7.4
[PATCH V3 6/8] phy: tegra: xusb: Add support for charger detect
Perform charger-detect operation if corresponding dt property is enabled. Update usb-phy with the detected charger state and max current values. Register charger-detect API's of usb-phy to provide needed functionalities. Signed-off-by: Nagarjuna Kristam --- V3: - Allighed functions and its arguments. - replaced spaced by tabs for MACRO definition allignments. - Unified primary and secondary charger detect API's. - Used readl_poll_timeout instead of while loop condition check for register. - Fixed other comments as per inputs from Thierry. --- V2: - Patch re-based. --- drivers/phy/tegra/Makefile | 2 +- drivers/phy/tegra/cd.c | 283 + drivers/phy/tegra/xusb.c | 80 + drivers/phy/tegra/xusb.h | 7 ++ 4 files changed, 371 insertions(+), 1 deletion(-) create mode 100644 drivers/phy/tegra/cd.c diff --git a/drivers/phy/tegra/Makefile b/drivers/phy/tegra/Makefile index 89b8406..befdfc4 100644 --- a/drivers/phy/tegra/Makefile +++ b/drivers/phy/tegra/Makefile @@ -1,7 +1,7 @@ # SPDX-License-Identifier: GPL-2.0-only obj-$(CONFIG_PHY_TEGRA_XUSB) += phy-tegra-xusb.o -phy-tegra-xusb-y += xusb.o +phy-tegra-xusb-y += xusb.o cd.o phy-tegra-xusb-$(CONFIG_ARCH_TEGRA_124_SOC) += xusb-tegra124.o phy-tegra-xusb-$(CONFIG_ARCH_TEGRA_132_SOC) += xusb-tegra124.o phy-tegra-xusb-$(CONFIG_ARCH_TEGRA_210_SOC) += xusb-tegra210.o diff --git a/drivers/phy/tegra/cd.c b/drivers/phy/tegra/cd.c new file mode 100644 index 000..fddbe4c --- /dev/null +++ b/drivers/phy/tegra/cd.c @@ -0,0 +1,283 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Copyright (c) 2020, NVIDIA CORPORATION. All rights reserved. + */ + +#include +#include +#include +#include +#include + +#include "xusb.h" + +/* Data contact detection timeout */ +#define TDCD_TIMEOUT_MS400 + +#define USB2_BATTERY_CHRG_OTGPADX_CTL0(x) (0x80 + (x) * 0x40) +#define PD_CHG(1 << 0) +#define VDCD_DET_FILTER_EN(1 << 4) +#define VDAT_DET (1 << 5) +#define VDAT_DET_FILTER_EN(1 << 8) +#define OP_SINK_EN(1 << 9) +#define OP_SRC_EN (1 << 10) +#define ON_SINK_EN(1 << 11) +#define ON_SRC_EN (1 << 12) +#define OP_I_SRC_EN (1 << 13) +#define ZIP_FILTER_EN (1 << 21) +#define ZIN_FILTER_EN (1 << 25) +#define DCD_DETECTED (1 << 26) + +#define USB2_BATTERY_CHRG_OTGPADX_CTL1(x) (0x84 + (x) * 0x40) +#define PD_VREG (1 << 6) +#define VREG_LEV(x) (((x) & 0x3) << 7) +#define VREG_DIR(x) (((x) & 0x3) << 11) +#define VREG_DIR_IN VREG_DIR(1) +#define VREG_DIR_OUT VREG_DIR(2) +#define USBOP_RPD_OVRD(1 << 16) +#define USBOP_RPD_OVRD_VAL(1 << 17) +#define USBOP_RPU_OVRD(1 << 18) +#define USBOP_RPU_OVRD_VAL(1 << 19) +#define USBON_RPD_OVRD(1 << 20) +#define USBON_RPD_OVRD_VAL(1 << 21) +#define USBON_RPU_OVRD(1 << 22) +#define USBON_RPU_OVRD_VAL(1 << 23) + +#define XUSB_PADCTL_USB2_OTG_PADX_CTL0(x) (0x88 + (x) * 0x40) +#define USB2_OTG_PD2 (1 << 27) +#define USB2_OTG_PD2_OVRD_EN (1 << 28) +#define USB2_OTG_PD_ZI(1 << 29) + +#define XUSB_PADCTL_USB2_BATTERY_CHRG_TDCD_DBNC_TIMER_0 (0x280) +#define TDCD_DBNC(x) (((x) & 0x7ff) << 0) + +static void +tegra_xusb_padctl_set_debounce_time(struct tegra_xusb_padctl *padctl, + u32 debounce) +{ + u32 value; + + value = padctl_readl(padctl, + XUSB_PADCTL_USB2_BATTERY_CHRG_TDCD_DBNC_TIMER_0); + value &= ~(TDCD_DBNC(0)); + value |= TDCD_DBNC(debounce); + padctl_writel(padctl, value, + XUSB_PADCTL_USB2_BATTERY_CHRG_TDCD_DBNC_TIMER_0); +} + +static void +tegra_xusb_padctl_charger_detect_on(struct tegra_xusb_padctl *padctl, u32 index) +{ + u32 value; + + value = padctl_readl(padctl, XUSB_PADCTL_USB2_OTG_PADX_CTL0(index)); + value &= ~USB2_OTG_PD_ZI; + padctl_writel(padctl, value, XUSB_PADCTL_USB2_OTG_PADX_CTL0(index)); + + value = padctl_readl(padctl, XUSB_PADCTL_USB2_OTG_PADX_CTL0(index)); + value |= (USB2_OTG_PD2 | USB2_OTG_PD2_OVRD_EN); + padctl_writel(padctl, value, XUSB_PADCTL_USB2_OTG_PADX_CTL0(index)); + + value = padctl_readl(padctl, USB2_BATTERY_CHRG_OTGPADX_CTL0(index)); + value &= ~PD_CHG; + padctl_writel(padctl, val
[PATCH 1/2] dt-bindings: rtc: Convert MXC RTC to json-schema
Convert the MXC RTC binding to DT schema format using json-schema. Signed-off-by: Anson Huang --- Documentation/devicetree/bindings/rtc/rtc-mxc.txt | 26 -- Documentation/devicetree/bindings/rtc/rtc-mxc.yaml | 59 ++ 2 files changed, 59 insertions(+), 26 deletions(-) delete mode 100644 Documentation/devicetree/bindings/rtc/rtc-mxc.txt create mode 100644 Documentation/devicetree/bindings/rtc/rtc-mxc.yaml diff --git a/Documentation/devicetree/bindings/rtc/rtc-mxc.txt b/Documentation/devicetree/bindings/rtc/rtc-mxc.txt deleted file mode 100644 index 5bcd31d..000 --- a/Documentation/devicetree/bindings/rtc/rtc-mxc.txt +++ /dev/null @@ -1,26 +0,0 @@ -* Real Time Clock of the i.MX SoCs - -RTC controller for the i.MX SoCs - -Required properties: -- compatible: Should be "fsl,imx1-rtc" or "fsl,imx21-rtc". -- reg: physical base address of the controller and length of memory mapped - region. -- interrupts: IRQ line for the RTC. -- clocks: should contain two entries: - * one for the input reference - * one for the the SoC RTC -- clock-names: should contain: - * "ref" for the input reference clock - * "ipg" for the SoC RTC clock - -Example: - -rtc@10007000 { - compatible = "fsl,imx21-rtc"; - reg = <0x10007000 0x1000>; - interrupts = <22>; - clocks = <&clks IMX27_CLK_CKIL>, -<&clks IMX27_CLK_RTC_IPG_GATE>; - clock-names = "ref", "ipg"; -}; diff --git a/Documentation/devicetree/bindings/rtc/rtc-mxc.yaml b/Documentation/devicetree/bindings/rtc/rtc-mxc.yaml new file mode 100644 index 000..d5c5ccd --- /dev/null +++ b/Documentation/devicetree/bindings/rtc/rtc-mxc.yaml @@ -0,0 +1,59 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/rtc/rtc-mxc.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Real Time Clock of the i.MX SoCs + +allOf: + - $ref: "rtc.yaml#" + +maintainers: + - Philippe Reynes + +properties: + compatible: +enum: + - fsl,imx1-rtc + - fsl,imx21-rtc + + reg: +maxItems: 1 + + interrupts: +maxItems: 1 + + clocks: +items: + - description: input reference + - description: the SoC RTC clock +maxItems: 2 + + clock-names: +items: + - const: ref + - const: ipg +maxItems: 2 + +required: + - compatible + - reg + - interrupts + - clocks + - clock-names + +additionalProperties: false + +examples: + - | +#include + +rtc@10007000 { +compatible = "fsl,imx21-rtc"; +reg = <0x10007000 0x1000>; +interrupts = <22>; +clocks = <&clks IMX27_CLK_CKIL>, + <&clks IMX27_CLK_RTC_IPG_GATE>; +clock-names = "ref", "ipg"; +}; -- 2.7.4
[PATCH V3 5/8] phy: tegra: xusb: Add soc ops API to enable UTMI PAD protection
When USB charger is enabled, UTMI PAD needs to be protected according to the direction and current level. Add support for the same on Tegra210 and Tegra186. Signed-off-by: Nagarjuna Kristam --- V3: - Alligned function and its arguments. - Fixed other comments from Thierry. --- V2: - Commit message coorected. - Patch re-based. --- drivers/phy/tegra/xusb-tegra186.c | 40 +++ drivers/phy/tegra/xusb-tegra210.c | 32 +++ drivers/phy/tegra/xusb.h | 13 + 3 files changed, 85 insertions(+) diff --git a/drivers/phy/tegra/xusb-tegra186.c b/drivers/phy/tegra/xusb-tegra186.c index f862254..59b78a7 100644 --- a/drivers/phy/tegra/xusb-tegra186.c +++ b/drivers/phy/tegra/xusb-tegra186.c @@ -68,6 +68,13 @@ #define PORTX_SPEED_SUPPORT_MASK (0x3) #define PORT_SPEED_SUPPORT_GEN1(0x0) +#define USB2_BATTERY_CHRG_OTGPADX_CTL1(x) (0x84 + (x) * 0x40) +#define PD_VREG(1 << 6) +#define VREG_LEV(x)(((x) & 0x3) << 7) +#define VREG_DIR(x)(((x) & 0x3) << 11) +#define VREG_DIR_INVREG_DIR(1) +#define VREG_DIR_OUT VREG_DIR(2) + #define XUSB_PADCTL_USB2_OTG_PADX_CTL0(x) (0x88 + (x) * 0x40) #define HS_CURR_LEVEL(x) ((x) & 0x3f) #define TERM_SEL BIT(25) @@ -289,6 +296,37 @@ static void tegra_phy_xusb_utmi_pad_power_down(struct phy *phy) usb2->powered_on = false; } +static void +tegra186_xusb_padctl_utmi_pad_set_protection(struct tegra_xusb_port *port, +int level, +enum tegra_vbus_dir dir) +{ + u32 value; + struct tegra_xusb_padctl *padctl = port->padctl; + unsigned int index = port->index; + + value = padctl_readl(padctl, USB2_BATTERY_CHRG_OTGPADX_CTL1(index)); + + if (level < 0) { + /* disable pad protection */ + value |= PD_VREG; + value &= ~VREG_LEV(~0); + value &= ~VREG_DIR(~0); + } else { + if (dir == TEGRA_VBUS_SOURCE) + value |= VREG_DIR_OUT; + else if (dir == TEGRA_VBUS_SINK) + value |= VREG_DIR_IN; + + value &= ~PD_VREG; + value &= ~VREG_DIR(~0); + value &= ~VREG_LEV(~0); + value |= VREG_LEV(level); + } + + padctl_writel(padctl, value, USB2_BATTERY_CHRG_OTGPADX_CTL1(index)); +} + static int tegra186_xusb_padctl_vbus_override(struct tegra_xusb_padctl *padctl, bool status) { @@ -935,6 +973,8 @@ static const struct tegra_xusb_padctl_ops tegra186_xusb_padctl_ops = { .vbus_override = tegra186_xusb_padctl_vbus_override, .utmi_pad_power_on = tegra_phy_xusb_utmi_pad_power_on, .utmi_pad_power_down = tegra_phy_xusb_utmi_pad_power_down, + .utmi_pad_set_protection = + tegra186_xusb_padctl_utmi_pad_set_protection, }; #if IS_ENABLED(CONFIG_ARCH_TEGRA_186_SOC) diff --git a/drivers/phy/tegra/xusb-tegra210.c b/drivers/phy/tegra/xusb-tegra210.c index caf0890..80c4349 100644 --- a/drivers/phy/tegra/xusb-tegra210.c +++ b/drivers/phy/tegra/xusb-tegra210.c @@ -74,6 +74,8 @@ #define XUSB_PADCTL_USB2_BATTERY_CHRG_OTGPAD_CTL1_VREG_LEV_MASK 0x3 #define XUSB_PADCTL_USB2_BATTERY_CHRG_OTGPAD_CTL1_VREG_LEV_VAL 0x1 #define XUSB_PADCTL_USB2_BATTERY_CHRG_OTGPAD_CTL1_VREG_FIX18 (1 << 6) +#define USB2_BATTERY_CHRG_OTGPAD_CTL1_VREG_LEV(x) (((x) & 0x3) << 7) +#define USB2_BATTERY_CHRG_OTGPAD_CTL1_VREG_DIR(x) (((x) & 0x3) << 11) #define XUSB_PADCTL_USB2_OTG_PADX_CTL0(x) (0x088 + (x) * 0x40) #define XUSB_PADCTL_USB2_OTG_PAD_CTL0_PD_ZI (1 << 29) @@ -1116,6 +1118,34 @@ void tegra210_usb2_pad_power_down(struct phy *phy) usb2->powered_on = false; } +static void +tegra210_xusb_padctl_utmi_pad_set_protection(struct tegra_xusb_port *port, +int level, +enum tegra_vbus_dir dir) +{ + u32 value; + struct tegra_xusb_padctl *padctl = port->padctl; + unsigned int index = port->index; + + value = padctl_readl(padctl, +XUSB_PADCTL_USB2_BATTERY_CHRG_OTGPADX_CTL1(index)); + + if (level < 0) { + /* disable pad protection */ + value |= XUSB_PADCTL_USB2_BATTERY_CHRG_OTGPAD_CTL1_VREG_FIX18; + value &= USB2_BATTERY_CHRG_OTGPAD_CTL1_VREG_LEV(~0); + value &= ~USB2_BATTERY_CHRG_OTGPAD_CTL1_VREG_DIR(~0); + } else { + value &= ~XUSB_PADCTL_USB2_BATTERY_CHRG_OTGPAD_CTL1_VREG_FIX18; + value &= ~USB2_BATTERY_CHRG_OTGPAD_CTL1_VREG_DIR(~0); + value &= USB2_BATTERY_CHRG_OTGPAD_
[PATCH V3 3/8] phy: tegra: xusb: Add support for UTMI pad power control
Add support for UTMI pad power on and off API's via soc ops. These API can be used by operations like charger detect to power on and off UTMI pad if needed. Update powered_on flag in the pad power control API's. Signed-off-by: Nagarjuna Kristam Acked-by: Thierry Reding --- V3: - Added Acked-by updates to commit message. --- V2: - Patch re-based. --- drivers/phy/tegra/xusb-tegra186.c | 51 ++- drivers/phy/tegra/xusb.h | 2 ++ 2 files changed, 26 insertions(+), 27 deletions(-) diff --git a/drivers/phy/tegra/xusb-tegra186.c b/drivers/phy/tegra/xusb-tegra186.c index 5d64f69..f862254 100644 --- a/drivers/phy/tegra/xusb-tegra186.c +++ b/drivers/phy/tegra/xusb-tegra186.c @@ -192,12 +192,8 @@ static void tegra186_utmi_bias_pad_power_on(struct tegra_xusb_padctl *padctl) u32 value; int err; - mutex_lock(&padctl->lock); - - if (priv->bias_pad_enable++ > 0) { - mutex_unlock(&padctl->lock); + if (priv->bias_pad_enable++ > 0) return; - } err = clk_prepare_enable(priv->usb2_trk_clk); if (err < 0) @@ -221,8 +217,6 @@ static void tegra186_utmi_bias_pad_power_on(struct tegra_xusb_padctl *padctl) value = padctl_readl(padctl, XUSB_PADCTL_USB2_BIAS_PAD_CTL1); value &= ~USB2_PD_TRK; padctl_writel(padctl, value, XUSB_PADCTL_USB2_BIAS_PAD_CTL1); - - mutex_unlock(&padctl->lock); } static void tegra186_utmi_bias_pad_power_off(struct tegra_xusb_padctl *padctl) @@ -230,44 +224,29 @@ static void tegra186_utmi_bias_pad_power_off(struct tegra_xusb_padctl *padctl) struct tegra186_xusb_padctl *priv = to_tegra186_xusb_padctl(padctl); u32 value; - mutex_lock(&padctl->lock); - - if (WARN_ON(priv->bias_pad_enable == 0)) { - mutex_unlock(&padctl->lock); + if (WARN_ON(priv->bias_pad_enable == 0)) return; - } - if (--priv->bias_pad_enable > 0) { - mutex_unlock(&padctl->lock); + if (--priv->bias_pad_enable > 0) return; - } value = padctl_readl(padctl, XUSB_PADCTL_USB2_BIAS_PAD_CTL1); value |= USB2_PD_TRK; padctl_writel(padctl, value, XUSB_PADCTL_USB2_BIAS_PAD_CTL1); clk_disable_unprepare(priv->usb2_trk_clk); - - mutex_unlock(&padctl->lock); } static void tegra_phy_xusb_utmi_pad_power_on(struct phy *phy) { struct tegra_xusb_lane *lane = phy_get_drvdata(phy); struct tegra_xusb_padctl *padctl = lane->pad->padctl; - struct tegra_xusb_usb2_port *port; - struct device *dev = padctl->dev; + struct tegra_xusb_usb2_lane *usb2 = to_usb2_lane(lane); unsigned int index = lane->index; u32 value; - if (!phy) - return; - - port = tegra_xusb_find_usb2_port(padctl, index); - if (!port) { - dev_err(dev, "no port found for USB2 lane %u\n", index); + if (!phy || usb2->powered_on) return; - } tegra186_utmi_bias_pad_power_on(padctl); @@ -280,16 +259,19 @@ static void tegra_phy_xusb_utmi_pad_power_on(struct phy *phy) value = padctl_readl(padctl, XUSB_PADCTL_USB2_OTG_PADX_CTL1(index)); value &= ~USB2_OTG_PD_DR; padctl_writel(padctl, value, XUSB_PADCTL_USB2_OTG_PADX_CTL1(index)); + + usb2->powered_on = true; } static void tegra_phy_xusb_utmi_pad_power_down(struct phy *phy) { struct tegra_xusb_lane *lane = phy_get_drvdata(phy); struct tegra_xusb_padctl *padctl = lane->pad->padctl; + struct tegra_xusb_usb2_lane *usb2 = to_usb2_lane(lane); unsigned int index = lane->index; u32 value; - if (!phy) + if (!phy || !usb2->powered_on) return; value = padctl_readl(padctl, XUSB_PADCTL_USB2_OTG_PADX_CTL0(index)); @@ -303,6 +285,8 @@ static void tegra_phy_xusb_utmi_pad_power_down(struct phy *phy) udelay(2); tegra186_utmi_bias_pad_power_off(padctl); + + usb2->powered_on = false; } static int tegra186_xusb_padctl_vbus_override(struct tegra_xusb_padctl *padctl, @@ -413,6 +397,8 @@ static int tegra186_utmi_phy_power_on(struct phy *phy) return -ENODEV; } + mutex_lock(&padctl->lock); + value = padctl_readl(padctl, XUSB_PADCTL_USB2_PAD_MUX); value &= ~(USB2_PORT_MASK << USB2_PORT_SHIFT(index)); value |= (PORT_XUSB << USB2_PORT_SHIFT(index)); @@ -464,14 +450,23 @@ static int tegra186_utmi_phy_power_on(struct phy *phy) /* TODO: pad power saving */ tegra_phy_xusb_utmi_pad_power_on(phy); + + mutex_unlock(&padctl->lock); return 0; } static int tegra186_utmi_phy_power_off(struct phy *phy) { + struct tegra_xusb_lane *lane = phy_get_drvdata(phy); + struct tegra_xusb_padctl *padctl = lane->pad->padctl; + + mutex_lock(&padctl->lock); + /* TODO: pad power saving */
[PATCH V3 4/8] phy: tegra: xusb: Add USB2 pad power control support for Tegra210
Add USB2 pad power on and off API's for TEgra210 and provide its control via soc ops. It can be used by operations like charger detect to power on and off USB2 pad if needed. Signed-off-by: Nagarjuna Kristam Acked-by: Thierry Reding --- V3: - Added Acked-by updates to commit message. --- V2: - Patch re-based. --- drivers/phy/tegra/xusb-tegra210.c | 190 ++ 1 file changed, 133 insertions(+), 57 deletions(-) diff --git a/drivers/phy/tegra/xusb-tegra210.c b/drivers/phy/tegra/xusb-tegra210.c index 66bd461..caf0890 100644 --- a/drivers/phy/tegra/xusb-tegra210.c +++ b/drivers/phy/tegra/xusb-tegra210.c @@ -994,6 +994,128 @@ static int tegra210_xusb_padctl_id_override(struct tegra_xusb_padctl *padctl, return 0; } +static void tegra210_usb2_bias_pad_power_on(struct tegra_xusb_usb2_pad *pad) +{ + struct tegra_xusb_padctl *padctl = pad->base.padctl; + u32 value; + + if (pad->enable++ > 0) + return; + + dev_dbg(padctl->dev, "power on BIAS PAD & USB2 tracking\n"); + + if (clk_prepare_enable(pad->clk)) + dev_warn(padctl->dev, "failed to enable BIAS PAD & USB2 tracking\n"); + + value = padctl_readl(padctl, XUSB_PADCTL_USB2_BIAS_PAD_CTL1); + value &= ~((XUSB_PADCTL_USB2_BIAS_PAD_CTL1_TRK_START_TIMER_MASK << + XUSB_PADCTL_USB2_BIAS_PAD_CTL1_TRK_START_TIMER_SHIFT) | + (XUSB_PADCTL_USB2_BIAS_PAD_CTL1_TRK_DONE_RESET_TIMER_MASK << + XUSB_PADCTL_USB2_BIAS_PAD_CTL1_TRK_DONE_RESET_TIMER_SHIFT)); + value |= (XUSB_PADCTL_USB2_BIAS_PAD_CTL1_TRK_START_TIMER_VAL << + XUSB_PADCTL_USB2_BIAS_PAD_CTL1_TRK_START_TIMER_SHIFT) | +(XUSB_PADCTL_USB2_BIAS_PAD_CTL1_TRK_DONE_RESET_TIMER_VAL << + XUSB_PADCTL_USB2_BIAS_PAD_CTL1_TRK_DONE_RESET_TIMER_SHIFT); + padctl_writel(padctl, value, XUSB_PADCTL_USB2_BIAS_PAD_CTL1); + + value = padctl_readl(padctl, XUSB_PADCTL_USB2_BIAS_PAD_CTL0); + value &= ~XUSB_PADCTL_USB2_BIAS_PAD_CTL0_PD; + padctl_writel(padctl, value, XUSB_PADCTL_USB2_BIAS_PAD_CTL0); + + udelay(1); + + value = padctl_readl(padctl, XUSB_PADCTL_USB2_BIAS_PAD_CTL1); + value &= ~XUSB_PADCTL_USB2_BIAS_PAD_CTL1_PD_TRK; + padctl_writel(padctl, value, XUSB_PADCTL_USB2_BIAS_PAD_CTL1); + + udelay(50); +} + +static void tegra210_usb2_bias_pad_power_off(struct tegra_xusb_usb2_pad *pad) +{ + struct tegra_xusb_padctl *padctl = pad->base.padctl; + u32 value; + + if (WARN_ON(pad->enable == 0)) + return; + + if (--pad->enable > 0) + return; + + dev_dbg(padctl->dev, "power off USB2 tracking\n"); + + value = padctl_readl(padctl, XUSB_PADCTL_USB2_BIAS_PAD_CTL0); + value |= XUSB_PADCTL_USB2_BIAS_PAD_CTL0_PD; + padctl_writel(padctl, value, XUSB_PADCTL_USB2_BIAS_PAD_CTL0); + + clk_disable_unprepare(pad->clk); +} + +/* must be called under padctl->lock */ +void tegra210_usb2_pad_power_on(struct phy *phy) +{ + struct tegra_xusb_lane *lane = phy_get_drvdata(phy); + struct tegra_xusb_usb2_lane *usb2 = to_usb2_lane(lane); + struct tegra_xusb_usb2_pad *pad = to_usb2_pad(lane->pad); + struct tegra_xusb_padctl *padctl = lane->pad->padctl; + unsigned int index = lane->index; + u32 value; + + if (!phy) + return; + + if (usb2->powered_on) + return; + + dev_info(padctl->dev, "power on UTMI pads %d\n", index); + + tegra210_usb2_bias_pad_power_on(pad); + + udelay(2); + + value = padctl_readl(padctl, XUSB_PADCTL_USB2_OTG_PADX_CTL0(index)); + value &= ~XUSB_PADCTL_USB2_OTG_PAD_CTL0_PD; + padctl_writel(padctl, value, XUSB_PADCTL_USB2_OTG_PADX_CTL0(index)); + + value = padctl_readl(padctl, XUSB_PADCTL_USB2_OTG_PADX_CTL1(index)); + value &= ~XUSB_PADCTL_USB2_OTG_PAD_CTL1_PD_DR; + padctl_writel(padctl, value, XUSB_PADCTL_USB2_OTG_PADX_CTL1(index)); + + usb2->powered_on = true; +} + +/* must be called under padctl->lock */ +void tegra210_usb2_pad_power_down(struct phy *phy) +{ + struct tegra_xusb_lane *lane = phy_get_drvdata(phy); + struct tegra_xusb_usb2_lane *usb2 = to_usb2_lane(lane); + struct tegra_xusb_usb2_pad *pad = to_usb2_pad(lane->pad); + struct tegra_xusb_padctl *padctl = lane->pad->padctl; + unsigned int index = lane->index; + u32 value; + + if (!phy) + return; + + if (!usb2->powered_on) + return; + + dev_info(padctl->dev, "power down UTMI pad %d\n", index); + + value = padctl_readl(padctl, XUSB_PADCTL_USB2_OTG_PADX_CTL0(index)); + value |= XUSB_PADCTL_USB2_OTG_PAD_CTL0_PD; + padctl_writel(padctl, value, XUSB_PADCTL_USB2_OTG_PADX_CTL0(index)); + + value = padctl_readl(padctl, XUSB_PADCTL_USB2_OTG_PADX_CTL1(index)); + value |= XUSB_PADCTL_USB2_OTG_PAD_CTL1_PD_DR; +
[PATCH v7] Add matrix keypad driver support for Mediatek SoCs
Change since v6: - update keypad device tree document schema fengping.yu (3): dt-bindings: Add keypad devicetree documentation drivers: input: keyboard: Add mtk keypad driver configs: defconfig: Add CONFIG_KEYBOARD_MTK_KPD=y .../devicetree/bindings/input/mtk-kpd.yaml| 102 arch/arm64/configs/defconfig | 2 + drivers/input/keyboard/Kconfig| 8 + drivers/input/keyboard/Makefile | 1 + drivers/input/keyboard/mtk-kpd.c | 223 ++ 5 files changed, 336 insertions(+) create mode 100644 Documentation/devicetree/bindings/input/mtk-kpd.yaml create mode 100644 drivers/input/keyboard/mtk-kpd.c -- 2.18.0
Re: WARNING in memtype_reserve
On Thu, May 14, 2020 at 8:14 AM Christoph Hellwig wrote: > > Guys, can you please start formal thread on this? I have no > idea where this came from and what the rationale is. Btw, if the > pfn is crap in dma_direct_mmap then the dma_addr_t passed in is > crap, as it is derived from that. What is the caller, and how is > this triggered? FWIW the whole thread is available on lore: https://lore.kernel.org/lkml/20200514061417.ga8...@lst.de/T/#t
Re: [PATCH v1] driver core: Add state_synced sysfs file for devices that support it
On Wed, May 13, 2020 at 11:49:57AM -0700, Saravana Kannan wrote: > On Wed, May 13, 2020 at 1:34 AM Saravana Kannan wrote: > > > > On Wed, May 13, 2020 at 1:22 AM Greg Kroah-Hartman > > wrote: > > > > > > On Tue, May 12, 2020 at 06:34:15PM -0700, Saravana Kannan wrote: > > > > This can be used to check if a device supports sync_state() callbacks > > > > and therefore keeps resources left on by the bootloader enabled till all > > > > its consumers have probed. > > > > > > > > This can also be used to check if sync_state() has been called for a > > > > device or whether it is still trying to keep resources enabled because > > > > they were left enabled by the bootloader and all its consumers haven't > > > > probed yet. > > > > > > > > Signed-off-by: Saravana Kannan > > > > --- > > > > .../ABI/testing/sysfs-devices-state_synced| 24 +++ > > > > drivers/base/dd.c | 16 + > > > > 2 files changed, 40 insertions(+) > > > > create mode 100644 Documentation/ABI/testing/sysfs-devices-state_synced > > > > > > > > diff --git a/Documentation/ABI/testing/sysfs-devices-state_synced > > > > b/Documentation/ABI/testing/sysfs-devices-state_synced > > > > new file mode 100644 > > > > index ..0c922d7d02fc > > > > --- /dev/null > > > > +++ b/Documentation/ABI/testing/sysfs-devices-state_synced > > > > @@ -0,0 +1,24 @@ > > > > +What:/sys/devices/.../state_synced > > > > +Date:May 2020 > > > > +Contact: Saravana Kannan > > > > +Description: > > > > + The /sys/devices/.../state_synced attribute is only > > > > present for > > > > + devices whose bus types or driver provides the > > > > .sync_state() > > > > + callback. The number read from it (0 or 1) reflects the > > > > value > > > > + of the device's 'state_synced' field. A value of 0 means > > > > the > > > > + .sync_state() callback hasn't been called yet. A value of > > > > 1 > > > > + means the .sync_state() callback has been called. > > > > + > > > > + Generally, if a device has sync_state() support and has > > > > some of > > > > + the resources it provides enabled at the time the kernel > > > > starts > > > > + (Eg: enabled by hardware reset or bootloader or anything > > > > that > > > > + run before the kernel starts), then it'll keep those > > > > resources > > > > + enabled and in a state that's compatible with the state > > > > they > > > > + were in at the start of the kernel. The device will stop > > > > doing > > > > + this only when the sync_state() callback has been called > > > > -- > > > > + which happens only when all its consumer devices are > > > > registered > > > > + and have probed successfully. Resources that were left > > > > disabled > > > > + at the time the kernel starts are not affected or limited > > > > in > > > > + any way by sync_state() callbacks. > > > > + > > > > + > > > > diff --git a/drivers/base/dd.c b/drivers/base/dd.c > > > > index 48ca81cb8ebc..72599436ae84 100644 > > > > --- a/drivers/base/dd.c > > > > +++ b/drivers/base/dd.c > > > > @@ -458,6 +458,13 @@ static void > > > > driver_deferred_probe_add_trigger(struct device *dev, > > > > driver_deferred_probe_trigger(); > > > > } > > > > > > > > +static ssize_t state_synced_show(struct device *dev, > > > > + struct device_attribute *attr, char *buf) > > > > +{ > > > > + return sprintf(buf, "%u\n", dev->state_synced); > > > > +} > > > > +static DEVICE_ATTR_RO(state_synced); > > > > + > > > > static int really_probe(struct device *dev, struct device_driver *drv) > > > > { > > > > int ret = -EPROBE_DEFER; > > > > @@ -531,9 +538,16 @@ static int really_probe(struct device *dev, struct > > > > device_driver *drv) > > > > goto dev_groups_failed; > > > > } > > > > > > > > + if (dev_has_sync_state(dev) && > > > > + device_create_file(dev, &dev_attr_state_synced)) { > > > > + dev_err(dev, "state_synced sysfs add failed\n"); > > > > + goto dev_sysfs_state_synced_failed; > > > > + } > > > > > > Why not add this to the groups above this and only enable it if needed > > > at runtime? > > > > Those groups above seem to be driver specific groups. Looking at the > > code, some drivers seem to be setting them. Also, this attribute can > > only be decided after a driver has successfully bound to the device > > because dev_has_sync_state() has to check the bus and the driver for > > sync_state() support. > > > > > The is_visible() callback should be what you need to use here. > > > > If this is an attribute specific property, it might work. I'll take a look. > > I took a look at is_visible(). It only makes sense for a group of > attributes that are exposed in a
Re: WARNING in memtype_reserve
Guys, can you please start formal thread on this? I have no idea where this came from and what the rationale is. Btw, if the pfn is crap in dma_direct_mmap then the dma_addr_t passed in is crap, as it is derived from that. What is the caller, and how is this triggered?
[PATCH net-next] hinic: add set_ringparam ethtool_ops support
support to change TX/RX queue depth with ethtool -G Signed-off-by: Luo bin --- drivers/net/ethernet/huawei/hinic/hinic_dev.h | 2 + .../net/ethernet/huawei/hinic/hinic_ethtool.c | 78 ++- .../net/ethernet/huawei/hinic/hinic_hw_dev.c | 11 ++- .../net/ethernet/huawei/hinic/hinic_hw_dev.h | 2 +- .../net/ethernet/huawei/hinic/hinic_hw_io.c | 4 +- .../net/ethernet/huawei/hinic/hinic_hw_io.h | 3 + .../net/ethernet/huawei/hinic/hinic_hw_qp.c | 1 + .../net/ethernet/huawei/hinic/hinic_hw_qp.h | 3 + .../net/ethernet/huawei/hinic/hinic_main.c| 9 ++- .../net/ethernet/huawei/hinic/hinic_port.c| 2 +- .../net/ethernet/huawei/hinic/hinic_port.h| 4 + 11 files changed, 104 insertions(+), 15 deletions(-) diff --git a/drivers/net/ethernet/huawei/hinic/hinic_dev.h b/drivers/net/ethernet/huawei/hinic/hinic_dev.h index a621ebbf7610..48b40be3e84d 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_dev.h +++ b/drivers/net/ethernet/huawei/hinic/hinic_dev.h @@ -69,6 +69,8 @@ struct hinic_dev { struct hinic_txq*txqs; struct hinic_rxq*rxqs; + u16 sq_depth; + u16 rq_depth; struct hinic_txq_stats tx_stats; struct hinic_rxq_stats rx_stats; diff --git a/drivers/net/ethernet/huawei/hinic/hinic_ethtool.c b/drivers/net/ethernet/huawei/hinic/hinic_ethtool.c index b426eeced069..ace18d258049 100644 --- a/drivers/net/ethernet/huawei/hinic/hinic_ethtool.c +++ b/drivers/net/ethernet/huawei/hinic/hinic_ethtool.c @@ -538,12 +538,81 @@ static void hinic_get_drvinfo(struct net_device *netdev, static void hinic_get_ringparam(struct net_device *netdev, struct ethtool_ringparam *ring) { - ring->rx_max_pending = HINIC_RQ_DEPTH; - ring->tx_max_pending = HINIC_SQ_DEPTH; - ring->rx_pending = HINIC_RQ_DEPTH; - ring->tx_pending = HINIC_SQ_DEPTH; + struct hinic_dev *nic_dev = netdev_priv(netdev); + + ring->rx_max_pending = HINIC_MAX_QUEUE_DEPTH; + ring->tx_max_pending = HINIC_MAX_QUEUE_DEPTH; + ring->rx_pending = nic_dev->rq_depth; + ring->tx_pending = nic_dev->sq_depth; } +static int check_ringparam_valid(struct hinic_dev *nic_dev, +struct ethtool_ringparam *ring) +{ + if (ring->rx_jumbo_pending || ring->rx_mini_pending) { + netif_err(nic_dev, drv, nic_dev->netdev, + "Unsupported rx_jumbo_pending/rx_mini_pending\n"); + return -EINVAL; + } + + if (ring->tx_pending > HINIC_MAX_QUEUE_DEPTH || + ring->tx_pending < HINIC_MIN_QUEUE_DEPTH || + ring->rx_pending > HINIC_MAX_QUEUE_DEPTH || + ring->rx_pending < HINIC_MIN_QUEUE_DEPTH) { + netif_err(nic_dev, drv, nic_dev->netdev, + "Queue depth out of range [%d-%d]\n", + HINIC_MIN_QUEUE_DEPTH, HINIC_MAX_QUEUE_DEPTH); + return -EINVAL; + } + + return 0; +} + +static int hinic_set_ringparam(struct net_device *netdev, + struct ethtool_ringparam *ring) +{ + struct hinic_dev *nic_dev = netdev_priv(netdev); + u16 new_sq_depth, new_rq_depth; + int err; + + err = check_ringparam_valid(nic_dev, ring); + if (err) + return err; + + new_sq_depth = (u16)(1U << (u16)ilog2(ring->tx_pending)); + new_rq_depth = (u16)(1U << (u16)ilog2(ring->rx_pending)); + + if (new_sq_depth == nic_dev->sq_depth && + new_rq_depth == nic_dev->rq_depth) + return 0; + + netif_info(nic_dev, drv, netdev, + "Change Tx/Rx ring depth from %d/%d to %d/%d\n", + nic_dev->sq_depth, nic_dev->rq_depth, + new_sq_depth, new_rq_depth); + + nic_dev->sq_depth = new_sq_depth; + nic_dev->rq_depth = new_rq_depth; + + if (netif_running(netdev)) { + netif_info(nic_dev, drv, netdev, "Restarting netdev\n"); + err = hinic_close(netdev); + if (err) { + netif_err(nic_dev, drv, netdev, + "Failed to close netdev\n"); + return -EFAULT; + } + + err = hinic_open(netdev); + if (err) { + netif_err(nic_dev, drv, netdev, + "Failed to open netdev\n"); + return -EFAULT; + } + } + + return 0; +} static void hinic_get_channels(struct net_device *netdev, struct ethtool_channels *channels) { @@ -1148,6 +1217,7 @@ static const struct ethtool_ops hinic_ethtool_ops = { .get_drvinfo = hinic_get_drvinfo, .get_link = ethtool_op_get_link, .get_ringparam = hinic_get_ringparam, + .set_r
Re: [PATCHv1 01/19] kobject: increase allowed number of uevent variables
On Wed, May 13, 2020 at 08:55:57PM +0200, Sebastian Reichel wrote: > SBS battery driver exposes 32 power supply properties now, > which will result in uevent failure on (un)plugging the > battery. Other drivers (e.g. bq27xxx) are also coming close > to this limit, so increase it. > > Signed-off-by: Sebastian Reichel > --- > include/linux/kobject.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/include/linux/kobject.h b/include/linux/kobject.h > index e2ca0a292e21..75e822569e39 100644 > --- a/include/linux/kobject.h > +++ b/include/linux/kobject.h > @@ -29,7 +29,7 @@ > #include > > #define UEVENT_HELPER_PATH_LEN 256 > -#define UEVENT_NUM_ENVP 32 /* number of env > pointers */ > +#define UEVENT_NUM_ENVP 64 /* number of env > pointers */ > #define UEVENT_BUFFER_SIZE 2048/* buffer for the variables */ > > #ifdef CONFIG_UEVENT_HELPER Acked-by: Greg Kroah-Hartman
Re: [tracing] 06e0a548ba: WARNING:at_kernel/trace/ring_buffer.c:#ring_buffer_iter_peek
Hi Steve, On Wed, May 13, 2020 at 03:30:33PM -0400, Steven Rostedt wrote: > On Wed, 13 May 2020 18:15:57 +0200 > Sven Schnelle wrote: > > > Thanks for looking into this. I've attached my /proc/config.gz to this Mail. > > The x86 system is my Laptop which is a Thinkpad X280 with 4 HT CPUs (so 8 > > cpus > > in total). I've tried disabling preemption, but this didn't help. > > > > It's always this check that causes the loop: > > > > if (iter->head >= rb_page_size(iter->head_page)) { > > rb_inc_iter(iter); > > goto again; > > } > > > > On the first loop iter->head is some value > 0 and rb_page_size returns > > 0, afterwards it gets twice to this check with both values 0. The third > > time the warning is triggered. Maybe that information helps. > > I figured out what was causing this, and that's just that the writer and > the iterator could end up almost "in sync" where the writer writes to each > of the pages the iterator is trying to read, and this can trigger the three > failures of "zero commits" per page. > > I had a way to detect this, but then realized that it may be possible for > an active writer to possibly trigger the other failures to get an event, > that I just decided to force it to try three times, and simply return NULL > if an active writer is messing with the iterator. The iterator is a "best > effort" to read the buffer if there's an active writer. The consumer read > (trace_pipe) is made for that. > > This patch should solve you issues. > > (care to give a Tested-by: if it works for you?) Well, as there's no longer a RB_WARN_ON that indeed fixes the issue :-) Tested-by: Sven Schnelle Thanks! Sven
RE: [PATCH] fpga: dfl: afu: Corrected error handling levels
> -Original Message- > From: Xu, Yilun > Sent: Thursday, May 14, 2020 10:30 AM > To: Souptick Joarder > Cc: Wu, Hao ; m...@kernel.org; linux- > f...@vger.kernel.org; linux-kernel@vger.kernel.org > Subject: Re: [PATCH] fpga: dfl: afu: Corrected error handling levels > > The patch looks good to me. > > Maybe we could add the Fixes tag: > Fixes: fa8dda1edef9 (fpga: dfl: afu: add > DFL_FPGA_PORT_DMA_MAP/UNMAP ioctls support) Thanks for catching this problem. With this line, Acked-by: Wu Hao Thanks! Hao > > Thanks, > Yilun > > On Thu, May 14, 2020 at 12:52:05AM +0530, Souptick Joarder wrote: > > Corrected error handling goto sequnece. Level put_pages should > > be called when pinned pages >= 0 && pinned != npages. Level > > free_pages should be called when pinned pages < 0. > > > > Signed-off-by: Souptick Joarder > > --- > > drivers/fpga/dfl-afu-dma-region.c | 4 ++-- > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/fpga/dfl-afu-dma-region.c b/drivers/fpga/dfl-afu-dma- > region.c > > index 62f9244..5942343 100644 > > --- a/drivers/fpga/dfl-afu-dma-region.c > > +++ b/drivers/fpga/dfl-afu-dma-region.c > > @@ -61,10 +61,10 @@ static int afu_dma_pin_pages(struct > dfl_feature_platform_data *pdata, > > region->pages); > > if (pinned < 0) { > > ret = pinned; > > - goto put_pages; > > + goto free_pages; > > } else if (pinned != npages) { > > ret = -EFAULT; > > - goto free_pages; > > + goto put_pages; > > } > > > > dev_dbg(dev, "%d pages pinned\n", pinned); > > -- > > 1.9.1
Re: linux-next: manual merge of the vfs tree with the parisc-hd tree
On 2020/5/13 20:50, Luis Chamberlain wrote: On Wed, May 13, 2020 at 12:04:02PM +0800, Xiaoming Ni wrote: On 2020/5/13 6:03, Luis Chamberlain wrote: On Tue, May 12, 2020 at 12:40:55PM -0500, Eric W. Biederman wrote: Luis Chamberlain writes: On Tue, May 12, 2020 at 06:52:35AM -0500, Eric W. Biederman wrote: Luis Chamberlain writes: +static struct ctl_table fs_base_table[] = { + { + .procname = "fs", + .mode = 0555, + .child = fs_table, + }, + { } +}; You don't need this at all. +static int __init fs_procsys_init(void) +{ + struct ctl_table_header *hdr; + + hdr = register_sysctl_table(fs_base_table); ^ Please use register_sysctl instead. AKA hdr = register_sysctl("fs", fs_table); Ah, much cleaner thanks! It is my hope you we can get rid of register_sysctl_table one of these days. It was the original interface but today it is just a compatibility wrapper. I unfortunately ran out of steam last time before I finished converting everything over. Let's give it one more go. I'll start with the fs stuff. Luis . If we register each feature in its own feature code file using register() to register the sysctl interface. To avoid merge conflicts when different features modify sysctl.c at the same time. that is, try to Avoid mixing code with multiple features in the same code file. For example, the multiple file interfaces defined in sysctl.c by the hung_task feature can be moved to hung_task.c. Perhaps later, without centralized sysctl.c ? Is this better? Thanks Xiaoming Ni --- include/linux/sched/sysctl.h | 8 + kernel/hung_task.c | 78 +++- kernel/sysctl.c | 50 3 files changed, 78 insertions(+), 58 deletions(-) diff --git a/include/linux/sched/sysctl.h b/include/linux/sched/sysctl.h index d4f6215..bb4e0d3 100644 --- a/include/linux/sched/sysctl.h +++ b/include/linux/sched/sysctl.h @@ -7,14 +7,8 @@ struct ctl_table; #ifdef CONFIG_DETECT_HUNG_TASK -extern int sysctl_hung_task_check_count; -extern unsigned int sysctl_hung_task_panic; +/* used for block/ */ extern unsigned long sysctl_hung_task_timeout_secs; -extern unsigned long sysctl_hung_task_check_interval_secs; -extern int sysctl_hung_task_warnings; -extern int proc_dohung_task_timeout_secs(struct ctl_table *table, int write, -void __user *buffer, -size_t *lenp, loff_t *ppos); #else /* Avoid need for ifdefs elsewhere in the code */ enum { sysctl_hung_task_timeout_secs = 0 }; diff --git a/kernel/hung_task.c b/kernel/hung_task.c index 14a625c..53589f2 100644 --- a/kernel/hung_task.c +++ b/kernel/hung_task.c @@ -20,10 +20,10 @@ #include #include #include +#include #include #include - /* * The number of tasks checked: */ @@ -296,8 +296,84 @@ static int watchdog(void *dummy) return 0; } +/* + * This is needed for proc_doulongvec_minmax of sysctl_hung_task_timeout_secs + * and hung_task_check_interval_secs + */ +static unsigned long hung_task_timeout_max = (LONG_MAX / HZ); This is not generic so it can stay in this file. +static int __maybe_unused neg_one = -1; This is generic so we can share it, I suggest we just rename this for now to sysctl_neg_one, export it to a symbol namespace, EXPORT_SYMBOL_NS_GPL(sysctl_neg_one, SYSCTL) and then import it with MODULE_IMPORT_NS(SYSCTL) +static struct ctl_table hung_task_sysctls[] = { We want to wrap this around with CONFIG_SYSCTL, so a cleaner solution is something like this: diff --git a/kernel/Makefile b/kernel/Makefile index a42ac3a58994..689718351754 100644 --- a/kernel/Makefile +++ b/kernel/Makefile @@ -88,7 +88,9 @@ obj-$(CONFIG_KCOV) += kcov.o obj-$(CONFIG_KPROBES) += kprobes.o obj-$(CONFIG_FAIL_FUNCTION) += fail_function.o obj-$(CONFIG_KGDB) += debug/ -obj-$(CONFIG_DETECT_HUNG_TASK) += hung_task.o +obj-$(CONFIG_DETECT_HUNG_TASK) += hung_tasks.o +hung_tasks-y := hung_task.o +hung_tasks-$(CONFIG_SYSCTL) += hung_task_sysctl.o obj-$(CONFIG_LOCKUP_DETECTOR) += watchdog.o obj-$(CONFIG_HARDLOCKUP_DETECTOR_PERF) += watchdog_hld.o obj-$(CONFIG_SECCOMP) += seccomp.o +/* get /proc/sys/kernel root */ +static struct ctl_table sysctls_root[] = { + { + .procname = "kernel", + .mode = 0555, + .child = hung_task_sysctls, + }, + {} +}; + And as per Eric, this is not needed, we can simplify this more, as noted below. +static int __init hung_task_sysctl_init(void) +{ + struct ctl_table_header *srt = register_sysctl_table(sysctls_root); You want instead something like:: struct ctl_table_header *srt; srt = register_sysctl("kernel", hung_task_sysctls);
Re: [PATCH 1/2] dt-bindings: pinctrl: qcom: Add sm8250 pinctrl bindings
On Wed 29 Apr 14:34 PDT 2020, Rob Herring wrote: > On Thu, Apr 16, 2020 at 11:19:06PM -0700, Bjorn Andersson wrote: > > diff --git > > a/Documentation/devicetree/bindings/pinctrl/qcom,sm8250-pinctrl.yaml > > b/Documentation/devicetree/bindings/pinctrl/qcom,sm8250-pinctrl.yaml [..] > > +#PIN CONFIGURATION NODES > > +patternProperties: > > + '^.*$': > > +if: > > + type: object > > +then: > > Needs a $ref to the standard properties. > > Would be good to show a child node in the example too. (And try having > an error in a standard property type to verify you get an error). > Finally looked into this. By $ref'ing pinmux-node.yaml I can drop pins and function from below properties, and by $ref'ing pincfg-node.yaml I can drop the pinconf entries listed. But how do I $ref both? What's the appropriate method for amending pins, function and drive-strength with the more specific value set? Should I both $ref them and list them here? How do I limit which standard properties are actually supported in this binding? Thanks, Bjorn > > + properties: > > +pins: > > + description: > > +List of gpio pins affected by the properties specified in this > > +subnode. > > + items: > > +oneOf: > > + - pattern: "^gpio([0-9]|[1-9][0-9]|1[0-7][0-9])$" > > + - enum: [ sdc2_clk, sdc2_cmd, sdc2_data, ufs_reset ] > > + minItems: 1 > > + maxItems: 36 > > + > > +function: > > + description: > > +Specify the alternative function to be configured for the > > specified > > +pins. > > + > > + enum: [ aoss_cti, atest, audio_ref, cam_mclk, cci_async, cci_i2c, > > +cci_timer0, cci_timer1, cci_timer2, cci_timer3, cci_timer4, > > cri_trng, > > +cri_trng0, cri_trng1, dbg_out, ddr_bist, ddr_pxi0, ddr_pxi1, > > +ddr_pxi2, ddr_pxi3, dp_hot, dp_lcd, gcc_gp1, gcc_gp2, gcc_gp3, > > gpio, > > +ibi_i3c, jitter_bist, lpass_slimbus, mdp_vsync, mdp_vsync0, > > +mdp_vsync1, mdp_vsync2, mdp_vsync3, mi2s0_data0, mi2s0_data1, > > +mi2s0_sck, mi2s0_ws, mi2s1_data0, mi2s1_data1, mi2s1_sck, > > mi2s1_ws, > > +mi2s2_data0, mi2s2_data1, mi2s2_sck, mi2s2_ws, pci_e0, pci_e1, > > +pci_e2, phase_flag, pll_bist, pll_bypassnl, pll_clk, pll_reset, > > +pri_mi2s, prng_rosc, qdss_cti, qdss_gpio, qspi0, qspi1, qspi2, > > qspi3, > > +qspi_clk, qspi_cs, qup0, qup1, qup10, qup11, qup12, qup13, > > qup14, > > +qup15, qup16, qup17, qup18, qup19, qup2, qup3, qup4, qup5, > > qup6, > > +qup7, qup8, qup9, qup_l4, qup_l5, qup_l6, sd_write, sdc40, > > sdc41, > > +sdc42, sdc43, sdc4_clk, sdc4_cmd, sec_mi2s, sp_cmu, tgu_ch0, > > tgu_ch1, > > +tgu_ch2, tgu_ch3, tsense_pwm1, tsense_pwm2, tsif0_clk, > > tsif0_data, > > +tsif0_en, tsif0_error, tsif0_sync, tsif1_clk, tsif1_data, > > tsif1_en, > > +tsif1_error, tsif1_sync, usb2phy_ac, usb_phy, vsense_trigger ] > > + > > +drive-strength: > > + enum: [2, 4, 6, 8, 10, 12, 14, 16] > > + default: 2 > > + description: > > +Selects the drive strength for the specified pins, in mA. > > + > > +bias-pull-down: true > > + > > +bias-pull-up: true > > + > > +bias-disable: true > > + > > +output-high: true > > + > > +output-low: true > > + > > + required: > > +- pins > > +- function > > + > > + additionalProperties: false > > + > > +required: > > + - compatible > > + - reg > > + - reg-names > > + - interrupts > > + - interrupt-controller > > + - '#interrupt-cells' > > + - gpio-controller > > + - '#gpio-cells' > > + - gpio-ranges > > + > > +additionalProperties: false > > + > > +examples: > > + - | > > +#include > > +pinctrl@1f0 { > > +compatible = "qcom,sm8250-pinctrl"; > > +reg = <0x0f10 0x30>, > > + <0x0f50 0x30>, > > + <0x0f90 0x30>; > > +reg-names = "west", "south", "north"; > > +interrupts = ; > > +gpio-controller; > > +#gpio-cells = <2>; > > +interrupt-controller; > > +#interrupt-cells = <2>; > > +gpio-ranges = <&tlmm 0 0 180>; > > +wakeup-parent = <&pdc>; > > +}; > > -- > > 2.24.0 > >
[PATCH] kernel/sched/wait.c: set timeout to 0 when kthread should stop
Using kthread_stop() to terminate a thread causes tcp_recvmsg() to enter a dead loop when the kernel thread uses tcp_recvmsg() to receive a message. tcp_recvmsg()-->sk_wait_data()-->sk_wait_event()-->wait_woken(). wait_woken() will directly return unchanged timeout value rather than be executed as normally. tcp_recvmsg () will continues to execute sk_wait_data(). So finally this situation will creat an endless loop that cannot be exited. Signed-off-by: Qingjie Xing --- kernel/sched/wait.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kernel/sched/wait.c b/kernel/sched/wait.c index ba059fb..a27bbbd 100644 --- a/kernel/sched/wait.c +++ b/kernel/sched/wait.c @@ -431,6 +431,8 @@ long wait_woken(struct wait_queue_entry *wq_entry, unsigned mode, long timeout) set_current_state(mode); /* A */ if (!(wq_entry->flags & WQ_FLAG_WOKEN) && !is_kthread_should_stop()) timeout = schedule_timeout(timeout); + if (is_kthread_should_stop()) + timeout = 0; __set_current_state(TASK_RUNNING); /* -- 1.8.3.1
[PATCH] riscv: perf: fix build error for dependency issue
CONFIG_RISCV_BASE_PMU can be selected or unselected, but in fact, CONFIG_RISCV_BASE_PMU must be always selected when selecting CONFIG_PERF_EVENTS on current perf implementation, otherwise, it would cause the build error when only selecting CONFIG_PERF_EVENTS. The build case is applied randconfig which generated by kbuild test. This patch removes the unnecessary configuration and implementations. Eventually, the number of counters should be determinated at runtime, such as DTB, so we don't need to re-build kernel for various platform which has got different number of hpmcounters. Signed-off-by: Zong Li Signed-off-by: Greentime Hu --- arch/riscv/Kconfig | 13 - arch/riscv/include/asm/perf_event.h | 16 +++- 2 files changed, 3 insertions(+), 26 deletions(-) diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig index 74f82cf4f781..7d5123576953 100644 --- a/arch/riscv/Kconfig +++ b/arch/riscv/Kconfig @@ -283,19 +283,6 @@ config RISCV_ISA_C If you don't know what to do here, say Y. -menu "supported PMU type" - depends on PERF_EVENTS - -config RISCV_BASE_PMU - bool "Base Performance Monitoring Unit" - def_bool y - help - A base PMU that serves as a reference implementation and has limited - feature of perf. It can run on any RISC-V machines so serves as the - fallback, but this option can also be disable to reduce kernel size. - -endmenu - config FPU bool "FPU support" default y diff --git a/arch/riscv/include/asm/perf_event.h b/arch/riscv/include/asm/perf_event.h index 0234048b12bc..8e5b1d81112c 100644 --- a/arch/riscv/include/asm/perf_event.h +++ b/arch/riscv/include/asm/perf_event.h @@ -16,15 +16,11 @@ /* * The RISCV_MAX_COUNTERS parameter should be specified. + * Currently, we only support base PMU, so just make + * RISCV_MAX_COUNTERS be equal to RISCV_BASE_COUNTERS. */ -#ifdef CONFIG_RISCV_BASE_PMU -#define RISCV_MAX_COUNTERS 2 -#endif - -#ifndef RISCV_MAX_COUNTERS -#error "Please provide a valid RISCV_MAX_COUNTERS for the PMU." -#endif +#define RISCV_MAX_COUNTERS RISCV_BASE_COUNTERS /* * These are the indexes of bits in counteren register *minus* 1, @@ -38,12 +34,6 @@ */ #define RISCV_PMU_CYCLE0 #define RISCV_PMU_INSTRET 1 -#define RISCV_PMU_MHPMCOUNTER3 2 -#define RISCV_PMU_MHPMCOUNTER4 3 -#define RISCV_PMU_MHPMCOUNTER5 4 -#define RISCV_PMU_MHPMCOUNTER6 5 -#define RISCV_PMU_MHPMCOUNTER7 6 -#define RISCV_PMU_MHPMCOUNTER8 7 #define RISCV_OP_UNSUPP(-EOPNOTSUPP) -- 2.26.2
Re: [PATCH v13 4/8] iommu/vt-d: Add bind guest PASID support
> + if (dev_is_pci(dev)) { > + /* VT-d supports devices with full 20 bit PASIDs only */ > + if (pci_max_pasids(to_pci_dev(dev)) != PASID_MAX) > + return -EINVAL; > + } else { > + return -ENOTSUPP; > + } This looks strange. Why not: if (!dev_is_pci(dev)) { return -ENOTSUPP; /* VT-d supports devices with full 20 bit PASIDs only */ if (pci_max_pasids(to_pci_dev(dev)) != PASID_MAX) return -EINVAL; > + for_each_svm_dev(sdev, svm, dev) { > + /* > + * For devices with aux domains, we should allow > multiple > + * bind calls with the same PASID and pdev. > + */ > + if (iommu_dev_feature_enabled(dev, IOMMU_DEV_FEAT_AUX)) > { > + sdev->users++; > + } else { > + dev_warn_ratelimited(dev, "Already bound with > PASID %u\n", > + svm->pasid); > + ret = -EBUSY; > + } > + goto out; Is this intentionally a for loop that jumps out of the loop after the first device? > + /* > + * PASID table is per device for better security. Therefore, for > + * each bind of a new device even with an existing PASID, we need to > + * call the nested mode setup function here. > + */ > + spin_lock(&iommu->lock); > + ret = intel_pasid_setup_nested(iommu, > +dev, > +(pgd_t *)data->gpgd, > +data->hpasid, > +&data->vtd, > +dmar_domain, > +data->addr_width); Why not: et = intel_pasid_setup_nested(iommu, dev, (pgd_t *)data->gpgd, data->hpasid, &data->vtd, dmar_domain, data->addr_width); ? > + for_each_svm_dev(sdev, svm, dev) { > + ret = 0; ... > + break; > + } Same only looks at the first device style. Why dos it only care about the first device? That needs at least a comment, and probably a first_svm_dev or so heper to make it explicit.
Re: linux-next: manual merge of the mlx5-next tree with the rdma tree
On Thu, May 14, 2020 at 12:59:20PM +1000, Stephen Rothwell wrote: > Hi all, > > Today's linux-next merge of the mlx5-next tree got a conflict in: > > drivers/infiniband/hw/mlx5/main.c > > between commit: > > 2be08c308f10 ("RDMA/mlx5: Delete create QP flags obfuscation") > > from the rdma tree and commit: > > 14c129e30152 ("{IB/net}/mlx5: Simplify don't trap code") > > from the mlx5-next tree. > > I fixed it up (the latter change included the former) and can carry the > fix as necessary. This is now fixed as far as linux-next is concerned, > but any non trivial conflicts should be mentioned to your upstream > maintainer when your tree is submitted for merging. You may also want > to consider cooperating with the maintainer of the conflicting tree to > minimise any particularly complex conflicts. Thanks Stephen, The mlx5-next branch was merged to rdma-next tonight and this conflict will disappear in next the linux-next. Thanks > > -- > Cheers, > Stephen Rothwell signature.asc Description: PGP signature
Re: [PATCH v13 3/8] iommu/vt-d: Add nested translation helper function
> + * 1. CPU vs. IOMMU > + * 2. Guest vs. Host. > + */ > + switch (addr_width) { > +#ifdef CONFIG_X86 > + case ADDR_WIDTH_5LEVEL: > + if (cpu_feature_enabled(X86_FEATURE_LA57) && > + cap_5lp_support(iommu->cap)) { > + pasid_set_flpm(pte, 1); > + } else { > + dev_err_ratelimited(dev, "5-level paging not > supported\n"); > + return -EINVAL; > + } > + break; The normal style would be to handle the early error return first: if (!cpu_feature_enabled(X86_FEATURE_LA57) || !cap_5lp_support(iommu->cap)) { dev_err_ratelimited(dev, "5-level paging not supported\n"); return -EINVAL; } pasid_set_flpm(pte, 1); break;
Re: [PATCH v13 2/8] iommu/vt-d: Use a helper function to skip agaw for SL
On Wed, May 13, 2020 at 04:01:43PM -0700, Jacob Pan wrote: > An Intel iommu domain uses 5-level page table by default. If the > iommu that the domain tries to attach supports less page levels, > the top level page tables should be skipped. Add a helper to do > this so that it could be used in other places. Please use up all 73 chars for the commit log.
Re: [PATCH] Revert "mmc: sdhci-xenon: add runtime pm support and reimplement standby"
On Wed, 13 May 2020 14:15:21 +0200 Ulf Hansson wrote: > > > On Wed, 13 May 2020 at 11:47, Jisheng Zhang > wrote: > > > > This reverts commit a027b2c5fed78851e69fab395b02d127a7759fc7. > > > > The HW supports auto clock gating, so it's useless to do runtime pm > > in software. > > Runtime PM isn't soley about clock gating. Moreover it manages the Per my understanding, current xenon rpm implementation is just clock gating. > "pltfm_host->clk", which means even if the controller supports auto > clock gating, gating/ungating the externally provided clock still > makes sense. clock --- xenon IP |___ rpm |__ HW Auto clock gate Per my understanding, with rpm, both clock and IP is clock gated; while with Auto clock gate, the IP is clock gated. So the only difference is clock itself. Considering the gain(suspect we have power consumption gain, see below), the pay -- 56 LoCs and latency doesn't deserve gain. Even if considering from power consumption POV, sdhci_runtime_suspend_host(), sdhci_runtime_resume_host(), and the retune process could be more than the clock itself. > > Kind regards > Uffe > > > > > Signed-off-by: Jisheng Zhang > > --- > > drivers/mmc/host/sdhci-xenon.c | 87 +++--- > > drivers/mmc/host/sdhci-xenon.h | 1 - > > 2 files changed, 16 insertions(+), 72 deletions(-) > > > > diff --git a/drivers/mmc/host/sdhci-xenon.c b/drivers/mmc/host/sdhci-xenon.c > > index 4703cd540c7f..85414e13e7ea 100644 > > --- a/drivers/mmc/host/sdhci-xenon.c > > +++ b/drivers/mmc/host/sdhci-xenon.c > > @@ -15,8 +15,6 @@ > > #include > > #include > > #include > > -#include > > -#include > > > > #include "sdhci-pltfm.h" > > #include "sdhci-xenon.h" > > @@ -539,24 +537,13 @@ static int xenon_probe(struct platform_device *pdev) > > if (err) > > goto err_clk_axi; > > > > - pm_runtime_get_noresume(&pdev->dev); > > - pm_runtime_set_active(&pdev->dev); > > - pm_runtime_set_autosuspend_delay(&pdev->dev, 50); > > - pm_runtime_use_autosuspend(&pdev->dev); > > - pm_runtime_enable(&pdev->dev); > > - pm_suspend_ignore_children(&pdev->dev, 1); > > - > > err = sdhci_add_host(host); > > if (err) > > goto remove_sdhc; > > > > - pm_runtime_put_autosuspend(&pdev->dev); > > - > > return 0; > > > > remove_sdhc: > > - pm_runtime_disable(&pdev->dev); > > - pm_runtime_put_noidle(&pdev->dev); > > xenon_sdhc_unprepare(host); > > err_clk_axi: > > clk_disable_unprepare(priv->axi_clk); > > @@ -573,10 +560,6 @@ static int xenon_remove(struct platform_device *pdev) > > struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); > > struct xenon_priv *priv = sdhci_pltfm_priv(pltfm_host); > > > > - pm_runtime_get_sync(&pdev->dev); > > - pm_runtime_disable(&pdev->dev); > > - pm_runtime_put_noidle(&pdev->dev); > > - > > sdhci_remove_host(host, 0); > > > > xenon_sdhc_unprepare(host); > > @@ -593,78 +576,40 @@ static int xenon_suspend(struct device *dev) > > { > > struct sdhci_host *host = dev_get_drvdata(dev); > > struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); > > - struct xenon_priv *priv = sdhci_pltfm_priv(pltfm_host); > > int ret; > > > > - ret = pm_runtime_force_suspend(dev); > > + ret = sdhci_suspend_host(host); > > + if (ret) > > + return ret; > > > > - priv->restore_needed = true; > > + clk_disable_unprepare(pltfm_host->clk); > > return ret; > > } > > -#endif > > > > -#ifdef CONFIG_PM > > -static int xenon_runtime_suspend(struct device *dev) > > +static int xenon_resume(struct device *dev) > > { > > struct sdhci_host *host = dev_get_drvdata(dev); > > struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); > > - struct xenon_priv *priv = sdhci_pltfm_priv(pltfm_host); > > int ret; > > > > - ret = sdhci_runtime_suspend_host(host); > > + ret = clk_prepare_enable(pltfm_host->clk); > > if (ret) > > return ret; > > > > - if (host->tuning_mode != SDHCI_TUNING_MODE_3) > > - mmc_retune_needed(host->mmc); > > - > > - clk_disable_unprepare(pltfm_host->clk); > > /* > > -* Need to update the priv->clock here, or when runtime resume > > -* back, phy don't aware the clock change and won't adjust phy > > -* which will cause cmd err > > +* If SoCs power off the entire Xenon, registers setting will > > +* be lost. > > +* Re-configure Xenon specific register to enable current SDHC > > */ > > - priv->clock = 0; > > - return 0; > > -} > > - > > -static int xenon_runtime_resume(struct device *dev) > > -{ > > - struct sdhci_host *host = dev_get_drvdata(dev); > > - struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); > > - struct xen
Re: [PATCH v4 3/4] perf stat: Copy counts from prev_raw_counts to evsel->counts
Hi Jiri, On 5/13/2020 11:31 PM, Jiri Olsa wrote: On Fri, May 08, 2020 at 03:58:16PM +0800, Jin Yao wrote: It would be useful to support the overall statistics for perf-stat interval mode. For example, report the summary at the end of "perf-stat -I" output. But since perf-stat can support many aggregation modes, such as --per-thread, --per-socket, -M and etc, we need a solution which doesn't bring much complexity. The idea is to use 'evsel->prev_raw_counts' which is updated in each interval and it's saved with the latest counts. Before reporting the summary, we copy the counts from evsel->prev_raw_counts to evsel->counts, and next we just follow non-interval processing. In evsel__compute_deltas, this patch saves counts to the member [cpu0,thread0] of perf_counts for AGGR_GLOBAL. That's because after copying evsel->prev_raw_counts to evsel->counts, perf_counts(evsel->counts, cpu, thread) are all 0 for AGGR_GLOBAL. Once we go to process_counter_maps again, all members of perf_counts are 0. So this patch uses a trick that saves the previous aggr value to the member [cpu0,thread0] of perf_counts, then aggr calculation in process_counter_values can work correctly. v4: --- Change the commit message. No functional change. Signed-off-by: Jin Yao --- tools/perf/util/evsel.c | 1 + tools/perf/util/stat.c | 24 tools/perf/util/stat.h | 1 + 3 files changed, 26 insertions(+) diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c index 28683b0eb738..6fae1ec28886 100644 --- a/tools/perf/util/evsel.c +++ b/tools/perf/util/evsel.c @@ -1283,6 +1283,7 @@ void evsel__compute_deltas(struct evsel *evsel, int cpu, int thread, if (cpu == -1) { tmp = evsel->prev_raw_counts->aggr; evsel->prev_raw_counts->aggr = *count; + *perf_counts(evsel->prev_raw_counts, 0, 0) = *count; ok, I think I understand that now.. it's only for AGGR_GLOBAL mode, because the perf_stat_process_counter will create aggr values from per cpu values but why do we need to do that all the time? can't we just set it up before you zero prev_raw_counts in next patch? if (interval) { stat_config.interval = 0; stat_config.summary = true; perf_evlist__copy_prev_raw_counts(evsel_list); -> for AGGR_GLOBAL set the counts[0,0] to prev_raw_counts->aggr perf_evlist__reset_prev_raw_counts(evsel_list); runtime_stat_reset(&stat_config); perf_stat__reset_shadow_per_stat(&rt_stat); } Yes, I think that's a good idea. Now in v5, I create a new patch "perf stat: Save aggr value to first member of prev_raw_counts" to save aggr value to first member of prev_raw_counts for AGGR_GLOBAL. Then next, perf_stat_process_counter can create aggr values from per cpu values successfully. Thanks Jin Yao thanks, jirka
Re: [PATCH v5 2/6] spi: spi-geni-qcom: Use OPP API to set clk/perf state
On Wed 13 May 22:03 PDT 2020, Rajendra Nayak wrote: > > [].. > > > > spi->bus_num = -1; > > > spi->dev.of_node = dev->of_node; > > > @@ -596,6 +607,9 @@ static int spi_geni_probe(struct platform_device > > > *pdev) > > > spi_geni_probe_runtime_disable: > > > pm_runtime_disable(dev); > > > spi_master_put(spi); > > > + if (mas->se.has_opp_table) > > > > Why do you need has_opp_table? > > > > Afaict if dev_pm_opp_of_add_table() returns -ENODEV there's no attached > > opp-table and dev_pm_opp_of_remove_table() is a nop. > > Apparently its not. Calling dev_pm_opp_of_remove_table() when > dev_pm_opp_of_add_table() > failed causes use-count mismatch. > You can see https://lkml.org/lkml/2020/4/15/18 for more details. > Must have missed that when I glanced at the code, thanks for clarifying. Regards, Bjorn > -- > QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member > of Code Aurora Forum, hosted by The Linux Foundation
[PATCH v5 2/5] perf counts: Reset prev_raw_counts counts
When we want to reset the evsel->prev_raw_counts, zeroing the aggr is not enough, we need to reset the perf_counts too. The perf_counts__reset zeros the perf_counts, and it should zero the aggr too. This patch changes perf_counts__reset to non-static, and calls it in evsel__reset_prev_raw_counts to reset the prev_raw_counts. v4: --- Zeroing the aggr in perf_counts__reset and use it to reset prev_raw_counts. Signed-off-by: Jin Yao --- tools/perf/util/counts.c | 4 +++- tools/perf/util/counts.h | 1 + tools/perf/util/stat.c | 7 ++- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tools/perf/util/counts.c b/tools/perf/util/counts.c index 615c9f3e95cb..582f3aeaf5e4 100644 --- a/tools/perf/util/counts.c +++ b/tools/perf/util/counts.c @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0 #include #include +#include #include "evsel.h" #include "counts.h" #include @@ -42,10 +43,11 @@ void perf_counts__delete(struct perf_counts *counts) } } -static void perf_counts__reset(struct perf_counts *counts) +void perf_counts__reset(struct perf_counts *counts) { xyarray__reset(counts->loaded); xyarray__reset(counts->values); + memset(&counts->aggr, 0, sizeof(struct perf_counts_values)); } void evsel__reset_counts(struct evsel *evsel) diff --git a/tools/perf/util/counts.h b/tools/perf/util/counts.h index 8f556c6d98fa..7ff36bf6d644 100644 --- a/tools/perf/util/counts.h +++ b/tools/perf/util/counts.h @@ -37,6 +37,7 @@ perf_counts__set_loaded(struct perf_counts *counts, int cpu, int thread, bool lo struct perf_counts *perf_counts__new(int ncpus, int nthreads); void perf_counts__delete(struct perf_counts *counts); +void perf_counts__reset(struct perf_counts *counts); void evsel__reset_counts(struct evsel *evsel); int evsel__alloc_counts(struct evsel *evsel, int ncpus, int nthreads); diff --git a/tools/perf/util/stat.c b/tools/perf/util/stat.c index f4a44df9b221..e397815f0dfb 100644 --- a/tools/perf/util/stat.c +++ b/tools/perf/util/stat.c @@ -163,11 +163,8 @@ static void evsel__free_prev_raw_counts(struct evsel *evsel) static void evsel__reset_prev_raw_counts(struct evsel *evsel) { - if (evsel->prev_raw_counts) { - evsel->prev_raw_counts->aggr.val = 0; - evsel->prev_raw_counts->aggr.ena = 0; - evsel->prev_raw_counts->aggr.run = 0; - } + if (evsel->prev_raw_counts) + perf_counts__reset(evsel->prev_raw_counts); } static int evsel__alloc_stats(struct evsel *evsel, bool alloc_raw) -- 2.17.1
[PATCH v5 1/5] perf stat: Fix wrong per-thread runtime stat for interval mode
root@kbl-ppc:~# perf stat --per-thread -e cycles,instructions -I1000 --interval-count 2 1.004171683 perf-3696 8,747,311 cycles ... 1.004171683 perf-3696691,730 instructions #0.08 insn per cycle ... 2.006490373 perf-3696 1,749,936 cycles ... 2.006490373 perf-3696 1,484,582 instructions #0.28 insn per cycle ... Let's see interval 2.006490373 perf-3696 1,749,936 cycles perf-3696 1,484,582 instructions #0.28 insn per cycle insn per cycle = 1,484,582 / 1,749,936 = 0.85. But now it's 0.28, that's not correct. stat_config.stats[] records the per-thread runtime stat. But for interval mode, it should be reset for each interval. So now, with this patch, root@kbl-ppc:~# perf stat --per-thread -e cycles,instructions -I1000 --interval-count 2 1.005818121 perf-8633 9,898,045 cycles ... 1.005818121 perf-8633693,298 instructions #0.07 insn per cycle ... 2.007863743 perf-8633 1,551,619 cycles ... 2.007863743 perf-8633 1,317,514 instructions #0.85 insn per cycle ... Let's check interval 2.007863743. insn per cycle = 1,317,514 / 1,551,619 = 0.85. It's correct. This patch creates runtime_stat_reset, places it next to untime_stat_new/runtime_stat_delete and moves all runtime_stat functions before process_interval. v4: --- Create runtime_stat_reset. Fixes: commit 14e72a21c783 ("perf stat: Update or print per-thread stats") Signed-off-by: Jin Yao --- tools/perf/builtin-stat.c | 70 +++ 1 file changed, 41 insertions(+), 29 deletions(-) diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c index e0c1ad23c768..f3b3a59ac7d2 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c @@ -351,6 +351,46 @@ static void read_counters(struct timespec *rs) } } +static int runtime_stat_new(struct perf_stat_config *config, int nthreads) +{ + int i; + + config->stats = calloc(nthreads, sizeof(struct runtime_stat)); + if (!config->stats) + return -1; + + config->stats_num = nthreads; + + for (i = 0; i < nthreads; i++) + runtime_stat__init(&config->stats[i]); + + return 0; +} + +static void runtime_stat_delete(struct perf_stat_config *config) +{ + int i; + + if (!config->stats) + return; + + for (i = 0; i < config->stats_num; i++) + runtime_stat__exit(&config->stats[i]); + + zfree(&config->stats); +} + +static void runtime_stat_reset(struct perf_stat_config *config) +{ + int i; + + if (!config->stats) + return; + + for (i = 0; i < config->stats_num; i++) + perf_stat__reset_shadow_per_stat(&config->stats[i]); +} + static void process_interval(void) { struct timespec ts, rs; @@ -359,6 +399,7 @@ static void process_interval(void) diff_timespec(&rs, &ts, &ref_time); perf_stat__reset_shadow_per_stat(&rt_stat); + runtime_stat_reset(&stat_config); read_counters(&rs); if (STAT_RECORD) { @@ -1737,35 +1778,6 @@ int process_cpu_map_event(struct perf_session *session, return set_maps(st); } -static int runtime_stat_new(struct perf_stat_config *config, int nthreads) -{ - int i; - - config->stats = calloc(nthreads, sizeof(struct runtime_stat)); - if (!config->stats) - return -1; - - config->stats_num = nthreads; - - for (i = 0; i < nthreads; i++) - runtime_stat__init(&config->stats[i]); - - return 0; -} - -static void runtime_stat_delete(struct perf_stat_config *config) -{ - int i; - - if (!config->stats) - return; - - for (i = 0; i < config->stats_num; i++) - runtime_stat__exit(&config->stats[i]); - - zfree(&config->stats); -} - static const char * const stat_report_usage[] = { "perf stat report []", NULL, -- 2.17.1
[PATCH v5 3/5] perf stat: Copy counts from prev_raw_counts to evsel->counts
It would be useful to support the overall statistics for perf-stat interval mode. For example, report the summary at the end of "perf-stat -I" output. But since perf-stat can support many aggregation modes, such as --per-thread, --per-socket, -M and etc, we need a solution which doesn't bring much complexity. The idea is to use 'evsel->prev_raw_counts' which is updated in each interval and it's saved with the latest counts. Before reporting the summary, we copy the counts from evsel->prev_raw_counts to evsel->counts, and next we just follow non-interval processing. v5: --- Don't save the previous aggr value to the member of [cpu0,thread0] in perf_counts. Originally that was a trick because the perf_stat_process_counter would create aggr values from per cpu values. But we don't need to do that all the time. We will handle it in next patch. v4: --- Change the commit message. No functional change. Signed-off-by: Jin Yao --- tools/perf/util/stat.c | 24 tools/perf/util/stat.h | 1 + 2 files changed, 25 insertions(+) diff --git a/tools/perf/util/stat.c b/tools/perf/util/stat.c index e397815f0dfb..aadc723ce871 100644 --- a/tools/perf/util/stat.c +++ b/tools/perf/util/stat.c @@ -225,6 +225,30 @@ void perf_evlist__reset_prev_raw_counts(struct evlist *evlist) evsel__reset_prev_raw_counts(evsel); } +static void perf_evsel__copy_prev_raw_counts(struct evsel *evsel) +{ + int ncpus = evsel__nr_cpus(evsel); + int nthreads = perf_thread_map__nr(evsel->core.threads); + + for (int thread = 0; thread < nthreads; thread++) { + for (int cpu = 0; cpu < ncpus; cpu++) { + *perf_counts(evsel->counts, cpu, thread) = + *perf_counts(evsel->prev_raw_counts, cpu, +thread); + } + } + + evsel->counts->aggr = evsel->prev_raw_counts->aggr; +} + +void perf_evlist__copy_prev_raw_counts(struct evlist *evlist) +{ + struct evsel *evsel; + + evlist__for_each_entry(evlist, evsel) + perf_evsel__copy_prev_raw_counts(evsel); +} + static void zero_per_pkg(struct evsel *counter) { if (counter->per_pkg_mask) diff --git a/tools/perf/util/stat.h b/tools/perf/util/stat.h index b4fdfaa7f2c0..62cf72c71869 100644 --- a/tools/perf/util/stat.h +++ b/tools/perf/util/stat.h @@ -198,6 +198,7 @@ int perf_evlist__alloc_stats(struct evlist *evlist, bool alloc_raw); void perf_evlist__free_stats(struct evlist *evlist); void perf_evlist__reset_stats(struct evlist *evlist); void perf_evlist__reset_prev_raw_counts(struct evlist *evlist); +void perf_evlist__copy_prev_raw_counts(struct evlist *evlist); int perf_stat_process_counter(struct perf_stat_config *config, struct evsel *counter); -- 2.17.1
[PATCH v5 4/5] perf stat: Save aggr value to first member of prev_raw_counts
To collect the overall statistics for interval mode, we copy the counts from evsel->prev_raw_counts to evsel->counts. For AGGR_GLOBAL mode, because the perf_stat_process_counter creates aggr values from per cpu values, but the per cpu values are 0, so the calculated aggr values will be always 0. This patch uses a trick that saves the previous aggr value to the first member of perf_counts, then aggr calculation in process_counter_values can work correctly for AGGR_GLOBAL. Signed-off-by: Jin Yao --- tools/perf/util/stat.c | 10 ++ tools/perf/util/stat.h | 1 + 2 files changed, 11 insertions(+) diff --git a/tools/perf/util/stat.c b/tools/perf/util/stat.c index aadc723ce871..fbabdd5b9b62 100644 --- a/tools/perf/util/stat.c +++ b/tools/perf/util/stat.c @@ -249,6 +249,16 @@ void perf_evlist__copy_prev_raw_counts(struct evlist *evlist) perf_evsel__copy_prev_raw_counts(evsel); } +void perf_evlist__save_aggr_prev_raw_counts(struct evlist *evlist) +{ + struct evsel *evsel; + + evlist__for_each_entry(evlist, evsel) { + *perf_counts(evsel->prev_raw_counts, 0, 0) = + evsel->prev_raw_counts->aggr; + } +} + static void zero_per_pkg(struct evsel *counter) { if (counter->per_pkg_mask) diff --git a/tools/perf/util/stat.h b/tools/perf/util/stat.h index 62cf72c71869..18ead55756cc 100644 --- a/tools/perf/util/stat.h +++ b/tools/perf/util/stat.h @@ -199,6 +199,7 @@ void perf_evlist__free_stats(struct evlist *evlist); void perf_evlist__reset_stats(struct evlist *evlist); void perf_evlist__reset_prev_raw_counts(struct evlist *evlist); void perf_evlist__copy_prev_raw_counts(struct evlist *evlist); +void perf_evlist__save_aggr_prev_raw_counts(struct evlist *evlist); int perf_stat_process_counter(struct perf_stat_config *config, struct evsel *counter); -- 2.17.1
[PATCH v5 0/5] perf stat: Support overall statistics for interval mode
Currently perf-stat supports to print counts at regular interval (-I), but it's not very easy for user to get the overall statistics. With this patchset, it supports to report the summary at the end of interval output. For example, root@kbl-ppc:~# perf stat -e cycles -I1000 --interval-count 2 # time counts unit events 1.000412064 2,281,114 cycles 2.001383658 2,547,880 cycles Performance counter stats for 'system wide': 4,828,994 cycles 2.002860349 seconds time elapsed root@kbl-ppc:~# perf stat -e cycles,instructions -I1000 --interval-count 2 # time counts unit events 1.000389902 1,536,093 cycles 1.000389902420,226 instructions #0.27 insn per cycle 2.001433453 2,213,952 cycles 2.001433453735,465 instructions #0.33 insn per cycle Performance counter stats for 'system wide': 3,750,045 cycles 1,155,691 instructions #0.31 insn per cycle 2.003023361 seconds time elapsed root@kbl-ppc:~# perf stat -M CPI,IPC -I1000 --interval-count 2 # time counts unit events 1.000435121905,303 inst_retired.any # 2.9 CPI 1.000435121 2,663,333 cycles 1.000435121914,702 inst_retired.any # 0.3 IPC 1.000435121 2,676,559 cpu_clk_unhalted.thread 2.001615941 1,951,092 inst_retired.any # 1.8 CPI 2.001615941 3,551,357 cycles 2.001615941 1,950,837 inst_retired.any # 0.5 IPC 2.001615941 3,551,044 cpu_clk_unhalted.thread Performance counter stats for 'system wide': 2,856,395 inst_retired.any # 2.2 CPI 6,214,690 cycles 2,865,539 inst_retired.any # 0.5 IPC 6,227,603 cpu_clk_unhalted.thread 2.003403078 seconds time elapsed v5: --- 1. Create new patch "perf stat: Save aggr value to first member of prev_raw_counts". 2. Call perf_evlist__save_aggr_prev_raw_counts to save aggr value to first member of prev_raw_counts for AGGR_GLOBAL. Then next, perf_stat_process_counter can create aggr values from per cpu values. Following patches are impacted in v5: perf stat: Copy counts from prev_raw_counts to evsel->counts perf stat: Save aggr value to first member of prev_raw_counts perf stat: Report summary for interval mode v4: --- 1. Create runtime_stat_reset. 2. Zero the aggr in perf_counts__reset and use it to reset prev_raw_counts. 3. Move affinity setup and read_counter_cpu to a new function read_affinity_counters. It's only called when stat_config.summary is not set. v3: --- 1. 'perf stat: Fix wrong per-thread runtime stat for interval mode' is a new patch which fixes an existing issue found in test. 2. We use the prev_raw_counts for summary counts. Drop the summary_counts in v2. 3. Fix some issues. v2: --- Rebase to perf/core branch Jin Yao (5): perf stat: Fix wrong per-thread runtime stat for interval mode perf counts: Reset prev_raw_counts counts perf stat: Copy counts from prev_raw_counts to evsel->counts perf stat: Save aggr value to first member of prev_raw_counts perf stat: Report summary for interval mode tools/perf/builtin-stat.c | 101 ++ tools/perf/util/counts.c | 4 +- tools/perf/util/counts.h | 1 + tools/perf/util/stat.c| 43 +--- tools/perf/util/stat.h| 3 ++ 5 files changed, 113 insertions(+), 39 deletions(-) -- 2.17.1
Re: [PATCH] optee: don't fail on unsuccessful device enumeration
Hi Volodymyr, On Thu, 14 May 2020 at 06:48, Volodymyr Babchuk wrote: > > Hi Sumit, > > On Wed, 13 May 2020 at 11:24, Sumit Garg wrote: > > > > Hi Volodymyr, > > > > On Wed, 13 May 2020 at 13:30, Jens Wiklander > > wrote: > > > > > > Hi Volodymyr, > > > > > > On Wed, May 13, 2020 at 2:36 AM Volodymyr Babchuk > > > wrote: > > > > > > > > optee_enumerate_devices() can fail for multiple of reasons. For > > > > example, I encountered issue when Xen OP-TEE mediator NACKed > > > > PTA_CMD_GET_DEVICES call. > > > > Could you share a detailed description of the issue which you are > > facing? optee_enumerate_devices() is a simple invocation of pseudo TA > > and cases where OP-TEE doesn't provide corresponding pseudo TA are > > handled very well. > > Yes, I did some research and looks like issue is broader, than I > expected. It is my fault, that I wasn't paying attention to the tee > client support in the kernel. Basically, it is incompatible with the > virtualization feature. You see, the main issue with virtual machines > is the second stage MMU. Intermediate physical address, that appear to > be contiguous for the kernel may be not contiguous in the real > physical memory due to 2nd stage MMU mappings. This is the reason I > introduced OPTEE_MSG_ATTR_NONCONTIG in the kernel driver. > > But, looks like kernel-side optee client does not use this feature. It > tries to provide SHM buffer as a simple contiguous span of memory. Xen > blocks calls with OPTEE_MSG_ATTR_TYPE_TMEM_* but without > OPTEE_MSG_ATTR_NONCONTIG , because it can't translate IPAs to PAs for > such buffers. This is why call to PTA_CMD_GET_DEVICES fails. > > Valid fix would be to use OPTEE_MSG_ATTR_NONCONTIG whenever possible. > Thanks for the detailed analysis. It looks like you are missing the following fix patch in your tree which basically fixed broken tee_shm_alloc() in case dynamic shared memory is enabled (IIRC virtualization only supports dynamic shared memory). commit a249dd200d03791cab23e47571f3e13d9c72af6c Author: Sumit Garg Date: Fri Nov 8 16:57:14 2019 +0530 tee: optee: Fix dynamic shm pool allocations In case of dynamic shared memory pool, kernel memory allocated using dmabuf_mgr pool needs to be registered with OP-TEE prior to its usage during optee_open_session() or optee_invoke_func(). So fix dmabuf_mgr pool allocations via an additional call to optee_shm_register(). Also, allow kernel pages to be registered as shared memory with OP-TEE. Fixes: 9733b072a12a ("optee: allow to work without static shared memory") Signed-off-by: Sumit Garg Signed-off-by: Jens Wiklander After this fix, your issue should be resolved as it uses OPTEE_MSG_ATTR_NONCONTIG attribute for kernel memory allocated via tee_shm_alloc(). > > > > > > This should not result in driver > > > > initialization error because this is an optional feature. > > > > I wouldn't call it an optional feature as there might be real kernel > > drivers dependent on this enumeration. Also, it is a simple example to > > self test OP-TEE functionality too. So I am not sure how much > > functional OP-TEE would be if this basic TA invocation fails. > > Well, it fixed case when Xen is involved. I think, this is valid > combination, when platform have the newest OP-TEE, but slightly older > kernel. So, imagine that OP-TEE provides PTA_CMD_GET_DEVICES, but > kernel can't use because it uses plain TMEM arguments,which are not > supported in virtualized environment. > > If there are kernel drivers, that depend on this PTA, they would not > work in any case. But at least userspace clients still be able to use > OP-TEE. This is why I call this feature "optional". As you can see above, tee_shm_alloc() being broken in your case was detected via this simple pseudo TA invocation. So IMO, it would be better to keep the existing behaviour as it provides a kind of basic OP-TEE driver runtime self test too. Also, I think it would be a better user experience to have every OP-TEE interface working rather than a partially broken interface. -Sumit > > -- > WBR Volodymyr Babchuk aka lorc [+380976646013] > mailto: vlad.babc...@gmail.com
[PATCH v5 5/5] perf stat: Report summary for interval mode
Currently perf-stat supports to print counts at regular interval (-I), but it's not very easy for user to get the overall statistics. The patch uses 'evsel->prev_raw_counts' to get counts for summary. Copy the counts to 'evsel->counts' after printing the interval results. Next, we just follow the non-interval processing. Let's see some examples, root@kbl-ppc:~# perf stat -e cycles -I1000 --interval-count 2 # time counts unit events 1.000412064 2,281,114 cycles 2.001383658 2,547,880 cycles Performance counter stats for 'system wide': 4,828,994 cycles 2.002860349 seconds time elapsed root@kbl-ppc:~# perf stat -e cycles,instructions -I1000 --interval-count 2 # time counts unit events 1.000389902 1,536,093 cycles 1.000389902420,226 instructions #0.27 insn per cycle 2.001433453 2,213,952 cycles 2.001433453735,465 instructions #0.33 insn per cycle Performance counter stats for 'system wide': 3,750,045 cycles 1,155,691 instructions #0.31 insn per cycle 2.003023361 seconds time elapsed root@kbl-ppc:~# perf stat -M CPI,IPC -I1000 --interval-count 2 # time counts unit events 1.000435121905,303 inst_retired.any # 2.9 CPI 1.000435121 2,663,333 cycles 1.000435121914,702 inst_retired.any # 0.3 IPC 1.000435121 2,676,559 cpu_clk_unhalted.thread 2.001615941 1,951,092 inst_retired.any # 1.8 CPI 2.001615941 3,551,357 cycles 2.001615941 1,950,837 inst_retired.any # 0.5 IPC 2.001615941 3,551,044 cpu_clk_unhalted.thread Performance counter stats for 'system wide': 2,856,395 inst_retired.any # 2.2 CPI 6,214,690 cycles 2,865,539 inst_retired.any # 0.5 IPC 6,227,603 cpu_clk_unhalted.thread 2.003403078 seconds time elapsed v5: --- Call perf_evlist__save_aggr_prev_raw_counts to save aggr value to first member of prev_raw_counts for AGGR_GLOBAL. Then next, perf_stat_process_counter can create aggr values from per cpu values. v4: --- Move affinity setup and read_counter_cpu to a new function read_affinity_counters. It's only called when stat_config.summary is not set. v3: --- Use evsel->prev_raw_counts for summary counts v2: --- Rebase to perf/core branch Signed-off-by: Jin Yao --- tools/perf/builtin-stat.c | 31 --- tools/perf/util/stat.c| 2 +- tools/perf/util/stat.h| 1 + 3 files changed, 30 insertions(+), 4 deletions(-) diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c index f3b3a59ac7d2..24deed746325 100644 --- a/tools/perf/builtin-stat.c +++ b/tools/perf/builtin-stat.c @@ -314,14 +314,14 @@ static int read_counter_cpu(struct evsel *counter, struct timespec *rs, int cpu) return 0; } -static void read_counters(struct timespec *rs) +static int read_affinity_counters(struct timespec *rs) { struct evsel *counter; struct affinity affinity; int i, ncpus, cpu; if (affinity__setup(&affinity) < 0) - return; + return -1; ncpus = perf_cpu_map__nr(evsel_list->core.all_cpus); if (!target__has_cpu(&target) || target__has_per_thread(&target)) @@ -341,6 +341,15 @@ static void read_counters(struct timespec *rs) } } affinity__cleanup(&affinity); + return 0; +} + +static void read_counters(struct timespec *rs) +{ + struct evsel *counter; + + if (!stat_config.summary && (read_affinity_counters(rs) < 0)) + return; evlist__for_each_entry(evsel_list, counter) { if (counter->err) @@ -394,6 +403,7 @@ static void runtime_stat_reset(struct perf_stat_config *config) static void process_interval(void) { struct timespec ts, rs; + struct stats walltime_nsecs_stats_bak; clock_gettime(CLOCK_MONOTONIC, &ts); diff_timespec(&rs, &ts, &ref_time); @@ -407,9 +417,11 @@ static void process_interval(void) pr_err("failed to write stat round event\n"); } + walltime_nsecs_stats_bak = walltime_nsecs_stats; init_stats(&walltime_nsecs_stats); update_stats(&walltime_nsecs_stats, stat_config.interval * 100); print_counters(&rs, 0, NULL); + walltime_nsecs_stats = walltime_nsecs_stats_bak; } static void enable_counters(void) @@ -765,6 +777,19 @@ static int __run_perf_stat(int argc, const char **argv, int run_idx) update_stats(&walltime_nsecs_stats, t1 - t0
Re: [PATCH v4] bus: mhi: core: Handle syserr during power_up
On Thu, May 07, 2020 at 10:19:31AM -0600, Jeffrey Hugo wrote: > The MHI device may be in the syserr state when we attempt to init it in > power_up(). Since we have no local state, the handling is simple - > reset the device and wait for it to transition out of the reset state. > > Signed-off-by: Jeffrey Hugo Reviewed-by: Manivannan Sadhasivam Will apply this patch to mhi-next and include in the 5.8 series. Thanks, Mani > --- > > v4: > -Implemented Hemant's suggested solution from v2. The spec will be amended > to indicate the intvec interrupt will be triggered for the reset state change > which matches the current implementations and enables Hemant's solution to > be used, which is cleaner. > > drivers/bus/mhi/core/pm.c | 27 +++ > 1 file changed, 27 insertions(+) > > diff --git a/drivers/bus/mhi/core/pm.c b/drivers/bus/mhi/core/pm.c > index dc83d65..ddef693 100644 > --- a/drivers/bus/mhi/core/pm.c > +++ b/drivers/bus/mhi/core/pm.c > @@ -760,6 +760,7 @@ static void mhi_deassert_dev_wake(struct mhi_controller > *mhi_cntrl, > > int mhi_async_power_up(struct mhi_controller *mhi_cntrl) > { > + enum mhi_state state; > enum mhi_ee_type current_ee; > enum dev_st_transition next_state; > struct device *dev = &mhi_cntrl->mhi_dev->dev; > @@ -829,6 +830,32 @@ int mhi_async_power_up(struct mhi_controller *mhi_cntrl) > goto error_bhi_offset; > } > > + state = mhi_get_mhi_state(mhi_cntrl); > + if (state == MHI_STATE_SYS_ERR) { > + mhi_set_mhi_state(mhi_cntrl, MHI_STATE_RESET); > + ret = wait_event_timeout(mhi_cntrl->state_event, > + MHI_PM_IN_FATAL_STATE(mhi_cntrl->pm_state) || > + mhi_read_reg_field(mhi_cntrl, > +mhi_cntrl->regs, > +MHICTRL, > +MHICTRL_RESET_MASK, > +MHICTRL_RESET_SHIFT, > +&val) || > + !val, > + msecs_to_jiffies(mhi_cntrl->timeout_ms)); > + if (ret) { > + ret = -EIO; > + dev_info(dev, "Failed to reset MHI due to syserr > state\n"); > + goto error_bhi_offset; > + } > + > + /* > + * device cleares INTVEC as part of RESET processing, > + * re-program it > + */ > + mhi_write_reg(mhi_cntrl, mhi_cntrl->bhi, BHI_INTVEC, 0); > + } > + > /* Transition to next state */ > next_state = MHI_IN_PBL(current_ee) ? > DEV_ST_TRANSITION_PBL : DEV_ST_TRANSITION_READY; > -- > Qualcomm Technologies, Inc. is a member of the > Code Aurora Forum, a Linux Foundation Collaborative Project.
Re: gcc-10: kernel stack is corrupted and fails to boot
On Wed, May 13, 2020 at 09:52:07PM -0700, Linus Torvalds wrote: > On Wed, May 13, 2020, 20:50 Andy Lutomirski wrote: > > > > > LTO isn’t a linker taking regular .o files full of regular machine > > code and optimizing it. That’s nuts. > > > > Yeah, you're right. I wear originally thinking just an optimizing > assembler, and then started thinking about link-time optimizations in that > sense, but it was wrong to then go from that to LTO which has a very > specific meaning. > > We do have assemblers that do some optimizations, but they tend to all be > at the single instruction level (eg things like turning "add $128" into > "sub $-128" which fits in a byte constant). > > Linus > > > The gcc docs [1,2] at least don't inspire much confidence that this will continue working with plain asm("") though: "Note that GCC’s optimizers can move asm statements relative to other code, including across jumps." ... "Note that the compiler can move even volatile asm instructions relative to other code, including across jump instructions." Even if we don't include an instruction in it I think it should at least have a memory clobber, to stop the compiler from deciding that it can be moved before the call so it can do the tail-call optimization. [1] https://gcc.gnu.org/onlinedocs/gcc/Basic-Asm.html#Basic-Asm [2] https://gcc.gnu.org/onlinedocs/gcc/Extended-Asm.html#Volatile
Re: [PATCH v2 11/12] remoteproc: stm32: Introduce new loaded rsc ops for synchronisation
On Fri 24 Apr 13:25 PDT 2020, Mathieu Poirier wrote: > Introduce new elf find loaded resource table rproc_ops functions to be > used when synchonising with an MCU. > > Mainly based on the work published by Arnaud Pouliquen [1]. > > [1]. https://patchwork.kernel.org/project/linux-remoteproc/list/?series=239877 > > Signed-off-by: Mathieu Poirier > Reviewed-by: Loic Pallardy Reviewed-by: Bjorn Andersson But I would have preferred if we during probe (when we discover rsc_va) could just set it on the rproc. Regards, Bjorn > --- > drivers/remoteproc/stm32_rproc.c | 10 ++ > 1 file changed, 10 insertions(+) > > diff --git a/drivers/remoteproc/stm32_rproc.c > b/drivers/remoteproc/stm32_rproc.c > index b8ae8aed5585..dcae6103e3df 100644 > --- a/drivers/remoteproc/stm32_rproc.c > +++ b/drivers/remoteproc/stm32_rproc.c > @@ -319,6 +319,15 @@ static int stm32_rproc_sync_parse_fw(struct rproc *rproc, > return stm32_rproc_sync_elf_load_rsc_table(rproc, fw); > } > > +static struct resource_table * > +stm32_rproc_sync_elf_find_loaded_rsc_table(struct rproc *rproc, > +const struct firmware *fw) > +{ > + struct stm32_rproc *ddata = rproc->priv; > + > + return (struct resource_table *)ddata->rsc_va; > +} > + > static irqreturn_t stm32_rproc_wdg(int irq, void *data) > { > struct platform_device *pdev = data; > @@ -593,6 +602,7 @@ static __maybe_unused struct rproc_ops st_rproc_sync_ops > = { > .start = stm32_rproc_sync_start, > .stop = stm32_rproc_stop, > .parse_fw = stm32_rproc_sync_parse_fw, > + .find_loaded_rsc_table = stm32_rproc_sync_elf_find_loaded_rsc_table, > }; > > static const struct of_device_id stm32_rproc_match[] = { > -- > 2.20.1 >
Re: [PATCH v2 10/12] remoteproc: stm32: Introduce new parse fw ops for synchronisation
On Fri 24 Apr 13:25 PDT 2020, Mathieu Poirier wrote: > Introduce new parse firmware rproc_ops functions to be used when > synchonising with an MCU. > > Mainly based on the work published by Arnaud Pouliquen [1]. > > [1]. https://patchwork.kernel.org/project/linux-remoteproc/list/?series=239877 > > Signed-off-by: Mathieu Poirier > Reviewed-by: Loic Pallardy > --- > drivers/remoteproc/stm32_rproc.c | 51 +++- > 1 file changed, 50 insertions(+), 1 deletion(-) > > diff --git a/drivers/remoteproc/stm32_rproc.c > b/drivers/remoteproc/stm32_rproc.c > index 86d23c35d805..b8ae8aed5585 100644 > --- a/drivers/remoteproc/stm32_rproc.c > +++ b/drivers/remoteproc/stm32_rproc.c > @@ -215,7 +215,34 @@ static int stm32_rproc_elf_load_rsc_table(struct rproc > *rproc, > return 0; > } > > -static int stm32_rproc_parse_fw(struct rproc *rproc, const struct firmware > *fw) > +static int stm32_rproc_sync_elf_load_rsc_table(struct rproc *rproc, > +const struct firmware *fw) > +{ > + struct resource_table *table = NULL; > + struct stm32_rproc *ddata = rproc->priv; > + > + if (ddata->rsc_va) { Does it really make sense to try to sync with a remote that doesn't have a resource table? > + table = (struct resource_table *)ddata->rsc_va; > + /* Assuming that the resource table fits in 1kB is fair */ > + rproc->cached_table = kmemdup(table, RSC_TBL_SIZE, GFP_KERNEL); It's unfortunate that we need to create a clone of the resource table that we found in ram, and then return the original memory when the core ask for the loaded table... I wonder if we somehow can avoid this in the core (i.e. skip overwriting table_ptr with the cached_table during stop) > + if (!rproc->cached_table) > + return -ENOMEM; > + > + rproc->table_ptr = rproc->cached_table; > + rproc->table_sz = RSC_TBL_SIZE; > + return 0; > + } > + > + rproc->cached_table = NULL; > + rproc->table_ptr = NULL; > + rproc->table_sz = 0; > + > + dev_warn(&rproc->dev, "no resource table found for this firmware\n"); > + return 0; > +} > + > +static int stm32_rproc_parse_memory_regions(struct rproc *rproc, > + const struct firmware *fw) > { > struct device *dev = rproc->dev.parent; > struct device_node *np = dev->of_node; > @@ -268,9 +295,30 @@ static int stm32_rproc_parse_fw(struct rproc *rproc, > const struct firmware *fw) > index++; > } > > + return 0; > +} > + > +static int stm32_rproc_parse_fw(struct rproc *rproc, const struct firmware > *fw) > +{ > + int ret = stm32_rproc_parse_memory_regions(rproc, fw); > + > + if (ret) > + return ret; > + > return stm32_rproc_elf_load_rsc_table(rproc, fw); > } > > +static int stm32_rproc_sync_parse_fw(struct rproc *rproc, > + const struct firmware *fw) Rather than having a function parse_fw that is passed no fw and return some state that was setup in probe, how about just do this during probe? Regards, Bjorn > +{ > + int ret = stm32_rproc_parse_memory_regions(rproc, fw); > + > + if (ret) > + return ret; > + > + return stm32_rproc_sync_elf_load_rsc_table(rproc, fw); > +} > + > static irqreturn_t stm32_rproc_wdg(int irq, void *data) > { > struct platform_device *pdev = data; > @@ -544,6 +592,7 @@ static struct rproc_ops st_rproc_ops = { > static __maybe_unused struct rproc_ops st_rproc_sync_ops = { > .start = stm32_rproc_sync_start, > .stop = stm32_rproc_stop, > + .parse_fw = stm32_rproc_sync_parse_fw, > }; > > static const struct of_device_id stm32_rproc_match[] = { > -- > 2.20.1 >
Re: [Jfs-discussion] [fs] 05c5a0273b: netperf.Throughput_total_tps -71.8% regression
On 5/14/20 12:27 PM, Christian Kujau wrote: On Tue, 12 May 2020, kernel test robot wrote: FYI, we noticed a -71.8% regression of netperf.Throughput_total_tps due to commit: As noted in this report, netperf is used to "measure various aspect of networking performance". Are we sure the bisect is correct? JFS is a filesystem and is not touching net/ in any way. So, having not attempted to reproduce this, maybe the JFS commit is a red herring? C. Hi, The commit also causes -74.6% regression of will-it-scale.per_thread_ops: in testcase: will-it-scale on test machine: 8 threads Intel(R) Core(TM) i7-3770K CPU @ 3.50GHz with 16G memory with following parameters: nr_task: 100% mode: thread test: unlink2 cpufreq_governor: performance ucode: 0x21 I'll send another report for this regression. Best Regards, Rong Chen
Re: [PATCH v1] ASoC: rsnd: add interrupt support for SSI BUSIF buffer
Hi Yongbo, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on asoc/for-next] [also build test WARNING on v5.7-rc5 next-20200511] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see https://stackoverflow.com/a/37406982] url: https://github.com/0day-ci/linux/commits/Yongbo-Zhang/ASoC-rsnd-add-interrupt-support-for-SSI-BUSIF-buffer/20200511-184903 base: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next reproduce: # apt-get install sparse # sparse version: v0.6.1-191-gc51a0382-dirty make ARCH=x86_64 allmodconfig make C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' :: branch date: 8 hours ago :: commit date: 8 hours ago If you fix the issue, kindly add following tag as appropriate Reported-by: kbuild test robot sparse warnings: (new ones prefixed by >>) sound/soc/sh/rcar/ssi.c:596:1: sparse: sparse: mixing declarations and code include/sound/pcm_params.h:377:0: sparse: sparse: Expected } at end of function include/sound/pcm_params.h:377:0: sparse: sparse: got end-of-input >> sound/soc/sh/rcar/ssi.c:798:56: sparse: sparse: not enough arguments for >> function rsnd_mod_write # https://github.com/0day-ci/linux/commit/23aaae15fe2b41fd05caf5e0773d41021bc03e27 git remote add linux-review https://github.com/0day-ci/linux git remote update linux-review git checkout 23aaae15fe2b41fd05caf5e0773d41021bc03e27 vim +798 sound/soc/sh/rcar/ssi.c 615fb6c7b13b7f Kuninori Morimoto 2016-02-18 733 d8d9b9730cd62c Kuninori Morimoto 2017-12-11 734 static bool rsnd_ssi_pio_interrupt(struct rsnd_mod *mod, d8d9b9730cd62c Kuninori Morimoto 2017-12-11 735 struct rsnd_dai_stream *io); bfc0cfe6b7acb1 Kuninori Morimoto 2015-06-15 736 static void __rsnd_ssi_interrupt(struct rsnd_mod *mod, bfc0cfe6b7acb1 Kuninori Morimoto 2015-06-15 737 struct rsnd_dai_stream *io) ae5c322303fff5 Kuninori Morimoto 2013-07-21 738 { 690602fcd85385 Kuninori Morimoto 2015-01-15 739struct rsnd_priv *priv = rsnd_mod_to_priv(mod); 2b62786951ca38 Kuninori Morimoto 2018-02-13 740struct device *dev = rsnd_priv_to_dev(priv); 765ae7c8dda7d0 Kuninori Morimoto 2015-01-15 741int is_dma = rsnd_ssi_is_dma_mode(mod); 02299d9875bab5 Kuninori Morimoto 2015-05-21 742u32 status; 75defee0f1b3fc Kuninori Morimoto 2015-06-15 743bool elapsed = false; 6a25c8da00284f Kuninori Morimoto 2016-01-26 744bool stop = false; 23aaae15fe2b41 Yongbo Zhang 2020-05-11 745int is_tdm, is_tdm_split; 23aaae15fe2b41 Yongbo Zhang 2020-05-11 746 23aaae15fe2b41 Yongbo Zhang 2020-05-11 747is_tdm = rsnd_runtime_is_tdm(io); 23aaae15fe2b41 Yongbo Zhang 2020-05-11 748is_tdm_split= rsnd_runtime_is_tdm_split(io); 02299d9875bab5 Kuninori Morimoto 2015-05-21 749 02299d9875bab5 Kuninori Morimoto 2015-05-21 750spin_lock(&priv->lock); ae5c322303fff5 Kuninori Morimoto 2013-07-21 751 02299d9875bab5 Kuninori Morimoto 2015-05-21 752/* ignore all cases if not working */ d5bbe7de563ccc Kuninori Morimoto 2015-06-15 753if (!rsnd_io_is_working(io)) 02299d9875bab5 Kuninori Morimoto 2015-05-21 754goto rsnd_ssi_interrupt_out; 02299d9875bab5 Kuninori Morimoto 2015-05-21 755 6a25c8da00284f Kuninori Morimoto 2016-01-26 756status = rsnd_ssi_status_get(mod); 4e7d606cd52aa8 Kuninori Morimoto 2014-11-27 757 4e7d606cd52aa8 Kuninori Morimoto 2014-11-27 758/* PIO only */ d8d9b9730cd62c Kuninori Morimoto 2017-12-11 759if (!is_dma && (status & DIRQ)) d8d9b9730cd62c Kuninori Morimoto 2017-12-11 760elapsed = rsnd_ssi_pio_interrupt(mod, io); ae5c322303fff5 Kuninori Morimoto 2013-07-21 761 12927a8f802642 Kuninori Morimoto 2015-06-15 762/* DMA only */ 2b62786951ca38 Kuninori Morimoto 2018-02-13 763if (is_dma && (status & (UIRQ | OIRQ))) { c0ea089dbad47a Kuninori Morimoto 2018-10-30 764 rsnd_dbg_irq_status(dev, "%s err status : 0x%08x\n", c0ea089dbad47a Kuninori Morimoto 2018-10-30 765 rsnd_mod_name(mod), status); 2b62786951ca38 Kuninori Morimoto 2018-02-13 766 6a25c8da00284f Kuninori Morimoto 2016-01-26 767stop = true; 2b62786951ca38 Kuninori Morimoto 2018-02-13 768} 69e32a58bde674 Kuninori Morimoto 2015-10-26 769 23aaae15fe2b41 Yongbo Zhang 2020-05-11 770status = 0; 23aaae15fe2b41 Yongbo Zhang 2020-05-11 771 23aaae15fe2b41 Yongbo Zhang 2020-05-11 772if (is_tdm || is_tdm_split) { 23aaae15fe2b41 Yongbo Zhang 2020-05-11 773switch (id) { 23aaae15fe2b41 Yongbo Zhang 2020-05-11 774case 0: 23aaae15fe2b41 Yongb
Re: [PATCH v2 05/12] remoteproc: stm32: Parse syscon that will manage M4 synchronisation
On Fri 24 Apr 13:24 PDT 2020, Mathieu Poirier wrote: > Get from the DT the syncon to probe the state of the remote processor > and the location of the resource table. > > Mainly based on the work published by Arnaud Pouliquen [1]. > > [1]. https://patchwork.kernel.org/project/linux-remoteproc/list/?series=239877 > > Signed-off-by: Mathieu Poirier > Reviewed-by: Loic Pallardy Reviewed-by: Bjorn Andersson > --- > drivers/remoteproc/stm32_rproc.c | 26 ++ > 1 file changed, 26 insertions(+) > > diff --git a/drivers/remoteproc/stm32_rproc.c > b/drivers/remoteproc/stm32_rproc.c > index 658439d4b00a..a285f338bed8 100644 > --- a/drivers/remoteproc/stm32_rproc.c > +++ b/drivers/remoteproc/stm32_rproc.c > @@ -70,6 +70,8 @@ struct stm32_rproc { > struct reset_control *rst; > struct stm32_syscon hold_boot; > struct stm32_syscon pdds; > + struct stm32_syscon m4_state; > + struct stm32_syscon rsctbl; > int wdg_irq; > u32 nb_rmems; > struct stm32_rproc_mem *rmems; > @@ -606,6 +608,30 @@ static int stm32_rproc_parse_dt(struct platform_device > *pdev, > > *auto_boot = of_property_read_bool(np, "st,auto-boot"); > > + /* > + * See if we can check the M4 status, i.e if it was started > + * from the boot loader or not. > + */ > + err = stm32_rproc_get_syscon(np, "st,syscfg-m4-state", > + &ddata->m4_state); > + if (err) { > + /* remember this */ > + ddata->m4_state.map = NULL; > + /* no coprocessor state syscon (optional) */ > + dev_warn(dev, "m4 state not supported\n"); > + > + /* no need to go further */ > + return 0; > + } > + > + /* See if we can get the resource table */ > + err = stm32_rproc_get_syscon(np, "st,syscfg-rsc-tbl", > + &ddata->rsctbl); > + if (err) { > + /* no rsc table syscon (optional) */ > + dev_warn(dev, "rsc tbl syscon not supported\n"); > + } > + > return 0; > } > > -- > 2.20.1 >
Re: [PATCH v2 04/12] remoteproc: stm32: Remove memory translation from DT parsing
On Fri 24 Apr 13:24 PDT 2020, Mathieu Poirier wrote: > Other than one has to be done after the other, there is no correlation > between memory translation and DT parsing. As move function > stm32_rproc_of_memory_translations() to stm32_rproc_probe() so that > stm32_rproc_parse_dt() can be extended to look for synchronisation > related binding in a clean way. > > Signed-off-by: Mathieu Poirier > Reviewed-by: Loic Pallardy Reviewed-by: Bjorn Andersson > --- > drivers/remoteproc/stm32_rproc.c | 6 +- > 1 file changed, 5 insertions(+), 1 deletion(-) > > diff --git a/drivers/remoteproc/stm32_rproc.c > b/drivers/remoteproc/stm32_rproc.c > index 57a426ea620b..658439d4b00a 100644 > --- a/drivers/remoteproc/stm32_rproc.c > +++ b/drivers/remoteproc/stm32_rproc.c > @@ -606,7 +606,7 @@ static int stm32_rproc_parse_dt(struct platform_device > *pdev, > > *auto_boot = of_property_read_bool(np, "st,auto-boot"); > > - return stm32_rproc_of_memory_translations(pdev, ddata); > + return 0; > } > > static int stm32_rproc_probe(struct platform_device *pdev) > @@ -634,6 +634,10 @@ static int stm32_rproc_probe(struct platform_device > *pdev) > if (ret) > goto free_rproc; > > + ret = stm32_rproc_of_memory_translations(pdev, ddata); > + if (ret) > + goto free_rproc; > + > rproc->auto_boot = auto_boot; > rproc->has_iommu = false; > ddata->workqueue = create_workqueue(dev_name(dev)); > -- > 2.20.1 >
[PATCH 10/16] ARM: dts: at91: sama5d2: Add DMA bindings for the flx1 I2C function
From: Tudor Ambarus Spare boards of duplicating the DMA bindings. Describe the flx1 DMA bindings in the SoC dtsi. Users that don't want to use DMA for their flexcom functions have to overwrite the flexcom DMA bindings in their board device tree. Signed-off-by: Tudor Ambarus --- arch/arm/boot/dts/at91-sama5d27_som1_ek.dts | 1 - arch/arm/boot/dts/sama5d2.dtsi | 9 + 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/arch/arm/boot/dts/at91-sama5d27_som1_ek.dts b/arch/arm/boot/dts/at91-sama5d27_som1_ek.dts index 1aa8b79d618b..0e159f879c15 100644 --- a/arch/arm/boot/dts/at91-sama5d27_som1_ek.dts +++ b/arch/arm/boot/dts/at91-sama5d27_som1_ek.dts @@ -127,7 +127,6 @@ i2c3: i2c@600 { dmas = <0>, <0>; - dma-names = "tx", "rx"; i2c-analog-filter; i2c-digital-filter; i2c-digital-filter-width-ns = <35>; diff --git a/arch/arm/boot/dts/sama5d2.dtsi b/arch/arm/boot/dts/sama5d2.dtsi index 5a0162915ae7..855846c74a32 100644 --- a/arch/arm/boot/dts/sama5d2.dtsi +++ b/arch/arm/boot/dts/sama5d2.dtsi @@ -712,6 +712,15 @@ #address-cells = <1>; #size-cells = <0>; clocks = <&pmc PMC_TYPE_PERIPHERAL 20>; + dmas = <&dma0 + (AT91_XDMAC_DT_MEM_IF(0) | +AT91_XDMAC_DT_PER_IF(1) | +AT91_XDMAC_DT_PERID(13))>, + <&dma0 + (AT91_XDMAC_DT_MEM_IF(0) | +AT91_XDMAC_DT_PER_IF(1) | +AT91_XDMAC_DT_PERID(14))>; + dma-names = "tx", "rx"; atmel,fifo-size = <16>; status = "disabled"; }; -- 2.23.0
[PATCH 06/16] ARM: dts: at91: sama5d2: Move flx0 definitions in the SoC dtsi
From: Tudor Ambarus The Flexcom IP is part of the sama5d2 SoC. Move the flx0 node together with its function definitions in sama5d2.dtsi. Boards will just fill the pins and enable the desired functions. There is a single functional change in this patch. With the move of the flx0 uart5 definition in the SoC dtsi, the uart5 from at91-sama5d27_wlsom1_ek.dts inherits the following optional property: atmel,fifo-size = <32>; This particular change was tested by Codrin. Signed-off-by: Tudor Ambarus Tested-by: Codrin Ciubotariu --- arch/arm/boot/dts/at91-kizbox3_common.dtsi| 13 -- arch/arm/boot/dts/at91-sama5d27_wlsom1_ek.dts | 12 -- arch/arm/boot/dts/at91-sama5d2_icp.dts| 6 --- arch/arm/boot/dts/at91-sama5d2_ptc_ek.dts | 7 arch/arm/boot/dts/at91-sama5d2_xplained.dts | 7 +--- arch/arm/boot/dts/sama5d2.dtsi| 40 +++ 6 files changed, 41 insertions(+), 44 deletions(-) diff --git a/arch/arm/boot/dts/at91-kizbox3_common.dtsi b/arch/arm/boot/dts/at91-kizbox3_common.dtsi index 4351a8d32225..7c3076e245ef 100644 --- a/arch/arm/boot/dts/at91-kizbox3_common.dtsi +++ b/arch/arm/boot/dts/at91-kizbox3_common.dtsi @@ -299,21 +299,8 @@ status = "disabled"; uart5: serial@200 { - compatible = "atmel,at91sam9260-usart"; - reg = <0x200 0x400>; - interrupts = <19 IRQ_TYPE_LEVEL_HIGH 7>; - dmas = <&dma0 - (AT91_XDMAC_DT_MEM_IF(0) | AT91_XDMAC_DT_PER_IF(1) - | AT91_XDMAC_DT_PERID(11))>, - <&dma0 - (AT91_XDMAC_DT_MEM_IF(0) | AT91_XDMAC_DT_PER_IF(1) - | AT91_XDMAC_DT_PERID(12))>; - dma-names = "tx", "rx"; - clocks = <&pmc PMC_TYPE_PERIPHERAL 19>; - clock-names = "usart"; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_flx0_default>; - atmel,fifo-size = <32>; atmel,use-dma-rx; atmel,use-dma-tx; status = "disabled"; diff --git a/arch/arm/boot/dts/at91-sama5d27_wlsom1_ek.dts b/arch/arm/boot/dts/at91-sama5d27_wlsom1_ek.dts index 6b8461278950..6b38fa3f5568 100644 --- a/arch/arm/boot/dts/at91-sama5d27_wlsom1_ek.dts +++ b/arch/arm/boot/dts/at91-sama5d27_wlsom1_ek.dts @@ -77,18 +77,6 @@ status = "okay"; uart5: serial@200 { - compatible = "atmel,at91sam9260-usart"; - reg = <0x200 0x200>; - interrupts = <19 IRQ_TYPE_LEVEL_HIGH 7>; - dmas = <&dma0 - (AT91_XDMAC_DT_MEM_IF(0) | AT91_XDMAC_DT_PER_IF(1) | -AT91_XDMAC_DT_PERID(11))>, - <&dma0 - (AT91_XDMAC_DT_MEM_IF(0) | AT91_XDMAC_DT_PER_IF(1) | -AT91_XDMAC_DT_PERID(12))>; - dma-names = "tx", "rx"; - clocks = <&pmc PMC_TYPE_PERIPHERAL 19>; - clock-names = "usart"; pinctrl-0 = <&pinctrl_flx0_default>; pinctrl-names = "default"; atmel,use-dma-rx; diff --git a/arch/arm/boot/dts/at91-sama5d2_icp.dts b/arch/arm/boot/dts/at91-sama5d2_icp.dts index 23f413afb333..4a01ab8e7e70 100644 --- a/arch/arm/boot/dts/at91-sama5d2_icp.dts +++ b/arch/arm/boot/dts/at91-sama5d2_icp.dts @@ -105,15 +105,9 @@ status = "okay"; spi2: spi@400 { - compatible = "atmel,at91rm9200-spi"; - reg = <0x400 0x200>; - interrupts = <19 IRQ_TYPE_LEVEL_HIGH 7>; - clocks = <&pmc PMC_TYPE_PERIPHERAL 19>; - clock-names = "spi_clk"; cs-gpios = <&pioA PIN_PC0 GPIO_ACTIVE_LOW>; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_mikrobus2_spi &pinctrl_ksz_spi_cs>; - atmel,fifo-size = <16>; status = "okay"; #address-cells = <1>; #size-cells = <0>; diff --git a/arch/arm/boot/dts/at91-sama5d2_ptc_ek.dts b/arch/arm/boot/dts/at91-sama5d2_ptc_ek.dts index 32435ce1dab2..8ad3a9c6c536 100644 --- a/arch/arm/boot/dts/at91-sama5d2_ptc_ek.dts +++ b/arch/arm/boot/dts/at91-sama5d2_ptc_ek.dts @@ -191,20 +191,13 @@ status = "okay"; i2c2: i2c@600 { - compatible = "atmel,sama5d2-i2c"; - reg = <0x600 0x200>; - interrupts = <19 IRQ_TYPE_LEVEL_HIGH 7>; dmas = <0>, <0>; dma-names = "tx", "rx"; - #address-cells = <1>; - #size-cells = <0>; - clocks = <&pmc PMC_TYPE_PERIPHERAL 19>; pinctrl-names = "default", "gp
Re: [PATCH v5 2/6] spi: spi-geni-qcom: Use OPP API to set clk/perf state
[].. spi->bus_num = -1; spi->dev.of_node = dev->of_node; @@ -596,6 +607,9 @@ static int spi_geni_probe(struct platform_device *pdev) spi_geni_probe_runtime_disable: pm_runtime_disable(dev); spi_master_put(spi); + if (mas->se.has_opp_table) Why do you need has_opp_table? Afaict if dev_pm_opp_of_add_table() returns -ENODEV there's no attached opp-table and dev_pm_opp_of_remove_table() is a nop. Apparently its not. Calling dev_pm_opp_of_remove_table() when dev_pm_opp_of_add_table() failed causes use-count mismatch. You can see https://lkml.org/lkml/2020/4/15/18 for more details. -- QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
[PATCH 00/16] ARM: dts: at91: sama5d2: Rework Flexcom definitions
From: Tudor Ambarus Rework the sama5d2 SoC flexcom definitions. The Flexcom IPs are in the SoC. Move all the flexcom nodes together with their function definitions in the SoC dtsi. Boards will just fill the pins and enable the desired functions. With this we remove the duplication of the flexcom definitions across the sama5d2 boards. Round the flexcom support and add the missing flexcom definitions. All the flexcom functions are now defined. Apart of the aliases and the new flx0 i2c function on sama5d2_xplained, the only functional change that this patch set adds, is that it uart5, uart6 and uart7 inherit the atmel,fifo-size = <32>; optional property. These nodes have both the FIFO size described and the DMA enabled. uart5 was tested on sama5d27-wlsom1-ek. On uart6 and uart7 a Bluetooth module can be connected. Tested BT uart7 on sama5d2-icp. Tudor Ambarus (16): ARM: dts: at91: sama5d2: Fix the label numbering for flexcom functions ARM: dts: at91: sama5d2: Move flx4 definitions in the SoC dtsi ARM: dts: at91: sama5d2: Move flx3 definitions in the SoC dtsi ARM: dts: at91: sama5d2: Move flx2 definitions in the SoC dtsi ARM: dts: at91: sama5d2: Move flx1 definitions in the SoC dtsi ARM: dts: at91: sama5d2: Move flx0 definitions in the SoC dtsi ARM: dts: at91: sama5d2: Specify the FIFO size for the Flexcom UART ARM: dts: at91: sama5d2: Add DMA bindings for the SPI and UART flx4 functions ARM: dts: at91: sama5d2: Add DMA bindings for the flx3 SPI function ARM: dts: at91: sama5d2: Add DMA bindings for the flx1 I2C function ARM: dts: at91: sama5d2: Add DMA bindings for the SPI and I2C flx0 functions ARM: dts: at91: sama5d2: Add missing flexcom definitions ARM: dts: at91: sama5d2: Remove i2s and tcb aliases from SoC dtsi ARM: dts: at91: sama5d2_xplained: Add alias for DBGU ARM: dts: at91: sama5d2_xplained: Describe the flx0 I2C function ARM: dts: at91: sama5d2_ptc_ek: Add comments to describe the aliases arch/arm/boot/dts/at91-kizbox3-hs.dts | 4 +- arch/arm/boot/dts/at91-kizbox3_common.dtsi| 48 +-- arch/arm/boot/dts/at91-sama5d27_som1_ek.dts | 64 +--- arch/arm/boot/dts/at91-sama5d27_wlsom1.dtsi | 12 - arch/arm/boot/dts/at91-sama5d27_wlsom1_ek.dts | 12 - arch/arm/boot/dts/at91-sama5d2_icp.dts| 42 +-- arch/arm/boot/dts/at91-sama5d2_ptc_ek.dts | 14 +- arch/arm/boot/dts/at91-sama5d2_xplained.dts | 42 ++- arch/arm/boot/dts/sama5d2.dtsi| 295 +- 9 files changed, 347 insertions(+), 186 deletions(-) -- 2.23.0
[PATCH 05/16] ARM: dts: at91: sama5d2: Move flx1 definitions in the SoC dtsi
From: Tudor Ambarus The Flexcom IP is part of the sama5d2 SoC. Move the flx0 node together with its function definitions in sama5d2.dtsi. Boards will just fill the pins and enable the desired functions. Signed-off-by: Tudor Ambarus --- arch/arm/boot/dts/at91-sama5d27_som1_ek.dts | 7 - arch/arm/boot/dts/at91-sama5d27_wlsom1.dtsi | 12 - arch/arm/boot/dts/sama5d2.dtsi | 29 + 3 files changed, 29 insertions(+), 19 deletions(-) diff --git a/arch/arm/boot/dts/at91-sama5d27_som1_ek.dts b/arch/arm/boot/dts/at91-sama5d27_som1_ek.dts index abbf14e29d85..a0deff15fb9a 100644 --- a/arch/arm/boot/dts/at91-sama5d27_som1_ek.dts +++ b/arch/arm/boot/dts/at91-sama5d27_som1_ek.dts @@ -126,20 +126,13 @@ status = "okay"; i2c3: i2c@600 { - compatible = "atmel,sama5d2-i2c"; - reg = <0x600 0x200>; - interrupts = <20 IRQ_TYPE_LEVEL_HIGH 7>; dmas = <0>, <0>; dma-names = "tx", "rx"; i2c-analog-filter; i2c-digital-filter; i2c-digital-filter-width-ns = <35>; - #address-cells = <1>; - #size-cells = <0>; - clocks = <&pmc PMC_TYPE_PERIPHERAL 20>; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_mikrobus_i2c>; - atmel,fifo-size = <16>; status = "okay"; }; }; diff --git a/arch/arm/boot/dts/at91-sama5d27_wlsom1.dtsi b/arch/arm/boot/dts/at91-sama5d27_wlsom1.dtsi index bea3d60b9722..a06700e53e4c 100644 --- a/arch/arm/boot/dts/at91-sama5d27_wlsom1.dtsi +++ b/arch/arm/boot/dts/at91-sama5d27_wlsom1.dtsi @@ -36,18 +36,6 @@ atmel,flexcom-mode = ; uart6: serial@200 { - compatible = "atmel,at91sam9260-usart"; - reg = <0x200 0x200>; - interrupts = <20 IRQ_TYPE_LEVEL_HIGH 7>; - dmas = <&dma0 - (AT91_XDMAC_DT_MEM_IF(0) | AT91_XDMAC_DT_PER_IF(1) | -AT91_XDMAC_DT_PERID(13))>, - <&dma0 - (AT91_XDMAC_DT_MEM_IF(0) | AT91_XDMAC_DT_PER_IF(1) | -AT91_XDMAC_DT_PERID(14))>; - dma-names = "tx", "rx"; - clocks = <&pmc PMC_TYPE_PERIPHERAL 20>; - clock-names = "usart"; pinctrl-0 = <&pinctrl_flx1_default>; pinctrl-names = "default"; }; diff --git a/arch/arm/boot/dts/sama5d2.dtsi b/arch/arm/boot/dts/sama5d2.dtsi index 89064225e9aa..79ed7bd02df6 100644 --- a/arch/arm/boot/dts/sama5d2.dtsi +++ b/arch/arm/boot/dts/sama5d2.dtsi @@ -645,6 +645,35 @@ #size-cells = <1>; ranges = <0x0 0xf8038000 0x800>; status = "disabled"; + + uart6: serial@200 { + compatible = "atmel,at91sam9260-usart"; + reg = <0x200 0x200>; + interrupts = <20 IRQ_TYPE_LEVEL_HIGH 7>; + clocks = <&pmc PMC_TYPE_PERIPHERAL 20>; + clock-names = "usart"; + dmas = <&dma0 + (AT91_XDMAC_DT_MEM_IF(0) | +AT91_XDMAC_DT_PER_IF(1) | +AT91_XDMAC_DT_PERID(13))>, + <&dma0 + (AT91_XDMAC_DT_MEM_IF(0) | +AT91_XDMAC_DT_PER_IF(1) | +AT91_XDMAC_DT_PERID(14))>; + dma-names = "tx", "rx"; + status = "disabled"; + }; + + i2c3: i2c@600 { + compatible = "atmel,sama5d2-i2c"; + reg = <0x600 0x200>; + interrupts = <20 IRQ_TYPE_LEVEL_HIGH 7>; + #address-cells = <1>; + #size-cells = <0>; + clocks = <&pmc PMC_TYPE_PERIPHERAL 20>; + atmel,fifo-size = <16>; +
[PATCH 08/16] ARM: dts: at91: sama5d2: Add DMA bindings for the SPI and UART flx4 functions
From: Tudor Ambarus Spare boards of duplicating the DMA bindings. Describe the flx4 DMA bindings in the SoC dtsi. Users that don't want to use DMA for their flexcom functions have to overwrite the flexcom DMA bindings in their board device tree. Signed-off-by: Tudor Ambarus --- arch/arm/boot/dts/at91-sama5d27_som1_ek.dts | 2 ++ arch/arm/boot/dts/sama5d2.dtsi | 18 ++ 2 files changed, 20 insertions(+) diff --git a/arch/arm/boot/dts/at91-sama5d27_som1_ek.dts b/arch/arm/boot/dts/at91-sama5d27_som1_ek.dts index a0deff15fb9a..6ad66d034305 100644 --- a/arch/arm/boot/dts/at91-sama5d27_som1_ek.dts +++ b/arch/arm/boot/dts/at91-sama5d27_som1_ek.dts @@ -190,12 +190,14 @@ status = "okay"; uart9: serial@200 { + dmas = <0>, <0>; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_flx4_default>; status = "disabled"; /* Conflict with spi6 and i2c6. */ }; spi6: spi@400 { + dmas = <0>, <0>; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_mikrobus_spi &pinctrl_mikrobus1_spi_cs &pinctrl_mikrobus2_spi_cs>; status = "okay"; /* Conflict with uart5 and i2c6. */ diff --git a/arch/arm/boot/dts/sama5d2.dtsi b/arch/arm/boot/dts/sama5d2.dtsi index dde969a140b4..66aa8d6502d3 100644 --- a/arch/arm/boot/dts/sama5d2.dtsi +++ b/arch/arm/boot/dts/sama5d2.dtsi @@ -939,6 +939,15 @@ interrupts = <23 IRQ_TYPE_LEVEL_HIGH 7>; clocks = <&pmc PMC_TYPE_PERIPHERAL 23>; clock-names = "usart"; + dmas = <&dma0 + (AT91_XDMAC_DT_MEM_IF(0) | +AT91_XDMAC_DT_PER_IF(1) | +AT91_XDMAC_DT_PERID(19))>, + <&dma0 + (AT91_XDMAC_DT_MEM_IF(0) | +AT91_XDMAC_DT_PER_IF(1) | +AT91_XDMAC_DT_PERID(20))>; + dma-names = "tx", "rx"; atmel,fifo-size = <32>; status = "disabled"; }; @@ -949,6 +958,15 @@ interrupts = <23 IRQ_TYPE_LEVEL_HIGH 7>; clocks = <&pmc PMC_TYPE_PERIPHERAL 23>; clock-names = "spi_clk"; + dmas = <&dma0 + (AT91_XDMAC_DT_MEM_IF(0) | +AT91_XDMAC_DT_PER_IF(1) | +AT91_XDMAC_DT_PERID(19))>, + <&dma0 + (AT91_XDMAC_DT_MEM_IF(0) | +AT91_XDMAC_DT_PER_IF(1) | +AT91_XDMAC_DT_PERID(20))>; + dma-names = "tx", "rx"; atmel,fifo-size = <16>; status = "disabled"; }; -- 2.23.0
[PATCH 13/16] ARM: dts: at91: sama5d2: Remove i2s and tcb aliases from SoC dtsi
From: Tudor Ambarus Device aliases are board-specific, if needed one should define them in board dts rather than in the SoC dtsi. If an alias from the SoC dtsi is addressed by a driver that does not use any of the of_alias*() methods, we can drop it. This is the case for the i2s aliases, drop them. tcb aliases point to nodes that are not enabled in any of the sama5d2 based platforms. atmel_tclib.c is scheduled to go away, any board using that alias is already broken, so get rid of the tcb aliases too. Signed-off-by: Tudor Ambarus --- arch/arm/boot/dts/sama5d2.dtsi | 4 1 file changed, 4 deletions(-) diff --git a/arch/arm/boot/dts/sama5d2.dtsi b/arch/arm/boot/dts/sama5d2.dtsi index b8cdeedee6bc..c0a3ca8f9bf7 100644 --- a/arch/arm/boot/dts/sama5d2.dtsi +++ b/arch/arm/boot/dts/sama5d2.dtsi @@ -21,10 +21,6 @@ aliases { serial0 = &uart1; serial1 = &uart3; - tcb0 = &tcb0; - tcb1 = &tcb1; - i2s0 = &i2s0; - i2s1 = &i2s1; }; cpus { -- 2.23.0
[PATCH 16/16] ARM: dts: at91: sama5d2_ptc_ek: Add comments to describe the aliases
From: Tudor Ambarus Indicate which i2c alias is for which connector on the board. Specify that serial0 is for DBGU. This eases tester's life. Signed-off-by: Tudor Ambarus --- arch/arm/boot/dts/at91-sama5d2_ptc_ek.dts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/arm/boot/dts/at91-sama5d2_ptc_ek.dts b/arch/arm/boot/dts/at91-sama5d2_ptc_ek.dts index 0e0341c83aa5..45c671a2bcf2 100644 --- a/arch/arm/boot/dts/at91-sama5d2_ptc_ek.dts +++ b/arch/arm/boot/dts/at91-sama5d2_ptc_ek.dts @@ -18,9 +18,9 @@ compatible = "atmel,sama5d2-ptc_ek", "atmel,sama5d2", "atmel,sama5"; aliases { - serial0 = &uart0; - i2c0= &i2c0; - i2c1= &i2c1; + serial0 = &uart0; /* DBGU */ + i2c0= &i2c0;/* mikroBUS 1 */ + i2c1= &i2c1;/* XPRO EXT1 */ i2c2= &i2c2; }; -- 2.23.0
[PATCH 07/16] ARM: dts: at91: sama5d2: Specify the FIFO size for the Flexcom UART
From: Tudor Ambarus The UART submodule in Flexcom has 32-byte Transmit and Receive FIFOs. Tested uart7 on sama5d2-icp, which has both DMA and FIFO enabled. Signed-off-by: Tudor Ambarus --- arch/arm/boot/dts/sama5d2.dtsi | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arch/arm/boot/dts/sama5d2.dtsi b/arch/arm/boot/dts/sama5d2.dtsi index acb91908bd74..dde969a140b4 100644 --- a/arch/arm/boot/dts/sama5d2.dtsi +++ b/arch/arm/boot/dts/sama5d2.dtsi @@ -701,6 +701,7 @@ AT91_XDMAC_DT_PER_IF(1) | AT91_XDMAC_DT_PERID(14))>; dma-names = "tx", "rx"; + atmel,fifo-size = <32>; status = "disabled"; }; @@ -879,6 +880,7 @@ AT91_XDMAC_DT_PER_IF(1) | AT91_XDMAC_DT_PERID(16))>; dma-names = "tx", "rx"; + atmel,fifo-size = <32>; status = "disabled"; }; }; -- 2.23.0
[PATCH 04/16] ARM: dts: at91: sama5d2: Move flx2 definitions in the SoC dtsi
From: Tudor Ambarus The Flexcom IP is part of the sama5d2 SoC. Move the flx2 node together with its function definitions in sama5d2.dtsi. Boards will just fill the pins and enable the desired functions. Signed-off-by: Tudor Ambarus --- arch/arm/boot/dts/at91-sama5d2_icp.dts | 12 arch/arm/boot/dts/sama5d2.dtsi | 18 ++ 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/arch/arm/boot/dts/at91-sama5d2_icp.dts b/arch/arm/boot/dts/at91-sama5d2_icp.dts index 8a4336e12a60..23f413afb333 100644 --- a/arch/arm/boot/dts/at91-sama5d2_icp.dts +++ b/arch/arm/boot/dts/at91-sama5d2_icp.dts @@ -160,18 +160,6 @@ status = "okay"; uart7: serial@200 { - compatible = "atmel,at91sam9260-usart"; - reg = <0x200 0x200>; - interrupts = <21 IRQ_TYPE_LEVEL_HIGH 7>; - dmas = <&dma0 - (AT91_XDMAC_DT_MEM_IF(0) | AT91_XDMAC_DT_PER_IF(1) | - AT91_XDMAC_DT_PERID(15))>, - <&dma0 - (AT91_XDMAC_DT_MEM_IF(0) | AT91_XDMAC_DT_PER_IF(1) | - AT91_XDMAC_DT_PERID(16))>; - dma-names = "tx", "rx"; - clocks = <&pmc PMC_TYPE_PERIPHERAL 21>; - clock-names = "usart"; pinctrl-0 = <&pinctrl_flx2_default>; pinctrl-names = "default"; atmel,use-dma-rx; diff --git a/arch/arm/boot/dts/sama5d2.dtsi b/arch/arm/boot/dts/sama5d2.dtsi index 5e84cde8226a..89064225e9aa 100644 --- a/arch/arm/boot/dts/sama5d2.dtsi +++ b/arch/arm/boot/dts/sama5d2.dtsi @@ -794,6 +794,24 @@ #size-cells = <1>; ranges = <0x0 0xfc01 0x800>; status = "disabled"; + + uart7: serial@200 { + compatible = "atmel,at91sam9260-usart"; + reg = <0x200 0x200>; + interrupts = <21 IRQ_TYPE_LEVEL_HIGH 7>; + clocks = <&pmc PMC_TYPE_PERIPHERAL 21>; + clock-names = "usart"; + dmas = <&dma0 + (AT91_XDMAC_DT_MEM_IF(0) | +AT91_XDMAC_DT_PER_IF(1) | +AT91_XDMAC_DT_PERID(15))>, + <&dma0 + (AT91_XDMAC_DT_MEM_IF(0) | +AT91_XDMAC_DT_PER_IF(1) | +AT91_XDMAC_DT_PERID(16))>; + dma-names = "tx", "rx"; + status = "disabled"; + }; }; flx3: flexcom@fc014000 { -- 2.23.0
[PATCH 09/16] ARM: dts: at91: sama5d2: Add DMA bindings for the flx3 SPI function
From: Tudor Ambarus Spare boards of duplicating the DMA bindings. Describe the flx3 DMA bindings in the SoC dtsi. Users that don't want to use DMA for their flexcom functions have to overwrite the flexcom DMA bindings in their board device tree. Signed-off-by: Tudor Ambarus --- arch/arm/boot/dts/at91-sama5d27_som1_ek.dts | 1 + arch/arm/boot/dts/at91-sama5d2_icp.dts | 1 + arch/arm/boot/dts/sama5d2.dtsi | 9 + 3 files changed, 11 insertions(+) diff --git a/arch/arm/boot/dts/at91-sama5d27_som1_ek.dts b/arch/arm/boot/dts/at91-sama5d27_som1_ek.dts index 6ad66d034305..1aa8b79d618b 100644 --- a/arch/arm/boot/dts/at91-sama5d27_som1_ek.dts +++ b/arch/arm/boot/dts/at91-sama5d27_som1_ek.dts @@ -179,6 +179,7 @@ }; spi5: spi@400 { + dmas = <0>, <0>; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_flx3_default>; status = "disabled"; /* Conflict with isc. */ diff --git a/arch/arm/boot/dts/at91-sama5d2_icp.dts b/arch/arm/boot/dts/at91-sama5d2_icp.dts index 4a01ab8e7e70..559d8ae93af9 100644 --- a/arch/arm/boot/dts/at91-sama5d2_icp.dts +++ b/arch/arm/boot/dts/at91-sama5d2_icp.dts @@ -167,6 +167,7 @@ status = "okay"; spi5: spi@400 { + dmas = <0>, <0>; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_mikrobus1_spi &pinctrl_mikrobus1_spi_cs>; status = "okay"; diff --git a/arch/arm/boot/dts/sama5d2.dtsi b/arch/arm/boot/dts/sama5d2.dtsi index 66aa8d6502d3..5a0162915ae7 100644 --- a/arch/arm/boot/dts/sama5d2.dtsi +++ b/arch/arm/boot/dts/sama5d2.dtsi @@ -919,6 +919,15 @@ interrupts = <22 IRQ_TYPE_LEVEL_HIGH 7>; clocks = <&pmc PMC_TYPE_PERIPHERAL 22>; clock-names = "spi_clk"; + dmas = <&dma0 + (AT91_XDMAC_DT_MEM_IF(0) | +AT91_XDMAC_DT_PER_IF(1) | +AT91_XDMAC_DT_PERID(17))>, + <&dma0 + (AT91_XDMAC_DT_MEM_IF(0) | +AT91_XDMAC_DT_PER_IF(1) | +AT91_XDMAC_DT_PERID(18))>; + dma-names = "tx", "rx"; atmel,fifo-size = <16>; status = "disabled"; }; -- 2.23.0
[PATCH 14/16] ARM: dts: at91: sama5d2_xplained: Add alias for DBGU
From: Tudor Ambarus The aliases should be defined in the board dts rather than in the SoC dtsi. Don't rely on the aliases defined in the SoC dtsi and define the alias for the Serial DBGU in the board dts file. sama5d2 boards use the "serial0" alias for the Serial DBGU, do the same for sama5d2_xplained. Signed-off-by: Tudor Ambarus --- arch/arm/boot/dts/at91-sama5d2_xplained.dts | 4 1 file changed, 4 insertions(+) diff --git a/arch/arm/boot/dts/at91-sama5d2_xplained.dts b/arch/arm/boot/dts/at91-sama5d2_xplained.dts index da4442715ea5..01ffbddd4ab8 100644 --- a/arch/arm/boot/dts/at91-sama5d2_xplained.dts +++ b/arch/arm/boot/dts/at91-sama5d2_xplained.dts @@ -16,6 +16,10 @@ model = "Atmel SAMA5D2 Xplained"; compatible = "atmel,sama5d2-xplained", "atmel,sama5d2", "atmel,sama5"; + aliases { + serial0 = &uart1; /* DBGU */ + }; + chosen { stdout-path = "serial0:115200n8"; }; -- 2.23.0
[PATCH 12/16] ARM: dts: at91: sama5d2: Add missing flexcom definitions
From: Tudor Ambarus Describe all the flexcom functions for all the flexcom nodes. Signed-off-by: Tudor Ambarus --- arch/arm/boot/dts/sama5d2.dtsi | 79 ++ 1 file changed, 79 insertions(+) diff --git a/arch/arm/boot/dts/sama5d2.dtsi b/arch/arm/boot/dts/sama5d2.dtsi index 5bba8024f485..b8cdeedee6bc 100644 --- a/arch/arm/boot/dts/sama5d2.dtsi +++ b/arch/arm/boot/dts/sama5d2.dtsi @@ -723,6 +723,25 @@ status = "disabled"; }; + spi3: spi@400 { + compatible = "atmel,at91rm9200-spi"; + reg = <0x400 0x200>; + interrupts = <20 IRQ_TYPE_LEVEL_HIGH 7>; + clocks = <&pmc PMC_TYPE_PERIPHERAL 20>; + clock-names = "spi_clk"; + dmas = <&dma0 + (AT91_XDMAC_DT_MEM_IF(0) | +AT91_XDMAC_DT_PER_IF(1) | +AT91_XDMAC_DT_PERID(13))>, + <&dma0 + (AT91_XDMAC_DT_MEM_IF(0) | +AT91_XDMAC_DT_PER_IF(1) | +AT91_XDMAC_DT_PERID(14))>; + dma-names = "tx", "rx"; + atmel,fifo-size = <16>; + status = "disabled"; + }; + i2c3: i2c@600 { compatible = "atmel,sama5d2-i2c"; reg = <0x600 0x200>; @@ -910,6 +929,45 @@ atmel,fifo-size = <32>; status = "disabled"; }; + + spi4: spi@400 { + compatible = "atmel,at91rm9200-spi"; + reg = <0x400 0x200>; + interrupts = <21 IRQ_TYPE_LEVEL_HIGH 7>; + clocks = <&pmc PMC_TYPE_PERIPHERAL 21>; + clock-names = "spi_clk"; + dmas = <&dma0 + (AT91_XDMAC_DT_MEM_IF(0) | +AT91_XDMAC_DT_PER_IF(1) | +AT91_XDMAC_DT_PERID(15))>, + <&dma0 + (AT91_XDMAC_DT_MEM_IF(0) | +AT91_XDMAC_DT_PER_IF(1) | +AT91_XDMAC_DT_PERID(16))>; + dma-names = "tx", "rx"; + atmel,fifo-size = <16>; + status = "disabled"; + }; + + i2c4: i2c@600 { + compatible = "atmel,sama5d2-i2c"; + reg = <0x600 0x200>; + interrupts = <21 IRQ_TYPE_LEVEL_HIGH 7>; + #address-cells = <1>; + #size-cells = <0>; + clocks = <&pmc PMC_TYPE_PERIPHERAL 21>; + dmas = <&dma0 + (AT91_XDMAC_DT_MEM_IF(0) | +AT91_XDMAC_DT_PER_IF(1) | +AT91_XDMAC_DT_PERID(15))>, + <&dma0 + (AT91_XDMAC_DT_MEM_IF(0) | +AT91_XDMAC_DT_PER_IF(1) | +AT91_XDMAC_DT_PERID(16))>; + dma-names = "tx", "rx"; + atmel,fifo-size = <16>; + status = "disabled"; + }; }; flx3: flexcom@fc014000 { @@ -958,6 +1016,27 @@ atmel,fifo-size = <16>; status = "disabled"; }; + + i2c5: i2c@600 { + compatible = "atmel,sama5d2-i2c"; + reg = <0x600 0x200>; +
[PATCH 15/16] ARM: dts: at91: sama5d2_xplained: Describe the flx0 I2C function
From: Tudor Ambarus Users can choose which flexcom function to use. Describe the I2C Flexcom0 function. Add alias for the i2c2 node in order to not rely on probe order for the i2c device numbering. The sama5d2 SoC has two dedicated i2c buses and five flexcoms that can function as i2c. The i2c0 and i2c1 aliases are kept for the dedicated i2c buses, the i2c flexcom functions can be numbered in order starting from i2c2. Signed-off-by: Tudor Ambarus --- arch/arm/boot/dts/at91-sama5d2_xplained.dts | 21 + 1 file changed, 21 insertions(+) diff --git a/arch/arm/boot/dts/at91-sama5d2_xplained.dts b/arch/arm/boot/dts/at91-sama5d2_xplained.dts index 01ffbddd4ab8..77e5d4f5a102 100644 --- a/arch/arm/boot/dts/at91-sama5d2_xplained.dts +++ b/arch/arm/boot/dts/at91-sama5d2_xplained.dts @@ -18,6 +18,7 @@ aliases { serial0 = &uart1; /* DBGU */ + i2c2 = &i2c2; /* XPRO EXT2 */ }; chosen { @@ -336,6 +337,20 @@ pinctrl-0 = <&pinctrl_flx0_default>; status = "okay"; }; + + i2c2: i2c@600 { + dmas = <0>, <0>; + pinctrl-names = "default", "gpio"; + pinctrl-0 = <&pinctrl_flx0_default>; + pinctrl-1 = <&pinctrl_i2c2_gpio>; + sda-gpios = <&pioA PIN_PB28 GPIO_ACTIVE_HIGH>; + scl-gpios = <&pioA PIN_PB29 GPIO_ACTIVE_HIGH>; + i2c-sda-hold-time-ns = <350>; + i2c-analog-filter; + i2c-digital-filter; + i2c-digital-filter-width-ns = <35>; + status = "disabled"; /* conflict with ISC_D2 & ISC_D3 data pins */ + }; }; shdwc@f8048010 { @@ -523,6 +538,12 @@ bias-disable; }; + pinctrl_i2c2_gpio: i2c2_gpio { + pinmux = , +; + bias-disable; + }; + pinctrl_i2s0_default: i2s0_default { pinmux = , , -- 2.23.0
[PATCH 11/16] ARM: dts: at91: sama5d2: Add DMA bindings for the SPI and I2C flx0 functions
From: Tudor Ambarus Spare boards of duplicating the DMA bindings. Describe the flx0 DMA bindings in the SoC dtsi. Users that don't want to use DMA for their flexcom functions have to overwrite the flexcom DMA bindings in their board device tree. Signed-off-by: Tudor Ambarus --- arch/arm/boot/dts/at91-sama5d2_icp.dts| 1 + arch/arm/boot/dts/at91-sama5d2_ptc_ek.dts | 1 - arch/arm/boot/dts/sama5d2.dtsi| 18 ++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/arch/arm/boot/dts/at91-sama5d2_icp.dts b/arch/arm/boot/dts/at91-sama5d2_icp.dts index 559d8ae93af9..8d19925fc09e 100644 --- a/arch/arm/boot/dts/at91-sama5d2_icp.dts +++ b/arch/arm/boot/dts/at91-sama5d2_icp.dts @@ -105,6 +105,7 @@ status = "okay"; spi2: spi@400 { + dmas = <0>, <0>; cs-gpios = <&pioA PIN_PC0 GPIO_ACTIVE_LOW>; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_mikrobus2_spi &pinctrl_ksz_spi_cs>; diff --git a/arch/arm/boot/dts/at91-sama5d2_ptc_ek.dts b/arch/arm/boot/dts/at91-sama5d2_ptc_ek.dts index 8ad3a9c6c536..0e0341c83aa5 100644 --- a/arch/arm/boot/dts/at91-sama5d2_ptc_ek.dts +++ b/arch/arm/boot/dts/at91-sama5d2_ptc_ek.dts @@ -192,7 +192,6 @@ i2c2: i2c@600 { dmas = <0>, <0>; - dma-names = "tx", "rx"; pinctrl-names = "default", "gpio"; pinctrl-0 = <&pinctrl_flx0_default>; pinctrl-1 = <&pinctrl_flx0_gpio>; diff --git a/arch/arm/boot/dts/sama5d2.dtsi b/arch/arm/boot/dts/sama5d2.dtsi index 855846c74a32..5bba8024f485 100644 --- a/arch/arm/boot/dts/sama5d2.dtsi +++ b/arch/arm/boot/dts/sama5d2.dtsi @@ -661,6 +661,15 @@ interrupts = <19 IRQ_TYPE_LEVEL_HIGH 7>; clocks = <&pmc PMC_TYPE_PERIPHERAL 19>; clock-names = "spi_clk"; + dmas = <&dma0 + (AT91_XDMAC_DT_MEM_IF(0) | +AT91_XDMAC_DT_PER_IF(1) | +AT91_XDMAC_DT_PERID(11))>, + <&dma0 + (AT91_XDMAC_DT_MEM_IF(0) | +AT91_XDMAC_DT_PER_IF(1) | +AT91_XDMAC_DT_PERID(12))>; + dma-names = "tx", "rx"; atmel,fifo-size = <16>; status = "disabled"; }; @@ -672,6 +681,15 @@ #address-cells = <1>; #size-cells = <0>; clocks = <&pmc PMC_TYPE_PERIPHERAL 19>; + dmas = <&dma0 + (AT91_XDMAC_DT_MEM_IF(0) | +AT91_XDMAC_DT_PER_IF(1) | +AT91_XDMAC_DT_PERID(11))>, + <&dma0 + (AT91_XDMAC_DT_MEM_IF(0) | +AT91_XDMAC_DT_PER_IF(1) | +AT91_XDMAC_DT_PERID(12))>; + dma-names = "tx", "rx"; atmel,fifo-size = <16>; status = "disabled"; }; -- 2.23.0
Re: [patch V4 part 4 07/24] x86/traps: Split int3 handler up
On Tue, May 5, 2020 at 7:16 AM Thomas Gleixner wrote: > > For code simplicity split up the int3 handler into a kernel and user part > which makes the code flow simpler to understand. > > Signed-off-by: Peter Zijlstra (Intel) > Signed-off-by: Thomas Gleixner > --- > arch/x86/kernel/traps.c | 67 > +++- > 1 file changed, 39 insertions(+), 28 deletions(-) > > --- a/arch/x86/kernel/traps.c > +++ b/arch/x86/kernel/traps.c > @@ -564,6 +564,35 @@ DEFINE_IDTENTRY_ERRORCODE(exc_general_pr > cond_local_irq_disable(regs); > } > > +static bool do_int3(struct pt_regs *regs) > +{ > + int res; > + > +#ifdef CONFIG_KGDB_LOW_LEVEL_TRAP > + if (kgdb_ll_trap(DIE_INT3, "int3", regs, 0, X86_TRAP_BP, > +SIGTRAP) == NOTIFY_STOP) > + return true; > +#endif /* CONFIG_KGDB_LOW_LEVEL_TRAP */ > + > +#ifdef CONFIG_KPROBES > + if (kprobe_int3_handler(regs)) > + return true; > +#endif > + res = notify_die(DIE_INT3, "int3", regs, 0, X86_TRAP_BP, SIGTRAP); > + > + return res == NOTIFY_STOP; > +} > + > +static void do_int3_user(struct pt_regs *regs) > +{ > + if (do_int3(regs)) > + return; > + > + cond_local_irq_enable(regs); > + do_trap(X86_TRAP_BP, SIGTRAP, "int3", regs, 0, 0, NULL); > + cond_local_irq_disable(regs); > +} > + > DEFINE_IDTENTRY_RAW(exc_int3) > { > /* > @@ -581,37 +610,19 @@ DEFINE_IDTENTRY_RAW(exc_int3) > * because the INT3 could have been hit in any context including > * NMI. > */ > - if (user_mode(regs)) > + if (user_mode(regs)) { > idtentry_enter(regs); > - else > - nmi_enter(); > - > - instr_begin(); > -#ifdef CONFIG_KGDB_LOW_LEVEL_TRAP > - if (kgdb_ll_trap(DIE_INT3, "int3", regs, 0, X86_TRAP_BP, > - SIGTRAP) == NOTIFY_STOP) > - goto exit; > -#endif /* CONFIG_KGDB_LOW_LEVEL_TRAP */ > - > -#ifdef CONFIG_KPROBES > - if (kprobe_int3_handler(regs)) > - goto exit; > -#endif > - > - if (notify_die(DIE_INT3, "int3", regs, 0, X86_TRAP_BP, > - SIGTRAP) == NOTIFY_STOP) > - goto exit; > - > - cond_local_irq_enable(regs); > - do_trap(X86_TRAP_BP, SIGTRAP, "int3", regs, 0, 0, NULL); > - cond_local_irq_disable(regs); > - > -exit: > - instr_end(); > - if (user_mode(regs)) > + instr_begin(); > + do_int3_user(regs); > + instr_end(); > idtentry_exit(regs); > - else > + } else { > + nmi_enter(); > + instr_begin(); > + do_int3(regs); I think you should be checking the return value here. Presumably this should die() if it's not handled, since otherwise it will just infinite loop. > + instr_end(); > nmi_exit(); > + } > } > > #ifdef CONFIG_X86_64 >
[PATCH 01/16] ARM: dts: at91: sama5d2: Fix the label numbering for flexcom functions
From: Tudor Ambarus The sama5d2 SoC has the following IPs: [uart0, uart4], {spi0, spi1}, {i2c0, i2c1}. Label the flexcom functions in order: flx0: uart5, spi2, i2c2 flx1: uart6, spi3, i2c3 flx2: uart7, spi4, i2c4 flx3: uart8, spi5, i2c5 flx4: uart9, spi6, i2c6 Some boards respected this scheme, others not. Fix the ones that didn't. Signed-off-by: Tudor Ambarus --- arch/arm/boot/dts/at91-kizbox3-hs.dts | 4 ++-- arch/arm/boot/dts/at91-kizbox3_common.dtsi | 8 arch/arm/boot/dts/at91-sama5d27_som1_ek.dts | 20 ++-- arch/arm/boot/dts/at91-sama5d2_icp.dts | 8 arch/arm/boot/dts/at91-sama5d2_xplained.dts | 2 +- 5 files changed, 21 insertions(+), 21 deletions(-) diff --git a/arch/arm/boot/dts/at91-kizbox3-hs.dts b/arch/arm/boot/dts/at91-kizbox3-hs.dts index 8734e7f8939e..0da1f0557eaf 100644 --- a/arch/arm/boot/dts/at91-kizbox3-hs.dts +++ b/arch/arm/boot/dts/at91-kizbox3-hs.dts @@ -283,7 +283,7 @@ &flx3 { status = "okay"; - uart6: serial@200 { + uart8: serial@200 { status = "okay"; }; }; @@ -291,7 +291,7 @@ &flx4 { status = "okay"; - i2c2: i2c@600 { + i2c6: i2c@600 { status = "okay"; }; }; diff --git a/arch/arm/boot/dts/at91-kizbox3_common.dtsi b/arch/arm/boot/dts/at91-kizbox3_common.dtsi index 299e74d23184..d7a6c972bdac 100644 --- a/arch/arm/boot/dts/at91-kizbox3_common.dtsi +++ b/arch/arm/boot/dts/at91-kizbox3_common.dtsi @@ -28,7 +28,7 @@ serial3 = &uart3; serial4 = &uart4; serial5 = &uart5; - serial6 = &uart6; + serial6 = &uart8; }; chosen { @@ -207,7 +207,7 @@ }; }; - pinctrl_flx4_default: flx4_i2c2_default { + pinctrl_flx4_default: flx4_i2c6_default { pinmux = , //DATA ; //CLK bias-disable; @@ -324,7 +324,7 @@ atmel,flexcom-mode = ; status = "disabled"; - uart6: serial@200 { + uart8: serial@200 { compatible = "atmel,at91sam9260-usart"; reg = <0x200 0x400>; interrupts = <22 IRQ_TYPE_LEVEL_HIGH 7>; @@ -350,7 +350,7 @@ atmel,flexcom-mode = ; status = "disabled"; - i2c2: i2c@600 { + i2c6: i2c@600 { compatible = "atmel,sama5d2-i2c"; reg = <0x600 0x200>; interrupts = <23 IRQ_TYPE_LEVEL_HIGH 7>; diff --git a/arch/arm/boot/dts/at91-sama5d27_som1_ek.dts b/arch/arm/boot/dts/at91-sama5d27_som1_ek.dts index b0853bf7901c..d215243fe163 100644 --- a/arch/arm/boot/dts/at91-sama5d27_som1_ek.dts +++ b/arch/arm/boot/dts/at91-sama5d27_som1_ek.dts @@ -21,7 +21,7 @@ serial1 = &uart4; /* mikro BUS 1 */ serial2 = &uart2; /* mikro BUS 2 */ i2c1= &i2c1; - i2c2= &i2c2; + i2c2= &i2c3; }; chosen { @@ -125,7 +125,7 @@ atmel,flexcom-mode = ; status = "okay"; - i2c2: i2c@600 { + i2c3: i2c@600 { compatible = "atmel,sama5d2-i2c"; reg = <0x600 0x200>; interrupts = <20 IRQ_TYPE_LEVEL_HIGH 7>; @@ -178,7 +178,7 @@ atmel,flexcom-mode = ; status = "disabled"; - uart7: serial@200 { + uart8: serial@200 { compatible = "atmel,at91sam9260-usart"; reg = <0x200 0x200>; interrupts = <22 IRQ_TYPE_LEVEL_HIGH 7>; @@ -190,7 +190,7 @@ status = "disabled"; /* Conflict with isc. */ }; - spi2: spi@400 { + spi5: spi@400 { compatible = "atmel,at91rm9200-spi"; reg = <0x400 0x200>; interrupts = <22 IRQ_TYPE_LEVEL_HIGH 7>; @@ -207,7 +207,7 @@ atmel,flexcom-mode = ; status = "okay"; - uart6: serial@200 { + uart9: serial@200 { compatible = "atmel,at91sam9260-usart"; reg = <0x200 0x200>; interrupts = <23 IRQ_TYPE_LEVEL_HIGH 7>; @@ -216,10 +216,10 @@ pinctrl-names = "default"; pinctrl-0 = <&pinctrl_flx4_default>;
[PATCH 03/16] ARM: dts: at91: sama5d2: Move flx3 definitions in the SoC dtsi
From: Tudor Ambarus The Flexcom IP is part of the sama5d2 SoC. Move the flx3 node together with its function definitions in sama5d2.dtsi. Boards will just fill the pins and enable the desired functions. Signed-off-by: Tudor Ambarus --- arch/arm/boot/dts/at91-kizbox3_common.dtsi | 13 - arch/arm/boot/dts/at91-sama5d27_som1_ek.dts | 13 + arch/arm/boot/dts/at91-sama5d2_icp.dts | 6 - arch/arm/boot/dts/sama5d2.dtsi | 29 + 4 files changed, 30 insertions(+), 31 deletions(-) diff --git a/arch/arm/boot/dts/at91-kizbox3_common.dtsi b/arch/arm/boot/dts/at91-kizbox3_common.dtsi index ee6f036aa008..4351a8d32225 100644 --- a/arch/arm/boot/dts/at91-kizbox3_common.dtsi +++ b/arch/arm/boot/dts/at91-kizbox3_common.dtsi @@ -325,21 +325,8 @@ status = "disabled"; uart8: serial@200 { - compatible = "atmel,at91sam9260-usart"; - reg = <0x200 0x400>; - interrupts = <22 IRQ_TYPE_LEVEL_HIGH 7>; - dmas = <&dma0 - (AT91_XDMAC_DT_MEM_IF(0) | AT91_XDMAC_DT_PER_IF(1) - | AT91_XDMAC_DT_PERID(17))>, - <&dma0 - (AT91_XDMAC_DT_MEM_IF(0) | AT91_XDMAC_DT_PER_IF(1) - | AT91_XDMAC_DT_PERID(18))>; - dma-names = "tx", "rx"; - clocks = <&pmc PMC_TYPE_PERIPHERAL 22>; - clock-names = "usart"; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_flx3_default>; - atmel,fifo-size = <32>; atmel,use-dma-rx; atmel,use-dma-tx; status = "disabled"; diff --git a/arch/arm/boot/dts/at91-sama5d27_som1_ek.dts b/arch/arm/boot/dts/at91-sama5d27_som1_ek.dts index 5f4a7c8725f3..abbf14e29d85 100644 --- a/arch/arm/boot/dts/at91-sama5d27_som1_ek.dts +++ b/arch/arm/boot/dts/at91-sama5d27_som1_ek.dts @@ -179,26 +179,15 @@ status = "disabled"; uart8: serial@200 { - compatible = "atmel,at91sam9260-usart"; - reg = <0x200 0x200>; - interrupts = <22 IRQ_TYPE_LEVEL_HIGH 7>; - clocks = <&pmc PMC_TYPE_PERIPHERAL 22>; - clock-names = "usart"; + dmas = <0>, <0>; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_flx3_default>; - atmel,fifo-size = <32>; status = "disabled"; /* Conflict with isc. */ }; spi5: spi@400 { - compatible = "atmel,at91rm9200-spi"; - reg = <0x400 0x200>; - interrupts = <22 IRQ_TYPE_LEVEL_HIGH 7>; - clocks = <&pmc PMC_TYPE_PERIPHERAL 22>; - clock-names = "spi_clk"; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_flx3_default>; - atmel,fifo-size = <16>; status = "disabled"; /* Conflict with isc. */ }; }; diff --git a/arch/arm/boot/dts/at91-sama5d2_icp.dts b/arch/arm/boot/dts/at91-sama5d2_icp.dts index 7216a794f4f6..8a4336e12a60 100644 --- a/arch/arm/boot/dts/at91-sama5d2_icp.dts +++ b/arch/arm/boot/dts/at91-sama5d2_icp.dts @@ -185,14 +185,8 @@ status = "okay"; spi5: spi@400 { - compatible = "atmel,at91rm9200-spi"; - reg = <0x400 0x200>; - interrupts = <22 IRQ_TYPE_LEVEL_HIGH 7>; - clocks = <&pmc PMC_TYPE_PERIPHERAL 22>; - clock-names = "spi_clk"; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_mikrobus1_spi &pinctrl_mikrobus1_spi_cs>; - atmel,fifo-size = <16>; status = "okay"; }; }; diff --git a/arch/arm/boot/dts/sama5d2.dtsi b/arch/arm/boot/dts/sama5d2.dtsi index 5c31e4068eb5..5e84cde8226a 100644 --- a/arch/arm/boot/dts/sama5d2.dtsi +++ b/arch/arm/boot/dts/sama5d2.dtsi @@ -804,6 +804,35 @@ #size-cells = <1>; ranges = <0x0 0xfc014000 0x800>; status = "disabled"; + + uart8: serial@200 { + compatible = "atmel,at91sam9260-usart"; + reg = <0x200 0x200>; + interrupts = <22 IRQ_TYPE_LEVEL_H
[PATCH 02/16] ARM: dts: at91: sama5d2: Move flx4 definitions in the SoC dtsi
From: Tudor Ambarus The Flexcom IP is part of the sama5d2 SoC. Move the flx0 node together with its function definitions in sama5d2.dtsi. Boards will just fill the pins and enable the desired functions. Signed-off-by: Tudor Ambarus --- arch/arm/boot/dts/at91-kizbox3_common.dtsi | 14 arch/arm/boot/dts/at91-sama5d27_som1_ek.dts | 20 --- arch/arm/boot/dts/at91-sama5d2_icp.dts | 8 - arch/arm/boot/dts/at91-sama5d2_xplained.dts | 8 - arch/arm/boot/dts/sama5d2.dtsi | 40 + 5 files changed, 40 insertions(+), 50 deletions(-) diff --git a/arch/arm/boot/dts/at91-kizbox3_common.dtsi b/arch/arm/boot/dts/at91-kizbox3_common.dtsi index d7a6c972bdac..ee6f036aa008 100644 --- a/arch/arm/boot/dts/at91-kizbox3_common.dtsi +++ b/arch/arm/boot/dts/at91-kizbox3_common.dtsi @@ -351,22 +351,8 @@ status = "disabled"; i2c6: i2c@600 { - compatible = "atmel,sama5d2-i2c"; - reg = <0x600 0x200>; - interrupts = <23 IRQ_TYPE_LEVEL_HIGH 7>; - dmas = <&dma0 - (AT91_XDMAC_DT_MEM_IF(0) | AT91_XDMAC_DT_PER_IF(1) - | AT91_XDMAC_DT_PERID(19))>, - <&dma0 - (AT91_XDMAC_DT_MEM_IF(0) | AT91_XDMAC_DT_PER_IF(1) - | AT91_XDMAC_DT_PERID(20))>; - dma-names = "tx", "rx"; - #address-cells = <1>; - #size-cells = <0>; - clocks = <&pmc PMC_TYPE_PERIPHERAL 23>; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_flx4_default>; - atmel,fifo-size = <16>; status = "disabled"; }; }; diff --git a/arch/arm/boot/dts/at91-sama5d27_som1_ek.dts b/arch/arm/boot/dts/at91-sama5d27_som1_ek.dts index d215243fe163..5f4a7c8725f3 100644 --- a/arch/arm/boot/dts/at91-sama5d27_som1_ek.dts +++ b/arch/arm/boot/dts/at91-sama5d27_som1_ek.dts @@ -208,41 +208,21 @@ status = "okay"; uart9: serial@200 { - compatible = "atmel,at91sam9260-usart"; - reg = <0x200 0x200>; - interrupts = <23 IRQ_TYPE_LEVEL_HIGH 7>; - clocks = <&pmc PMC_TYPE_PERIPHERAL 23>; - clock-names = "usart"; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_flx4_default>; - atmel,fifo-size = <32>; status = "disabled"; /* Conflict with spi6 and i2c6. */ }; spi6: spi@400 { - compatible = "atmel,at91rm9200-spi"; - reg = <0x400 0x200>; - interrupts = <23 IRQ_TYPE_LEVEL_HIGH 7>; - clocks = <&pmc PMC_TYPE_PERIPHERAL 23>; - clock-names = "spi_clk"; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_mikrobus_spi &pinctrl_mikrobus1_spi_cs &pinctrl_mikrobus2_spi_cs>; - atmel,fifo-size = <16>; status = "okay"; /* Conflict with uart5 and i2c6. */ }; i2c6: i2c@600 { - compatible = "atmel,sama5d2-i2c"; - reg = <0x600 0x200>; - interrupts = <23 IRQ_TYPE_LEVEL_HIGH 7>; dmas = <0>, <0>; - dma-names = "tx", "rx"; - #address-cells = <1>; - #size-cells = <0>; - clocks = <&pmc PMC_TYPE_PERIPHERAL 23>; pinctrl-names = "default"; pinctrl-0 = <&pinctrl_flx4_default>; - atmel,fifo-size = <16>; status = "disabled"; /* Conflict with uart5 and spi6. */ }; }; diff --git a/arch/arm/boot/dts/at91-sama5d2_icp.dts b/arch/arm/boot/dts/at91-sama5d2_icp.dts index 1d9556dbbd63..7216a794f4f6 100644 --- a/arch/arm/boot/dts/at91-sama5d2_icp.dts +++ b/arch/arm/boot/dts/at91-sama5d2_icp.dts @@ -202,17 +202,9 @@ status = "okay"; i2c6: i2c@600 { - compatible = "atmel,sama5d2-i2c"; - reg = <0x600 0x200>; - interrupts = <23 IRQ_TYPE_LEVEL_HIG
Re: [PATCH v2 03/12] remoteproc: stm32: Decouple rproc from DT parsing
On Fri 24 Apr 13:24 PDT 2020, Mathieu Poirier wrote: > Remove the remote processor from the process of parsing the device tree > since (1) there is no correlation between them and (2) to use the > information that was gathered to make a decision on whether to > synchronise with the M4 or not. > > Signed-off-by: Mathieu Poirier Reviewed-by: Bjorn Andersson > --- > drivers/remoteproc/stm32_rproc.c | 25 ++--- > 1 file changed, 14 insertions(+), 11 deletions(-) > > diff --git a/drivers/remoteproc/stm32_rproc.c > b/drivers/remoteproc/stm32_rproc.c > index 1ac90adba9b1..57a426ea620b 100644 > --- a/drivers/remoteproc/stm32_rproc.c > +++ b/drivers/remoteproc/stm32_rproc.c > @@ -538,12 +538,11 @@ static int stm32_rproc_get_syscon(struct device_node > *np, const char *prop, > return err; > } > > -static int stm32_rproc_parse_dt(struct platform_device *pdev) > +static int stm32_rproc_parse_dt(struct platform_device *pdev, > + struct stm32_rproc *ddata, bool *auto_boot) > { > struct device *dev = &pdev->dev; > struct device_node *np = dev->of_node; > - struct rproc *rproc = platform_get_drvdata(pdev); > - struct stm32_rproc *ddata = rproc->priv; > struct stm32_syscon tz; > unsigned int tzen; > int err, irq; > @@ -589,7 +588,7 @@ static int stm32_rproc_parse_dt(struct platform_device > *pdev) > > err = regmap_read(tz.map, tz.reg, &tzen); > if (err) { > - dev_err(&rproc->dev, "failed to read tzen\n"); > + dev_err(dev, "failed to read tzen\n"); > return err; > } > ddata->secured_soc = tzen & tz.mask; > @@ -605,7 +604,7 @@ static int stm32_rproc_parse_dt(struct platform_device > *pdev) > if (err) > dev_info(dev, "failed to get pdds\n"); > > - rproc->auto_boot = of_property_read_bool(np, "st,auto-boot"); > + *auto_boot = of_property_read_bool(np, "st,auto-boot"); > > return stm32_rproc_of_memory_translations(pdev, ddata); > } > @@ -616,6 +615,7 @@ static int stm32_rproc_probe(struct platform_device *pdev) > struct stm32_rproc *ddata; > struct device_node *np = dev->of_node; > struct rproc *rproc; > + bool auto_boot = false; > int ret; > > ret = dma_coerce_mask_and_coherent(dev, DMA_BIT_MASK(32)); > @@ -626,9 +626,16 @@ static int stm32_rproc_probe(struct platform_device > *pdev) > if (!rproc) > return -ENOMEM; > > + ddata = rproc->priv; > + > rproc_coredump_set_elf_info(rproc, ELFCLASS32, EM_NONE); > + > + ret = stm32_rproc_parse_dt(pdev, ddata, &auto_boot); > + if (ret) > + goto free_rproc; > + > + rproc->auto_boot = auto_boot; > rproc->has_iommu = false; > - ddata = rproc->priv; > ddata->workqueue = create_workqueue(dev_name(dev)); > if (!ddata->workqueue) { > dev_err(dev, "cannot create workqueue\n"); > @@ -638,13 +645,9 @@ static int stm32_rproc_probe(struct platform_device > *pdev) > > platform_set_drvdata(pdev, rproc); > > - ret = stm32_rproc_parse_dt(pdev); > - if (ret) > - goto free_wkq; > - > ret = stm32_rproc_request_mbox(rproc); > if (ret) > - goto free_rproc; > + goto free_wkq; > > ret = rproc_add(rproc); > if (ret) > -- > 2.20.1 >
Re: [patch V4 part 4 06/24] x86/entry: Convert INT3 exception to IDTENTRY_RAW
On Tue, May 5, 2020 at 7:15 AM Thomas Gleixner wrote: > > Convert #BP to IDTENTRY_RAW: > - Implement the C entry point with DEFINE_IDTENTRY_RAW > - Invoke idtentry_enter/exit() from the function body > - Emit the ASM stub with DECLARE_IDTENTRY_RAW > - Remove the ASM idtentry in 64bit > - Remove the open coded ASM entry code in 32bit > - Fixup the XEN/PV code > - Remove the old prototypes Gmail is so amused by your prototypo that it fixes it sometimes in the quoted text. See just above :) Acked-by: Andy Lutomirski
Re: [patch V4 part 4 05/24] x86/entry: Provide IDTENTRY_RAW
On Tue, May 5, 2020 at 7:15 AM Thomas Gleixner wrote: > > Some exception handlers need to do extra work before any of the entry > helpers are invoked. Provide IDTENTRY_RAW for this. Acked-by: Andy Lutomirski
Re: [patch V4 part 4 04/24] x86/int3: Inline bsearch()
On Tue, May 5, 2020 at 7:15 AM Thomas Gleixner wrote: > > From: Peter Zijlstra > > Avoid calling out to bsearch() by inlining it, for normal kernel configs > this was the last external call and poke_int3_handler() is now fully self > sufficient -- no calls to external code. > Acked-by: Andy Lutomirski
Re: [PATCH v2 02/12] remoteproc: stm32: Request IRQ with platform device
On Fri 24 Apr 13:24 PDT 2020, Mathieu Poirier wrote: > Request IRQ with platform device rather than remote proc in order to > call stm32_rproc_parse_dt() before rproc_alloc(). That way we can > know whether we need to synchronise with the MCU or not. > > Signed-off-by: Mathieu Poirier > Reviewed-by: Loic Pallardy Reviewed-by: Bjorn Andersson > --- > drivers/remoteproc/stm32_rproc.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/drivers/remoteproc/stm32_rproc.c > b/drivers/remoteproc/stm32_rproc.c > index 91fd59af0ffe..1ac90adba9b1 100644 > --- a/drivers/remoteproc/stm32_rproc.c > +++ b/drivers/remoteproc/stm32_rproc.c > @@ -261,7 +261,8 @@ static int stm32_rproc_parse_fw(struct rproc *rproc, > const struct firmware *fw) > > static irqreturn_t stm32_rproc_wdg(int irq, void *data) > { > - struct rproc *rproc = data; > + struct platform_device *pdev = data; > + struct rproc *rproc = platform_get_drvdata(pdev); > > rproc_report_crash(rproc, RPROC_WATCHDOG); > > @@ -553,7 +554,7 @@ static int stm32_rproc_parse_dt(struct platform_device > *pdev) > > if (irq > 0) { > err = devm_request_irq(dev, irq, stm32_rproc_wdg, 0, > -dev_name(dev), rproc); > +dev_name(dev), pdev); > if (err) { > dev_err(dev, "failed to request wdg irq\n"); > return err; > -- > 2.20.1 >
Re: [PATCH v2 01/12] remoteproc: stm32: Decouple rproc from memory translation
On Fri 24 Apr 13:24 PDT 2020, Mathieu Poirier wrote: > Remove the remote processor from the process of parsing the memory > ranges since there is no correlation between them. > > Signed-off-by: Mathieu Poirier > Reviewed-by: Loic Pallardy Reviewed-by: Bjorn Andersson > --- > drivers/remoteproc/stm32_rproc.c | 8 > 1 file changed, 4 insertions(+), 4 deletions(-) > > diff --git a/drivers/remoteproc/stm32_rproc.c > b/drivers/remoteproc/stm32_rproc.c > index 0f9d02ca4f5a..91fd59af0ffe 100644 > --- a/drivers/remoteproc/stm32_rproc.c > +++ b/drivers/remoteproc/stm32_rproc.c > @@ -127,10 +127,10 @@ static int stm32_rproc_mem_release(struct rproc *rproc, > return 0; > } > > -static int stm32_rproc_of_memory_translations(struct rproc *rproc) > +static int stm32_rproc_of_memory_translations(struct platform_device *pdev, > + struct stm32_rproc *ddata) > { > - struct device *parent, *dev = rproc->dev.parent; > - struct stm32_rproc *ddata = rproc->priv; > + struct device *parent, *dev = &pdev->dev; > struct device_node *np; > struct stm32_rproc_mem *p_mems; > struct stm32_rproc_mem_ranges *mem_range; > @@ -606,7 +606,7 @@ static int stm32_rproc_parse_dt(struct platform_device > *pdev) > > rproc->auto_boot = of_property_read_bool(np, "st,auto-boot"); > > - return stm32_rproc_of_memory_translations(rproc); > + return stm32_rproc_of_memory_translations(pdev, ddata); > } > > static int stm32_rproc_probe(struct platform_device *pdev) > -- > 2.20.1 >