Skip to content

Commit 3726788

Browse files
author
Avenger-285714
authored
Merge branch 'linux-6.6.y' into linux-6.6.y-2025-07-14-sched-tc
2 parents ceb4205 + 5da63dc commit 3726788

6 files changed

Lines changed: 47 additions & 14 deletions

File tree

arch/arm64/configs/deepin_arm64_desktop_defconfig

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4005,6 +4005,7 @@ CONFIG_VT6656=m
40054005
CONFIG_STAGING_MEDIA=y
40064006
CONFIG_DVB_AV7110=m
40074007
CONFIG_DVB_BUDGET_PATCH=m
4008+
CONFIG_ASHMEM=y
40084009
CONFIG_LTE_GDM724X=m
40094010
CONFIG_PI433=m
40104011
CONFIG_QLGE=m
@@ -4518,9 +4519,7 @@ CONFIG_CRYPTO_USER_API_SKCIPHER=m
45184519
CONFIG_CRYPTO_USER_API_RNG=m
45194520
CONFIG_CRYPTO_USER_API_AEAD=m
45204521
CONFIG_CRYPTO_NHPOLY1305_NEON=m
4521-
CONFIG_CRYPTO_CHACHA20_NEON=m
45224522
CONFIG_CRYPTO_GHASH_ARM64_CE=m
4523-
CONFIG_CRYPTO_POLY1305_NEON=m
45244523
CONFIG_CRYPTO_SHA1_ARM64_CE=m
45254524
CONFIG_CRYPTO_SHA2_ARM64_CE=m
45264525
CONFIG_CRYPTO_SHA512_ARM64_CE=m

arch/x86/configs/deepin_x86_desktop_defconfig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4791,6 +4791,7 @@ CONFIG_STAGING_MEDIA=y
47914791
CONFIG_INTEL_ATOMISP=y
47924792
CONFIG_DVB_AV7110=m
47934793
CONFIG_VIDEO_IPU3_IMGU=m
4794+
CONFIG_ASHMEM=y
47944795
CONFIG_LTE_GDM724X=m
47954796
CONFIG_FB_TFT=m
47964797
CONFIG_FB_TFT_AGM1264K_FL=m

drivers/staging/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ obj-$(CONFIG_IIO) += iio/
1717
obj-$(CONFIG_FB_SM750) += sm750fb/
1818
obj-$(CONFIG_USB_EMXX) += emxx_udc/
1919
obj-$(CONFIG_MFD_NVEC) += nvec/
20-
obj-$(CONFIG_ANDROID) += android/
20+
obj-y += android/
2121
obj-$(CONFIG_STAGING_BOARD) += board/
2222
obj-$(CONFIG_LTE_GDM724X) += gdm724x/
2323
obj-$(CONFIG_SB105X) += sb105x/

drivers/staging/android/ashmem.c

Lines changed: 41 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ static int ashmem_mmap(struct file *file, struct vm_area_struct *vma)
401401
ret = -EPERM;
402402
goto out;
403403
}
404-
vma->vm_flags &= ~calc_vm_may_flags(~asma->prot_mask);
404+
vm_flags_clear(vma, calc_vm_may_flags(~asma->prot_mask));
405405

406406
if (!asma->file) {
407407
char *name = ASHMEM_NAME_DEF;
@@ -703,30 +703,33 @@ static int ashmem_pin(struct ashmem_area *asma, size_t pgstart, size_t pgend,
703703
static int ashmem_unpin(struct ashmem_area *asma, size_t pgstart, size_t pgend,
704704
struct ashmem_range **new_range)
705705
{
706-
struct ashmem_range *range, *next;
706+
struct ashmem_range *range = NULL, *iter, *next;
707707
unsigned int purged = ASHMEM_NOT_PURGED;
708708

709709
restart:
710-
list_for_each_entry_safe(range, next, &asma->unpinned_list, unpinned) {
710+
list_for_each_entry_safe(iter, next, &asma->unpinned_list, unpinned) {
711711
/* short circuit: this is our insertion point */
712-
if (range_before_page(range, pgstart))
712+
if (range_before_page(iter, pgstart)) {
713+
range = iter;
713714
break;
715+
}
714716

715717
/*
716718
* The user can ask us to unpin pages that are already entirely
717719
* or partially pinned. We handle those two cases here.
718720
*/
719-
if (page_range_subsumed_by_range(range, pgstart, pgend))
721+
if (page_range_subsumed_by_range(iter, pgstart, pgend))
720722
return 0;
721-
if (page_range_in_range(range, pgstart, pgend)) {
722-
pgstart = min(range->pgstart, pgstart);
723-
pgend = max(range->pgend, pgend);
724-
purged |= range->purged;
725-
range_del(range);
723+
if (page_range_in_range(iter, pgstart, pgend)) {
724+
pgstart = min(iter->pgstart, pgstart);
725+
pgend = max(iter->pgend, pgend);
726+
purged |= iter->purged;
727+
range_del(iter);
726728
goto restart;
727729
}
728730
}
729731

732+
range = list_prepare_entry(range, &asma->unpinned_list, unpinned);
730733
range_alloc(asma, range, purged, pgstart, pgend, new_range);
731734
return 0;
732735
}
@@ -817,6 +820,7 @@ static int ashmem_pin_unpin(struct ashmem_area *asma, unsigned long cmd,
817820
static long ashmem_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
818821
{
819822
struct ashmem_area *asma = file->private_data;
823+
unsigned long ino;
820824
long ret = -ENOTTY;
821825

822826
switch (cmd) {
@@ -860,6 +864,23 @@ static long ashmem_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
860864
ashmem_shrink_scan(&ashmem_shrinker, &sc);
861865
}
862866
break;
867+
case ASHMEM_GET_FILE_ID:
868+
/* Lock around our check to avoid racing with ashmem_mmap(). */
869+
mutex_lock(&ashmem_mutex);
870+
if (!asma || !asma->file) {
871+
mutex_unlock(&ashmem_mutex);
872+
ret = -EINVAL;
873+
break;
874+
}
875+
ino = file_inode(asma->file)->i_ino;
876+
mutex_unlock(&ashmem_mutex);
877+
878+
if (copy_to_user((void __user *)arg, &ino, sizeof(ino))) {
879+
ret = -EFAULT;
880+
break;
881+
}
882+
ret = 0;
883+
break;
863884
}
864885

865886
return ret;
@@ -916,6 +937,15 @@ static const struct file_operations ashmem_fops = {
916937
#endif
917938
};
918939

940+
/*
941+
* is_ashmem_file - Check if struct file* is associated with ashmem
942+
*/
943+
int is_ashmem_file(struct file *file)
944+
{
945+
return file->f_op == &ashmem_fops;
946+
}
947+
EXPORT_SYMBOL_GPL(is_ashmem_file);
948+
919949
static struct miscdevice ashmem_misc = {
920950
.minor = MISC_DYNAMIC_MINOR,
921951
.name = "ashmem",
@@ -948,7 +978,7 @@ static int __init ashmem_init(void)
948978
goto out_free2;
949979
}
950980

951-
ret = register_shrinker(&ashmem_shrinker);
981+
ret = register_shrinker(&ashmem_shrinker, "android-ashmem");
952982
if (ret) {
953983
pr_err("failed to register shrinker!\n");
954984
goto out_demisc;

drivers/staging/android/ashmem.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,6 @@
2121
#define COMPAT_ASHMEM_SET_PROT_MASK _IOW(__ASHMEMIOC, 5, unsigned int)
2222
#endif
2323

24+
int is_ashmem_file(struct file *file);
25+
2426
#endif /* _LINUX_ASHMEM_H */

drivers/staging/android/uapi/ashmem.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,6 @@ struct ashmem_pin {
3939
#define ASHMEM_UNPIN _IOW(__ASHMEMIOC, 8, struct ashmem_pin)
4040
#define ASHMEM_GET_PIN_STATUS _IO(__ASHMEMIOC, 9)
4141
#define ASHMEM_PURGE_ALL_CACHES _IO(__ASHMEMIOC, 10)
42+
#define ASHMEM_GET_FILE_ID _IOR(__ASHMEMIOC, 11, unsigned long)
4243

4344
#endif /* _UAPI_LINUX_ASHMEM_H */

0 commit comments

Comments
 (0)