Merge branches 'for-4.20/upstream-fixes', 'for-4.21/core', 'for-4.21/hid-asus', 'for-4.21/hid-core', 'for-4.21/hid-cougar', 'for-4.21/hidraw', 'for-4.21/highres-wheel' and 'for-4.21/ish' into for-linus
This commit is contained in:
commit
bd8879faaf
1847 changed files with 37317 additions and 12442 deletions
|
|
@ -7,7 +7,12 @@
|
|||
#ifndef _LINUX_ADXL_H
|
||||
#define _LINUX_ADXL_H
|
||||
|
||||
#ifdef CONFIG_ACPI_ADXL
|
||||
const char * const *adxl_get_component_names(void);
|
||||
int adxl_decode(u64 addr, u64 component_values[]);
|
||||
#else
|
||||
static inline const char * const *adxl_get_component_names(void) { return NULL; }
|
||||
static inline int adxl_decode(u64 addr, u64 component_values[]) { return -EOPNOTSUPP; }
|
||||
#endif
|
||||
|
||||
#endif /* _LINUX_ADXL_H */
|
||||
|
|
|
|||
|
|
@ -62,13 +62,19 @@
|
|||
/* Error Codes */
|
||||
enum virtchnl_status_code {
|
||||
VIRTCHNL_STATUS_SUCCESS = 0,
|
||||
VIRTCHNL_ERR_PARAM = -5,
|
||||
VIRTCHNL_STATUS_ERR_PARAM = -5,
|
||||
VIRTCHNL_STATUS_ERR_NO_MEMORY = -18,
|
||||
VIRTCHNL_STATUS_ERR_OPCODE_MISMATCH = -38,
|
||||
VIRTCHNL_STATUS_ERR_CQP_COMPL_ERROR = -39,
|
||||
VIRTCHNL_STATUS_ERR_INVALID_VF_ID = -40,
|
||||
VIRTCHNL_STATUS_NOT_SUPPORTED = -64,
|
||||
VIRTCHNL_STATUS_ERR_ADMIN_QUEUE_ERROR = -53,
|
||||
VIRTCHNL_STATUS_ERR_NOT_SUPPORTED = -64,
|
||||
};
|
||||
|
||||
/* Backward compatibility */
|
||||
#define VIRTCHNL_ERR_PARAM VIRTCHNL_STATUS_ERR_PARAM
|
||||
#define VIRTCHNL_STATUS_NOT_SUPPORTED VIRTCHNL_STATUS_ERR_NOT_SUPPORTED
|
||||
|
||||
#define VIRTCHNL_LINK_SPEED_100MB_SHIFT 0x1
|
||||
#define VIRTCHNL_LINK_SPEED_1000MB_SHIFT 0x2
|
||||
#define VIRTCHNL_LINK_SPEED_10GB_SHIFT 0x3
|
||||
|
|
@ -831,7 +837,7 @@ virtchnl_vc_validate_vf_msg(struct virtchnl_version_info *ver, u32 v_opcode,
|
|||
case VIRTCHNL_OP_EVENT:
|
||||
case VIRTCHNL_OP_UNKNOWN:
|
||||
default:
|
||||
return VIRTCHNL_ERR_PARAM;
|
||||
return VIRTCHNL_STATUS_ERR_PARAM;
|
||||
}
|
||||
/* few more checks */
|
||||
if (err_msg_format || valid_len != msglen)
|
||||
|
|
|
|||
|
|
@ -503,31 +503,23 @@ do { \
|
|||
disk_devt((bio)->bi_disk)
|
||||
|
||||
#if defined(CONFIG_MEMCG) && defined(CONFIG_BLK_CGROUP)
|
||||
int bio_associate_blkg_from_page(struct bio *bio, struct page *page);
|
||||
int bio_associate_blkcg_from_page(struct bio *bio, struct page *page);
|
||||
#else
|
||||
static inline int bio_associate_blkg_from_page(struct bio *bio,
|
||||
struct page *page) { return 0; }
|
||||
static inline int bio_associate_blkcg_from_page(struct bio *bio,
|
||||
struct page *page) { return 0; }
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_BLK_CGROUP
|
||||
int bio_associate_blkcg(struct bio *bio, struct cgroup_subsys_state *blkcg_css);
|
||||
int bio_associate_blkg(struct bio *bio, struct blkcg_gq *blkg);
|
||||
int bio_associate_blkg_from_css(struct bio *bio,
|
||||
struct cgroup_subsys_state *css);
|
||||
int bio_associate_create_blkg(struct request_queue *q, struct bio *bio);
|
||||
int bio_reassociate_blkg(struct request_queue *q, struct bio *bio);
|
||||
void bio_disassociate_task(struct bio *bio);
|
||||
void bio_clone_blkg_association(struct bio *dst, struct bio *src);
|
||||
void bio_clone_blkcg_association(struct bio *dst, struct bio *src);
|
||||
#else /* CONFIG_BLK_CGROUP */
|
||||
static inline int bio_associate_blkg_from_css(struct bio *bio,
|
||||
struct cgroup_subsys_state *css)
|
||||
{ return 0; }
|
||||
static inline int bio_associate_create_blkg(struct request_queue *q,
|
||||
struct bio *bio) { return 0; }
|
||||
static inline int bio_reassociate_blkg(struct request_queue *q, struct bio *bio)
|
||||
{ return 0; }
|
||||
static inline int bio_associate_blkcg(struct bio *bio,
|
||||
struct cgroup_subsys_state *blkcg_css) { return 0; }
|
||||
static inline void bio_disassociate_task(struct bio *bio) { }
|
||||
static inline void bio_clone_blkg_association(struct bio *dst,
|
||||
struct bio *src) { }
|
||||
static inline void bio_clone_blkcg_association(struct bio *dst,
|
||||
struct bio *src) { }
|
||||
#endif /* CONFIG_BLK_CGROUP */
|
||||
|
||||
#ifdef CONFIG_HIGHMEM
|
||||
|
|
|
|||
|
|
@ -126,7 +126,7 @@ struct blkcg_gq {
|
|||
struct request_list rl;
|
||||
|
||||
/* reference count */
|
||||
struct percpu_ref refcnt;
|
||||
atomic_t refcnt;
|
||||
|
||||
/* is this blkg online? protected by both blkcg and q locks */
|
||||
bool online;
|
||||
|
|
@ -184,8 +184,6 @@ extern struct cgroup_subsys_state * const blkcg_root_css;
|
|||
|
||||
struct blkcg_gq *blkg_lookup_slowpath(struct blkcg *blkcg,
|
||||
struct request_queue *q, bool update_hint);
|
||||
struct blkcg_gq *__blkg_lookup_create(struct blkcg *blkcg,
|
||||
struct request_queue *q);
|
||||
struct blkcg_gq *blkg_lookup_create(struct blkcg *blkcg,
|
||||
struct request_queue *q);
|
||||
int blkcg_init_queue(struct request_queue *q);
|
||||
|
|
@ -232,59 +230,22 @@ int blkg_conf_prep(struct blkcg *blkcg, const struct blkcg_policy *pol,
|
|||
char *input, struct blkg_conf_ctx *ctx);
|
||||
void blkg_conf_finish(struct blkg_conf_ctx *ctx);
|
||||
|
||||
/**
|
||||
* blkcg_css - find the current css
|
||||
*
|
||||
* Find the css associated with either the kthread or the current task.
|
||||
* This may return a dying css, so it is up to the caller to use tryget logic
|
||||
* to confirm it is alive and well.
|
||||
*/
|
||||
static inline struct cgroup_subsys_state *blkcg_css(void)
|
||||
{
|
||||
struct cgroup_subsys_state *css;
|
||||
|
||||
css = kthread_blkcg();
|
||||
if (css)
|
||||
return css;
|
||||
return task_css(current, io_cgrp_id);
|
||||
}
|
||||
|
||||
static inline struct blkcg *css_to_blkcg(struct cgroup_subsys_state *css)
|
||||
{
|
||||
return css ? container_of(css, struct blkcg, css) : NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* __bio_blkcg - internal version of bio_blkcg for bfq and cfq
|
||||
*
|
||||
* DO NOT USE.
|
||||
* There is a flaw using this version of the function. In particular, this was
|
||||
* used in a broken paradigm where association was called on the given css. It
|
||||
* is possible though that the returned css from task_css() is in the process
|
||||
* of dying due to migration of the current task. So it is improper to assume
|
||||
* *_get() is going to succeed. Both BFQ and CFQ rely on this logic and will
|
||||
* take additional work to handle more gracefully.
|
||||
*/
|
||||
static inline struct blkcg *__bio_blkcg(struct bio *bio)
|
||||
{
|
||||
if (bio && bio->bi_blkg)
|
||||
return bio->bi_blkg->blkcg;
|
||||
return css_to_blkcg(blkcg_css());
|
||||
}
|
||||
|
||||
/**
|
||||
* bio_blkcg - grab the blkcg associated with a bio
|
||||
* @bio: target bio
|
||||
*
|
||||
* This returns the blkcg associated with a bio, NULL if not associated.
|
||||
* Callers are expected to either handle NULL or know association has been
|
||||
* done prior to calling this.
|
||||
*/
|
||||
static inline struct blkcg *bio_blkcg(struct bio *bio)
|
||||
{
|
||||
if (bio && bio->bi_blkg)
|
||||
return bio->bi_blkg->blkcg;
|
||||
return NULL;
|
||||
struct cgroup_subsys_state *css;
|
||||
|
||||
if (bio && bio->bi_css)
|
||||
return css_to_blkcg(bio->bi_css);
|
||||
css = kthread_blkcg();
|
||||
if (css)
|
||||
return css_to_blkcg(css);
|
||||
return css_to_blkcg(task_css(current, io_cgrp_id));
|
||||
}
|
||||
|
||||
static inline bool blk_cgroup_congested(void)
|
||||
|
|
@ -490,35 +451,26 @@ static inline int blkg_path(struct blkcg_gq *blkg, char *buf, int buflen)
|
|||
*/
|
||||
static inline void blkg_get(struct blkcg_gq *blkg)
|
||||
{
|
||||
percpu_ref_get(&blkg->refcnt);
|
||||
WARN_ON_ONCE(atomic_read(&blkg->refcnt) <= 0);
|
||||
atomic_inc(&blkg->refcnt);
|
||||
}
|
||||
|
||||
/**
|
||||
* blkg_tryget - try and get a blkg reference
|
||||
* blkg_try_get - try and get a blkg reference
|
||||
* @blkg: blkg to get
|
||||
*
|
||||
* This is for use when doing an RCU lookup of the blkg. We may be in the midst
|
||||
* of freeing this blkg, so we can only use it if the refcnt is not zero.
|
||||
*/
|
||||
static inline bool blkg_tryget(struct blkcg_gq *blkg)
|
||||
static inline struct blkcg_gq *blkg_try_get(struct blkcg_gq *blkg)
|
||||
{
|
||||
return percpu_ref_tryget(&blkg->refcnt);
|
||||
if (atomic_inc_not_zero(&blkg->refcnt))
|
||||
return blkg;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* blkg_tryget_closest - try and get a blkg ref on the closet blkg
|
||||
* @blkg: blkg to get
|
||||
*
|
||||
* This walks up the blkg tree to find the closest non-dying blkg and returns
|
||||
* the blkg that it did association with as it may not be the passed in blkg.
|
||||
*/
|
||||
static inline struct blkcg_gq *blkg_tryget_closest(struct blkcg_gq *blkg)
|
||||
{
|
||||
while (!percpu_ref_tryget(&blkg->refcnt))
|
||||
blkg = blkg->parent;
|
||||
|
||||
return blkg;
|
||||
}
|
||||
void __blkg_release_rcu(struct rcu_head *rcu);
|
||||
|
||||
/**
|
||||
* blkg_put - put a blkg reference
|
||||
|
|
@ -526,7 +478,9 @@ static inline struct blkcg_gq *blkg_tryget_closest(struct blkcg_gq *blkg)
|
|||
*/
|
||||
static inline void blkg_put(struct blkcg_gq *blkg)
|
||||
{
|
||||
percpu_ref_put(&blkg->refcnt);
|
||||
WARN_ON_ONCE(atomic_read(&blkg->refcnt) <= 0);
|
||||
if (atomic_dec_and_test(&blkg->refcnt))
|
||||
call_rcu(&blkg->rcu_head, __blkg_release_rcu);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -579,36 +533,25 @@ static inline struct request_list *blk_get_rl(struct request_queue *q,
|
|||
|
||||
rcu_read_lock();
|
||||
|
||||
if (bio && bio->bi_blkg) {
|
||||
blkcg = bio->bi_blkg->blkcg;
|
||||
if (blkcg == &blkcg_root)
|
||||
goto rl_use_root;
|
||||
blkcg = bio_blkcg(bio);
|
||||
|
||||
blkg_get(bio->bi_blkg);
|
||||
rcu_read_unlock();
|
||||
return &bio->bi_blkg->rl;
|
||||
}
|
||||
|
||||
blkcg = css_to_blkcg(blkcg_css());
|
||||
/* bypass blkg lookup and use @q->root_rl directly for root */
|
||||
if (blkcg == &blkcg_root)
|
||||
goto rl_use_root;
|
||||
|
||||
blkg = blkg_lookup(blkcg, q);
|
||||
if (unlikely(!blkg))
|
||||
blkg = __blkg_lookup_create(blkcg, q);
|
||||
|
||||
if (blkg->blkcg == &blkcg_root || !blkg_tryget(blkg))
|
||||
goto rl_use_root;
|
||||
|
||||
rcu_read_unlock();
|
||||
return &blkg->rl;
|
||||
goto root_rl;
|
||||
|
||||
/*
|
||||
* Each blkg has its own request_list, however, the root blkcg
|
||||
* uses the request_queue's root_rl. This is to avoid most
|
||||
* overhead for the root blkcg.
|
||||
* Try to use blkg->rl. blkg lookup may fail under memory pressure
|
||||
* or if either the blkcg or queue is going away. Fall back to
|
||||
* root_rl in such cases.
|
||||
*/
|
||||
rl_use_root:
|
||||
blkg = blkg_lookup(blkcg, q);
|
||||
if (unlikely(!blkg))
|
||||
goto root_rl;
|
||||
|
||||
blkg_get(blkg);
|
||||
rcu_read_unlock();
|
||||
return &blkg->rl;
|
||||
root_rl:
|
||||
rcu_read_unlock();
|
||||
return &q->root_rl;
|
||||
}
|
||||
|
|
@ -854,26 +797,32 @@ static inline bool blk_throtl_bio(struct request_queue *q, struct blkcg_gq *blkg
|
|||
struct bio *bio) { return false; }
|
||||
#endif
|
||||
|
||||
|
||||
static inline void blkcg_bio_issue_init(struct bio *bio)
|
||||
{
|
||||
bio_issue_init(&bio->bi_issue, bio_sectors(bio));
|
||||
}
|
||||
|
||||
static inline bool blkcg_bio_issue_check(struct request_queue *q,
|
||||
struct bio *bio)
|
||||
{
|
||||
struct blkcg *blkcg;
|
||||
struct blkcg_gq *blkg;
|
||||
bool throtl = false;
|
||||
|
||||
rcu_read_lock();
|
||||
blkcg = bio_blkcg(bio);
|
||||
|
||||
bio_associate_create_blkg(q, bio);
|
||||
blkg = bio->bi_blkg;
|
||||
/* associate blkcg if bio hasn't attached one */
|
||||
bio_associate_blkcg(bio, &blkcg->css);
|
||||
|
||||
blkg = blkg_lookup(blkcg, q);
|
||||
if (unlikely(!blkg)) {
|
||||
spin_lock_irq(q->queue_lock);
|
||||
blkg = blkg_lookup_create(blkcg, q);
|
||||
if (IS_ERR(blkg))
|
||||
blkg = NULL;
|
||||
spin_unlock_irq(q->queue_lock);
|
||||
}
|
||||
|
||||
throtl = blk_throtl_bio(q, blkg, bio);
|
||||
|
||||
if (!throtl) {
|
||||
blkg = blkg ?: q->root_blkg;
|
||||
/*
|
||||
* If the bio is flagged with BIO_QUEUE_ENTERED it means this
|
||||
* is a split bio and we would have already accounted for the
|
||||
|
|
@ -885,8 +834,6 @@ static inline bool blkcg_bio_issue_check(struct request_queue *q,
|
|||
blkg_rwstat_add(&blkg->stat_ios, bio->bi_opf, 1);
|
||||
}
|
||||
|
||||
blkcg_bio_issue_init(bio);
|
||||
|
||||
rcu_read_unlock();
|
||||
return !throtl;
|
||||
}
|
||||
|
|
@ -983,7 +930,6 @@ static inline int blkcg_activate_policy(struct request_queue *q,
|
|||
static inline void blkcg_deactivate_policy(struct request_queue *q,
|
||||
const struct blkcg_policy *pol) { }
|
||||
|
||||
static inline struct blkcg *__bio_blkcg(struct bio *bio) { return NULL; }
|
||||
static inline struct blkcg *bio_blkcg(struct bio *bio) { return NULL; }
|
||||
|
||||
static inline struct blkg_policy_data *blkg_to_pd(struct blkcg_gq *blkg,
|
||||
|
|
@ -999,7 +945,6 @@ static inline void blk_put_rl(struct request_list *rl) { }
|
|||
static inline void blk_rq_set_rl(struct request *rq, struct request_list *rl) { }
|
||||
static inline struct request_list *blk_rq_rl(struct request *rq) { return &rq->q->root_rl; }
|
||||
|
||||
static inline void blkcg_bio_issue_init(struct bio *bio) { }
|
||||
static inline bool blkcg_bio_issue_check(struct request_queue *q,
|
||||
struct bio *bio) { return true; }
|
||||
|
||||
|
|
|
|||
|
|
@ -178,6 +178,7 @@ struct bio {
|
|||
* release. Read comment on top of bio_associate_current().
|
||||
*/
|
||||
struct io_context *bi_ioc;
|
||||
struct cgroup_subsys_state *bi_css;
|
||||
struct blkcg_gq *bi_blkg;
|
||||
struct bio_issue bi_issue;
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -51,6 +51,9 @@ struct bpf_reg_state {
|
|||
* PTR_TO_MAP_VALUE_OR_NULL
|
||||
*/
|
||||
struct bpf_map *map_ptr;
|
||||
|
||||
/* Max size from any of the above. */
|
||||
unsigned long raw;
|
||||
};
|
||||
/* Fixed part of pointer offset, pointer types only */
|
||||
s32 off;
|
||||
|
|
|
|||
|
|
@ -169,6 +169,7 @@ void can_change_state(struct net_device *dev, struct can_frame *cf,
|
|||
|
||||
void can_put_echo_skb(struct sk_buff *skb, struct net_device *dev,
|
||||
unsigned int idx);
|
||||
struct sk_buff *__can_get_echo_skb(struct net_device *dev, unsigned int idx, u8 *len_ptr);
|
||||
unsigned int can_get_echo_skb(struct net_device *dev, unsigned int idx);
|
||||
void can_free_echo_skb(struct net_device *dev, unsigned int idx);
|
||||
|
||||
|
|
|
|||
|
|
@ -41,7 +41,12 @@ int can_rx_offload_add_timestamp(struct net_device *dev, struct can_rx_offload *
|
|||
int can_rx_offload_add_fifo(struct net_device *dev, struct can_rx_offload *offload, unsigned int weight);
|
||||
int can_rx_offload_irq_offload_timestamp(struct can_rx_offload *offload, u64 reg);
|
||||
int can_rx_offload_irq_offload_fifo(struct can_rx_offload *offload);
|
||||
int can_rx_offload_irq_queue_err_skb(struct can_rx_offload *offload, struct sk_buff *skb);
|
||||
int can_rx_offload_queue_sorted(struct can_rx_offload *offload,
|
||||
struct sk_buff *skb, u32 timestamp);
|
||||
unsigned int can_rx_offload_get_echo_skb(struct can_rx_offload *offload,
|
||||
unsigned int idx, u32 timestamp);
|
||||
int can_rx_offload_queue_tail(struct can_rx_offload *offload,
|
||||
struct sk_buff *skb);
|
||||
void can_rx_offload_reset(struct can_rx_offload *offload);
|
||||
void can_rx_offload_del(struct can_rx_offload *offload);
|
||||
void can_rx_offload_enable(struct can_rx_offload *offload);
|
||||
|
|
|
|||
|
|
@ -213,12 +213,6 @@ DEFINE_CEPH_FEATURE_DEPRECATED(63, 1, RESERVED_BROKEN, LUMINOUS) // client-facin
|
|||
CEPH_FEATURE_NEW_OSDOPREPLY_ENCODING | \
|
||||
CEPH_FEATURE_CEPHX_V2)
|
||||
|
||||
#define CEPH_FEATURES_REQUIRED_DEFAULT \
|
||||
(CEPH_FEATURE_NOSRCADDR | \
|
||||
CEPH_FEATURE_SUBSCRIBE2 | \
|
||||
CEPH_FEATURE_RECONNECT_SEQ | \
|
||||
CEPH_FEATURE_PGID64 | \
|
||||
CEPH_FEATURE_PGPOOL3 | \
|
||||
CEPH_FEATURE_OSDENC)
|
||||
#define CEPH_FEATURES_REQUIRED_DEFAULT 0
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -93,8 +93,6 @@ extern struct css_set init_css_set;
|
|||
|
||||
bool css_has_online_children(struct cgroup_subsys_state *css);
|
||||
struct cgroup_subsys_state *css_from_id(int id, struct cgroup_subsys *ss);
|
||||
struct cgroup_subsys_state *cgroup_e_css(struct cgroup *cgroup,
|
||||
struct cgroup_subsys *ss);
|
||||
struct cgroup_subsys_state *cgroup_get_e_css(struct cgroup *cgroup,
|
||||
struct cgroup_subsys *ss);
|
||||
struct cgroup_subsys_state *css_tryget_online_from_dir(struct dentry *dentry,
|
||||
|
|
|
|||
|
|
@ -1032,9 +1032,9 @@ int kcompat_sys_fstatfs64(unsigned int fd, compat_size_t sz,
|
|||
#else /* !CONFIG_COMPAT */
|
||||
|
||||
#define is_compat_task() (0)
|
||||
#ifndef in_compat_syscall
|
||||
/* Ensure no one redefines in_compat_syscall() under !CONFIG_COMPAT */
|
||||
#define in_compat_syscall in_compat_syscall
|
||||
static inline bool in_compat_syscall(void) { return false; }
|
||||
#endif
|
||||
|
||||
#endif /* CONFIG_COMPAT */
|
||||
|
||||
|
|
|
|||
|
|
@ -21,8 +21,6 @@
|
|||
#define __SANITIZE_ADDRESS__
|
||||
#endif
|
||||
|
||||
#define __no_sanitize_address __attribute__((no_sanitize("address")))
|
||||
|
||||
/*
|
||||
* Not all versions of clang implement the the type-generic versions
|
||||
* of the builtin overflow checkers. Fortunately, clang implements
|
||||
|
|
@ -41,6 +39,3 @@
|
|||
* compilers, like ICC.
|
||||
*/
|
||||
#define barrier() __asm__ __volatile__("" : : : "memory")
|
||||
#define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
|
||||
#define __assume_aligned(a, ...) \
|
||||
__attribute__((__assume_aligned__(a, ## __VA_ARGS__)))
|
||||
|
|
|
|||
|
|
@ -68,31 +68,20 @@
|
|||
*/
|
||||
#define uninitialized_var(x) x = x
|
||||
|
||||
#ifdef __CHECKER__
|
||||
#define __must_be_array(a) 0
|
||||
#else
|
||||
/* &a[0] degrades to a pointer: a different type from an array */
|
||||
#define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
|
||||
#endif
|
||||
|
||||
#ifdef RETPOLINE
|
||||
#define __noretpoline __attribute__((indirect_branch("keep")))
|
||||
#define __noretpoline __attribute__((__indirect_branch__("keep")))
|
||||
#endif
|
||||
|
||||
#define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__)
|
||||
|
||||
#define __optimize(level) __attribute__((__optimize__(level)))
|
||||
|
||||
#define __compiletime_object_size(obj) __builtin_object_size(obj, 0)
|
||||
|
||||
#ifndef __CHECKER__
|
||||
#define __compiletime_warning(message) __attribute__((warning(message)))
|
||||
#define __compiletime_error(message) __attribute__((error(message)))
|
||||
#define __compiletime_warning(message) __attribute__((__warning__(message)))
|
||||
#define __compiletime_error(message) __attribute__((__error__(message)))
|
||||
|
||||
#ifdef LATENT_ENTROPY_PLUGIN
|
||||
#if defined(LATENT_ENTROPY_PLUGIN) && !defined(__CHECKER__)
|
||||
#define __latent_entropy __attribute__((latent_entropy))
|
||||
#endif
|
||||
#endif /* __CHECKER__ */
|
||||
|
||||
/*
|
||||
* calling noreturn functions, __builtin_unreachable() and __builtin_trap()
|
||||
|
|
@ -107,10 +96,6 @@
|
|||
* Mark a position in code as unreachable. This can be used to
|
||||
* suppress control flow warnings after asm blocks that transfer
|
||||
* control elsewhere.
|
||||
*
|
||||
* Early snapshots of gcc 4.5 don't support this and we can't detect
|
||||
* this in the preprocessor, but we can live with this because they're
|
||||
* unreleased. Really, we need to have autoconf for the kernel.
|
||||
*/
|
||||
#define unreachable() \
|
||||
do { \
|
||||
|
|
@ -119,9 +104,6 @@
|
|||
__builtin_unreachable(); \
|
||||
} while (0)
|
||||
|
||||
/* Mark a function definition as prohibited from being cloned. */
|
||||
#define __noclone __attribute__((__noclone__, __optimize__("no-tracer")))
|
||||
|
||||
#if defined(RANDSTRUCT_PLUGIN) && !defined(__CHECKER__)
|
||||
#define __randomize_layout __attribute__((randomize_layout))
|
||||
#define __no_randomize_layout __attribute__((no_randomize_layout))
|
||||
|
|
@ -130,32 +112,6 @@
|
|||
#define randomized_struct_fields_end } __randomize_layout;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* When used with Link Time Optimization, gcc can optimize away C functions or
|
||||
* variables which are referenced only from assembly code. __visible tells the
|
||||
* optimizer that something else uses this function or variable, thus preventing
|
||||
* this.
|
||||
*/
|
||||
#define __visible __attribute__((externally_visible))
|
||||
|
||||
/* gcc version specific checks */
|
||||
|
||||
#if GCC_VERSION >= 40900 && !defined(__CHECKER__)
|
||||
/*
|
||||
* __assume_aligned(n, k): Tell the optimizer that the returned
|
||||
* pointer can be assumed to be k modulo n. The second argument is
|
||||
* optional (default 0), so we use a variadic macro to make the
|
||||
* shorthand.
|
||||
*
|
||||
* Beware: Do not apply this to functions which may return
|
||||
* ERR_PTRs. Also, it is probably unwise to apply it to functions
|
||||
* returning extra information in the low bits (but in that case the
|
||||
* compiler should see some alignment anyway, when the return value is
|
||||
* massaged by 'flags = ptr & 3; ptr &= ~3;').
|
||||
*/
|
||||
#define __assume_aligned(a, ...) __attribute__((__assume_aligned__(a, ## __VA_ARGS__)))
|
||||
#endif
|
||||
|
||||
/*
|
||||
* GCC 'asm goto' miscompiles certain code sequences:
|
||||
*
|
||||
|
|
@ -187,39 +143,10 @@
|
|||
#define KASAN_ABI_VERSION 3
|
||||
#endif
|
||||
|
||||
#if GCC_VERSION >= 40902
|
||||
/*
|
||||
* Tell the compiler that address safety instrumentation (KASAN)
|
||||
* should not be applied to that function.
|
||||
* Conflicts with inlining: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67368
|
||||
*/
|
||||
#define __no_sanitize_address __attribute__((no_sanitize_address))
|
||||
#ifdef CONFIG_KASAN
|
||||
#define __no_sanitize_address_or_inline \
|
||||
__no_sanitize_address __maybe_unused notrace
|
||||
#else
|
||||
#define __no_sanitize_address_or_inline inline
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if GCC_VERSION >= 50100
|
||||
/*
|
||||
* Mark structures as requiring designated initializers.
|
||||
* https://gcc.gnu.org/onlinedocs/gcc/Designated-Inits.html
|
||||
*/
|
||||
#define __designated_init __attribute__((designated_init))
|
||||
#define COMPILER_HAS_GENERIC_BUILTIN_OVERFLOW 1
|
||||
#endif
|
||||
|
||||
#if !defined(__noclone)
|
||||
#define __noclone /* not needed */
|
||||
#endif
|
||||
|
||||
#if !defined(__no_sanitize_address)
|
||||
#define __no_sanitize_address
|
||||
#define __no_sanitize_address_or_inline inline
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Turn individual warnings and errors on and off locally, depending
|
||||
* on version.
|
||||
|
|
|
|||
|
|
@ -29,17 +29,8 @@
|
|||
*/
|
||||
#define OPTIMIZER_HIDE_VAR(var) barrier()
|
||||
|
||||
/* Intel ECC compiler doesn't support __builtin_types_compatible_p() */
|
||||
#define __must_be_array(a) 0
|
||||
|
||||
#endif
|
||||
|
||||
/* icc has this, but it's called _bswap16 */
|
||||
#define __HAVE_BUILTIN_BSWAP16__
|
||||
#define __builtin_bswap16 _bswap16
|
||||
|
||||
/* The following are for compatibility with GCC, from compiler-gcc.h,
|
||||
* and may be redefined here because they should not be shared with other
|
||||
* compilers, like clang.
|
||||
*/
|
||||
#define __visible __attribute__((externally_visible))
|
||||
|
|
|
|||
|
|
@ -23,8 +23,8 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val,
|
|||
#define __branch_check__(x, expect, is_constant) ({ \
|
||||
long ______r; \
|
||||
static struct ftrace_likely_data \
|
||||
__attribute__((__aligned__(4))) \
|
||||
__attribute__((section("_ftrace_annotated_branch"))) \
|
||||
__aligned(4) \
|
||||
__section("_ftrace_annotated_branch") \
|
||||
______f = { \
|
||||
.data.func = __func__, \
|
||||
.data.file = __FILE__, \
|
||||
|
|
@ -59,8 +59,8 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val,
|
|||
({ \
|
||||
int ______r; \
|
||||
static struct ftrace_branch_data \
|
||||
__attribute__((__aligned__(4))) \
|
||||
__attribute__((section("_ftrace_branch"))) \
|
||||
__aligned(4) \
|
||||
__section("_ftrace_branch") \
|
||||
______f = { \
|
||||
.func = __func__, \
|
||||
.file = __FILE__, \
|
||||
|
|
@ -115,7 +115,10 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val,
|
|||
# define ASM_UNREACHABLE
|
||||
#endif
|
||||
#ifndef unreachable
|
||||
# define unreachable() do { annotate_reachable(); do { } while (1); } while (0)
|
||||
# define unreachable() do { \
|
||||
annotate_unreachable(); \
|
||||
__builtin_unreachable(); \
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
|
@ -137,7 +140,7 @@ void ftrace_likely_update(struct ftrace_likely_data *f, int val,
|
|||
extern typeof(sym) sym; \
|
||||
static const unsigned long __kentry_##sym \
|
||||
__used \
|
||||
__attribute__((section("___kentry" "+" #sym ), used)) \
|
||||
__section("___kentry" "+" #sym ) \
|
||||
= (unsigned long)&sym;
|
||||
#endif
|
||||
|
||||
|
|
@ -186,7 +189,7 @@ void __read_once_size(const volatile void *p, void *res, int size)
|
|||
* https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67368
|
||||
* '__maybe_unused' allows us to avoid defined-but-not-used warnings.
|
||||
*/
|
||||
# define __no_kasan_or_inline __no_sanitize_address __maybe_unused
|
||||
# define __no_kasan_or_inline __no_sanitize_address notrace __maybe_unused
|
||||
#else
|
||||
# define __no_kasan_or_inline __always_inline
|
||||
#endif
|
||||
|
|
@ -278,7 +281,7 @@ unsigned long read_word_at_a_time(const void *addr)
|
|||
* visible to the compiler.
|
||||
*/
|
||||
#define __ADDRESSABLE(sym) \
|
||||
static void * __attribute__((section(".discard.addressable"), used)) \
|
||||
static void * __section(".discard.addressable") __used \
|
||||
__PASTE(__addressable_##sym, __LINE__) = (void *)&sym;
|
||||
|
||||
/**
|
||||
|
|
@ -331,10 +334,6 @@ static inline void *offset_to_ptr(const int *off)
|
|||
#endif /* __KERNEL__ */
|
||||
#endif /* __ASSEMBLY__ */
|
||||
|
||||
#ifndef __optimize
|
||||
# define __optimize(level)
|
||||
#endif
|
||||
|
||||
/* Compile time object size, -1 for unknown */
|
||||
#ifndef __compiletime_object_size
|
||||
# define __compiletime_object_size(obj) -1
|
||||
|
|
@ -376,4 +375,7 @@ static inline void *offset_to_ptr(const int *off)
|
|||
compiletime_assert(__native_word(t), \
|
||||
"Need native word sized stores/loads for atomicity.")
|
||||
|
||||
/* &a[0] degrades to a pointer: a different type from an array */
|
||||
#define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0]))
|
||||
|
||||
#endif /* __LINUX_COMPILER_H */
|
||||
|
|
|
|||
262
include/linux/compiler_attributes.h
Normal file
262
include/linux/compiler_attributes.h
Normal file
|
|
@ -0,0 +1,262 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#ifndef __LINUX_COMPILER_ATTRIBUTES_H
|
||||
#define __LINUX_COMPILER_ATTRIBUTES_H
|
||||
|
||||
/*
|
||||
* The attributes in this file are unconditionally defined and they directly
|
||||
* map to compiler attribute(s), unless one of the compilers does not support
|
||||
* the attribute. In that case, __has_attribute is used to check for support
|
||||
* and the reason is stated in its comment ("Optional: ...").
|
||||
*
|
||||
* Any other "attributes" (i.e. those that depend on a configuration option,
|
||||
* on a compiler, on an architecture, on plugins, on other attributes...)
|
||||
* should be defined elsewhere (e.g. compiler_types.h or compiler-*.h).
|
||||
* The intention is to keep this file as simple as possible, as well as
|
||||
* compiler- and version-agnostic (e.g. avoiding GCC_VERSION checks).
|
||||
*
|
||||
* This file is meant to be sorted (by actual attribute name,
|
||||
* not by #define identifier). Use the __attribute__((__name__)) syntax
|
||||
* (i.e. with underscores) to avoid future collisions with other macros.
|
||||
* Provide links to the documentation of each supported compiler, if it exists.
|
||||
*/
|
||||
|
||||
/*
|
||||
* __has_attribute is supported on gcc >= 5, clang >= 2.9 and icc >= 17.
|
||||
* In the meantime, to support 4.6 <= gcc < 5, we implement __has_attribute
|
||||
* by hand.
|
||||
*
|
||||
* sparse does not support __has_attribute (yet) and defines __GNUC_MINOR__
|
||||
* depending on the compiler used to build it; however, these attributes have
|
||||
* no semantic effects for sparse, so it does not matter. Also note that,
|
||||
* in order to avoid sparse's warnings, even the unsupported ones must be
|
||||
* defined to 0.
|
||||
*/
|
||||
#ifndef __has_attribute
|
||||
# define __has_attribute(x) __GCC4_has_attribute_##x
|
||||
# define __GCC4_has_attribute___assume_aligned__ (__GNUC_MINOR__ >= 9)
|
||||
# define __GCC4_has_attribute___designated_init__ 0
|
||||
# define __GCC4_has_attribute___externally_visible__ 1
|
||||
# define __GCC4_has_attribute___noclone__ 1
|
||||
# define __GCC4_has_attribute___optimize__ 1
|
||||
# define __GCC4_has_attribute___nonstring__ 0
|
||||
# define __GCC4_has_attribute___no_sanitize_address__ (__GNUC_MINOR__ >= 8)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-alias-function-attribute
|
||||
*/
|
||||
#define __alias(symbol) __attribute__((__alias__(#symbol)))
|
||||
|
||||
/*
|
||||
* gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-aligned-function-attribute
|
||||
* gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Type-Attributes.html#index-aligned-type-attribute
|
||||
* gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Variable-Attributes.html#index-aligned-variable-attribute
|
||||
*/
|
||||
#define __aligned(x) __attribute__((__aligned__(x)))
|
||||
#define __aligned_largest __attribute__((__aligned__))
|
||||
|
||||
/*
|
||||
* Note: users of __always_inline currently do not write "inline" themselves,
|
||||
* which seems to be required by gcc to apply the attribute according
|
||||
* to its docs (and also "warning: always_inline function might not be
|
||||
* inlinable [-Wattributes]" is emitted).
|
||||
*
|
||||
* gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-always_005finline-function-attribute
|
||||
* clang: mentioned
|
||||
*/
|
||||
#define __always_inline inline __attribute__((__always_inline__))
|
||||
|
||||
/*
|
||||
* The second argument is optional (default 0), so we use a variadic macro
|
||||
* to make the shorthand.
|
||||
*
|
||||
* Beware: Do not apply this to functions which may return
|
||||
* ERR_PTRs. Also, it is probably unwise to apply it to functions
|
||||
* returning extra information in the low bits (but in that case the
|
||||
* compiler should see some alignment anyway, when the return value is
|
||||
* massaged by 'flags = ptr & 3; ptr &= ~3;').
|
||||
*
|
||||
* Optional: only supported since gcc >= 4.9
|
||||
* Optional: not supported by icc
|
||||
*
|
||||
* gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-assume_005faligned-function-attribute
|
||||
* clang: https://clang.llvm.org/docs/AttributeReference.html#assume-aligned
|
||||
*/
|
||||
#if __has_attribute(__assume_aligned__)
|
||||
# define __assume_aligned(a, ...) __attribute__((__assume_aligned__(a, ## __VA_ARGS__)))
|
||||
#else
|
||||
# define __assume_aligned(a, ...)
|
||||
#endif
|
||||
|
||||
/*
|
||||
* gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-cold-function-attribute
|
||||
* gcc: https://gcc.gnu.org/onlinedocs/gcc/Label-Attributes.html#index-cold-label-attribute
|
||||
*/
|
||||
#define __cold __attribute__((__cold__))
|
||||
|
||||
/*
|
||||
* Note the long name.
|
||||
*
|
||||
* gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-const-function-attribute
|
||||
*/
|
||||
#define __attribute_const__ __attribute__((__const__))
|
||||
|
||||
/*
|
||||
* Don't. Just don't. See commit 771c035372a0 ("deprecate the '__deprecated'
|
||||
* attribute warnings entirely and for good") for more information.
|
||||
*
|
||||
* gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-deprecated-function-attribute
|
||||
* gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Type-Attributes.html#index-deprecated-type-attribute
|
||||
* gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Variable-Attributes.html#index-deprecated-variable-attribute
|
||||
* gcc: https://gcc.gnu.org/onlinedocs/gcc/Enumerator-Attributes.html#index-deprecated-enumerator-attribute
|
||||
* clang: https://clang.llvm.org/docs/AttributeReference.html#deprecated
|
||||
*/
|
||||
#define __deprecated
|
||||
|
||||
/*
|
||||
* Optional: only supported since gcc >= 5.1
|
||||
* Optional: not supported by clang
|
||||
* Optional: not supported by icc
|
||||
*
|
||||
* gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Type-Attributes.html#index-designated_005finit-type-attribute
|
||||
*/
|
||||
#if __has_attribute(__designated_init__)
|
||||
# define __designated_init __attribute__((__designated_init__))
|
||||
#else
|
||||
# define __designated_init
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Optional: not supported by clang
|
||||
*
|
||||
* gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-externally_005fvisible-function-attribute
|
||||
*/
|
||||
#if __has_attribute(__externally_visible__)
|
||||
# define __visible __attribute__((__externally_visible__))
|
||||
#else
|
||||
# define __visible
|
||||
#endif
|
||||
|
||||
/*
|
||||
* gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-format-function-attribute
|
||||
* clang: https://clang.llvm.org/docs/AttributeReference.html#format
|
||||
*/
|
||||
#define __printf(a, b) __attribute__((__format__(printf, a, b)))
|
||||
#define __scanf(a, b) __attribute__((__format__(scanf, a, b)))
|
||||
|
||||
/*
|
||||
* gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-gnu_005finline-function-attribute
|
||||
* clang: https://clang.llvm.org/docs/AttributeReference.html#gnu-inline
|
||||
*/
|
||||
#define __gnu_inline __attribute__((__gnu_inline__))
|
||||
|
||||
/*
|
||||
* gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-malloc-function-attribute
|
||||
*/
|
||||
#define __malloc __attribute__((__malloc__))
|
||||
|
||||
/*
|
||||
* gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Type-Attributes.html#index-mode-type-attribute
|
||||
* gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Variable-Attributes.html#index-mode-variable-attribute
|
||||
*/
|
||||
#define __mode(x) __attribute__((__mode__(x)))
|
||||
|
||||
/*
|
||||
* Optional: not supported by clang
|
||||
* Note: icc does not recognize gcc's no-tracer
|
||||
*
|
||||
* gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-noclone-function-attribute
|
||||
* gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-optimize-function-attribute
|
||||
*/
|
||||
#if __has_attribute(__noclone__)
|
||||
# if __has_attribute(__optimize__)
|
||||
# define __noclone __attribute__((__noclone__, __optimize__("no-tracer")))
|
||||
# else
|
||||
# define __noclone __attribute__((__noclone__))
|
||||
# endif
|
||||
#else
|
||||
# define __noclone
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Note the missing underscores.
|
||||
*
|
||||
* gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-noinline-function-attribute
|
||||
* clang: mentioned
|
||||
*/
|
||||
#define noinline __attribute__((__noinline__))
|
||||
|
||||
/*
|
||||
* Optional: only supported since gcc >= 8
|
||||
* Optional: not supported by clang
|
||||
* Optional: not supported by icc
|
||||
*
|
||||
* gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Variable-Attributes.html#index-nonstring-variable-attribute
|
||||
*/
|
||||
#if __has_attribute(__nonstring__)
|
||||
# define __nonstring __attribute__((__nonstring__))
|
||||
#else
|
||||
# define __nonstring
|
||||
#endif
|
||||
|
||||
/*
|
||||
* gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-noreturn-function-attribute
|
||||
* clang: https://clang.llvm.org/docs/AttributeReference.html#noreturn
|
||||
* clang: https://clang.llvm.org/docs/AttributeReference.html#id1
|
||||
*/
|
||||
#define __noreturn __attribute__((__noreturn__))
|
||||
|
||||
/*
|
||||
* Optional: only supported since gcc >= 4.8
|
||||
* Optional: not supported by icc
|
||||
*
|
||||
* gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-no_005fsanitize_005faddress-function-attribute
|
||||
* clang: https://clang.llvm.org/docs/AttributeReference.html#no-sanitize-address-no-address-safety-analysis
|
||||
*/
|
||||
#if __has_attribute(__no_sanitize_address__)
|
||||
# define __no_sanitize_address __attribute__((__no_sanitize_address__))
|
||||
#else
|
||||
# define __no_sanitize_address
|
||||
#endif
|
||||
|
||||
/*
|
||||
* gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Type-Attributes.html#index-packed-type-attribute
|
||||
* clang: https://gcc.gnu.org/onlinedocs/gcc/Common-Variable-Attributes.html#index-packed-variable-attribute
|
||||
*/
|
||||
#define __packed __attribute__((__packed__))
|
||||
|
||||
/*
|
||||
* gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-pure-function-attribute
|
||||
*/
|
||||
#define __pure __attribute__((__pure__))
|
||||
|
||||
/*
|
||||
* gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-section-function-attribute
|
||||
* gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Variable-Attributes.html#index-section-variable-attribute
|
||||
* clang: https://clang.llvm.org/docs/AttributeReference.html#section-declspec-allocate
|
||||
*/
|
||||
#define __section(S) __attribute__((__section__(#S)))
|
||||
|
||||
/*
|
||||
* gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-unused-function-attribute
|
||||
* gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Type-Attributes.html#index-unused-type-attribute
|
||||
* gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Variable-Attributes.html#index-unused-variable-attribute
|
||||
* gcc: https://gcc.gnu.org/onlinedocs/gcc/Label-Attributes.html#index-unused-label-attribute
|
||||
* clang: https://clang.llvm.org/docs/AttributeReference.html#maybe-unused-unused
|
||||
*/
|
||||
#define __always_unused __attribute__((__unused__))
|
||||
#define __maybe_unused __attribute__((__unused__))
|
||||
|
||||
/*
|
||||
* gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-used-function-attribute
|
||||
* gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Variable-Attributes.html#index-used-variable-attribute
|
||||
*/
|
||||
#define __used __attribute__((__used__))
|
||||
|
||||
/*
|
||||
* gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-weak-function-attribute
|
||||
* gcc: https://gcc.gnu.org/onlinedocs/gcc/Common-Variable-Attributes.html#index-weak-variable-attribute
|
||||
*/
|
||||
#define __weak __attribute__((__weak__))
|
||||
|
||||
#endif /* __LINUX_COMPILER_ATTRIBUTES_H */
|
||||
|
|
@ -1,3 +1,4 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#ifndef __LINUX_COMPILER_TYPES_H
|
||||
#define __LINUX_COMPILER_TYPES_H
|
||||
|
||||
|
|
@ -54,6 +55,9 @@ extern void __chk_io_ptr(const volatile void __iomem *);
|
|||
|
||||
#ifdef __KERNEL__
|
||||
|
||||
/* Attributes */
|
||||
#include <linux/compiler_attributes.h>
|
||||
|
||||
/* Compiler specific macros. */
|
||||
#ifdef __clang__
|
||||
#include <linux/compiler-clang.h>
|
||||
|
|
@ -78,12 +82,6 @@ extern void __chk_io_ptr(const volatile void __iomem *);
|
|||
#include <asm/compiler.h>
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Generic compiler-independent macros required for kernel
|
||||
* build go below this comment. Actual compiler/compiler version
|
||||
* specific implementations come from the above header files
|
||||
*/
|
||||
|
||||
struct ftrace_branch_data {
|
||||
const char *func;
|
||||
const char *file;
|
||||
|
|
@ -106,10 +104,6 @@ struct ftrace_likely_data {
|
|||
unsigned long constant;
|
||||
};
|
||||
|
||||
/* Don't. Just don't. */
|
||||
#define __deprecated
|
||||
#define __deprecated_for_modules
|
||||
|
||||
#endif /* __KERNEL__ */
|
||||
|
||||
#endif /* __ASSEMBLY__ */
|
||||
|
|
@ -119,10 +113,6 @@ struct ftrace_likely_data {
|
|||
* compilers. We don't consider that to be an error, so set them to nothing.
|
||||
* For example, some of them are for compiler specific plugins.
|
||||
*/
|
||||
#ifndef __designated_init
|
||||
# define __designated_init
|
||||
#endif
|
||||
|
||||
#ifndef __latent_entropy
|
||||
# define __latent_entropy
|
||||
#endif
|
||||
|
|
@ -140,15 +130,8 @@ struct ftrace_likely_data {
|
|||
# define randomized_struct_fields_end
|
||||
#endif
|
||||
|
||||
#ifndef __visible
|
||||
#define __visible
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Assume alignment of return value.
|
||||
*/
|
||||
#ifndef __assume_aligned
|
||||
#define __assume_aligned(a, ...)
|
||||
#ifndef asm_volatile_goto
|
||||
#define asm_volatile_goto(x...) asm goto(x)
|
||||
#endif
|
||||
|
||||
/* Are two types/vars the same type (ignoring qualifiers)? */
|
||||
|
|
@ -159,14 +142,6 @@ struct ftrace_likely_data {
|
|||
(sizeof(t) == sizeof(char) || sizeof(t) == sizeof(short) || \
|
||||
sizeof(t) == sizeof(int) || sizeof(t) == sizeof(long))
|
||||
|
||||
#ifndef __attribute_const__
|
||||
#define __attribute_const__ __attribute__((__const__))
|
||||
#endif
|
||||
|
||||
#ifndef __noclone
|
||||
#define __noclone
|
||||
#endif
|
||||
|
||||
/* Helpers for emitting diagnostics in pragmas. */
|
||||
#ifndef __diag
|
||||
#define __diag(string)
|
||||
|
|
@ -186,43 +161,16 @@ struct ftrace_likely_data {
|
|||
#define __diag_error(compiler, version, option, comment) \
|
||||
__diag_ ## compiler(version, error, option)
|
||||
|
||||
/*
|
||||
* From the GCC manual:
|
||||
*
|
||||
* Many functions have no effects except the return value and their
|
||||
* return value depends only on the parameters and/or global
|
||||
* variables. Such a function can be subject to common subexpression
|
||||
* elimination and loop optimization just as an arithmetic operator
|
||||
* would be.
|
||||
* [...]
|
||||
*/
|
||||
#define __pure __attribute__((pure))
|
||||
#define __aligned(x) __attribute__((aligned(x)))
|
||||
#define __printf(a, b) __attribute__((format(printf, a, b)))
|
||||
#define __scanf(a, b) __attribute__((format(scanf, a, b)))
|
||||
#define __maybe_unused __attribute__((unused))
|
||||
#define __always_unused __attribute__((unused))
|
||||
#define __mode(x) __attribute__((mode(x)))
|
||||
#define __malloc __attribute__((__malloc__))
|
||||
#define __used __attribute__((__used__))
|
||||
#define __noreturn __attribute__((noreturn))
|
||||
#define __packed __attribute__((packed))
|
||||
#define __weak __attribute__((weak))
|
||||
#define __alias(symbol) __attribute__((alias(#symbol)))
|
||||
#define __cold __attribute__((cold))
|
||||
#define __section(S) __attribute__((__section__(#S)))
|
||||
|
||||
|
||||
#ifdef CONFIG_ENABLE_MUST_CHECK
|
||||
#define __must_check __attribute__((warn_unused_result))
|
||||
#define __must_check __attribute__((__warn_unused_result__))
|
||||
#else
|
||||
#define __must_check
|
||||
#endif
|
||||
|
||||
#if defined(CC_USING_HOTPATCH) && !defined(__CHECKER__)
|
||||
#if defined(CC_USING_HOTPATCH)
|
||||
#define notrace __attribute__((hotpatch(0, 0)))
|
||||
#else
|
||||
#define notrace __attribute__((no_instrument_function))
|
||||
#define notrace __attribute__((__no_instrument_function__))
|
||||
#endif
|
||||
|
||||
/*
|
||||
|
|
@ -231,22 +179,10 @@ struct ftrace_likely_data {
|
|||
* stack and frame pointer being set up and there is no chance to
|
||||
* restore the lr register to the value before mcount was called.
|
||||
*/
|
||||
#define __naked __attribute__((naked)) notrace
|
||||
#define __naked __attribute__((__naked__)) notrace
|
||||
|
||||
#define __compiler_offsetof(a, b) __builtin_offsetof(a, b)
|
||||
|
||||
/*
|
||||
* Feature detection for gnu_inline (gnu89 extern inline semantics). Either
|
||||
* __GNUC_STDC_INLINE__ is defined (not using gnu89 extern inline semantics,
|
||||
* and we opt in to the gnu89 semantics), or __GNUC_STDC_INLINE__ is not
|
||||
* defined so the gnu89 semantics are the default.
|
||||
*/
|
||||
#ifdef __GNUC_STDC_INLINE__
|
||||
# define __gnu_inline __attribute__((gnu_inline))
|
||||
#else
|
||||
# define __gnu_inline
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Force always-inline if the user requests it so via the .config.
|
||||
* GCC does not warn about unused static inline functions for
|
||||
|
|
@ -258,22 +194,20 @@ struct ftrace_likely_data {
|
|||
* semantics rather than c99. This prevents multiple symbol definition errors
|
||||
* of extern inline functions at link time.
|
||||
* A lot of inline functions can cause havoc with function tracing.
|
||||
* Do not use __always_inline here, since currently it expands to inline again
|
||||
* (which would break users of __always_inline).
|
||||
*/
|
||||
#if !defined(CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING) || \
|
||||
!defined(CONFIG_OPTIMIZE_INLINING)
|
||||
#define inline \
|
||||
inline __attribute__((always_inline, unused)) notrace __gnu_inline
|
||||
#define inline inline __attribute__((__always_inline__)) __gnu_inline \
|
||||
__maybe_unused notrace
|
||||
#else
|
||||
#define inline inline __attribute__((unused)) notrace __gnu_inline
|
||||
#define inline inline __gnu_inline \
|
||||
__maybe_unused notrace
|
||||
#endif
|
||||
|
||||
#define __inline__ inline
|
||||
#define __inline inline
|
||||
#define noinline __attribute__((noinline))
|
||||
|
||||
#ifndef __always_inline
|
||||
#define __always_inline inline __attribute__((always_inline))
|
||||
#endif
|
||||
#define __inline inline
|
||||
|
||||
/*
|
||||
* Rather then using noinline to prevent stack consumption, use
|
||||
|
|
|
|||
|
|
@ -126,6 +126,7 @@ enum cpuhp_state {
|
|||
CPUHP_AP_MIPS_GIC_TIMER_STARTING,
|
||||
CPUHP_AP_ARC_TIMER_STARTING,
|
||||
CPUHP_AP_RISCV_TIMER_STARTING,
|
||||
CPUHP_AP_CSKY_TIMER_STARTING,
|
||||
CPUHP_AP_KVM_STARTING,
|
||||
CPUHP_AP_KVM_ARM_VGIC_INIT_STARTING,
|
||||
CPUHP_AP_KVM_ARM_VGIC_STARTING,
|
||||
|
|
|
|||
|
|
@ -7,6 +7,8 @@
|
|||
#include <linux/radix-tree.h>
|
||||
#include <asm/pgtable.h>
|
||||
|
||||
typedef unsigned long dax_entry_t;
|
||||
|
||||
struct iomap_ops;
|
||||
struct dax_device;
|
||||
struct dax_operations {
|
||||
|
|
@ -88,8 +90,8 @@ int dax_writeback_mapping_range(struct address_space *mapping,
|
|||
struct block_device *bdev, struct writeback_control *wbc);
|
||||
|
||||
struct page *dax_layout_busy_page(struct address_space *mapping);
|
||||
bool dax_lock_mapping_entry(struct page *page);
|
||||
void dax_unlock_mapping_entry(struct page *page);
|
||||
dax_entry_t dax_lock_page(struct page *page);
|
||||
void dax_unlock_page(struct page *page, dax_entry_t cookie);
|
||||
#else
|
||||
static inline bool bdev_dax_supported(struct block_device *bdev,
|
||||
int blocksize)
|
||||
|
|
@ -122,14 +124,14 @@ static inline int dax_writeback_mapping_range(struct address_space *mapping,
|
|||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
static inline bool dax_lock_mapping_entry(struct page *page)
|
||||
static inline dax_entry_t dax_lock_page(struct page *page)
|
||||
{
|
||||
if (IS_DAX(page->mapping->host))
|
||||
return true;
|
||||
return false;
|
||||
return ~0UL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline void dax_unlock_mapping_entry(struct page *page)
|
||||
static inline void dax_unlock_page(struct page *page, dax_entry_t cookie)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
#include <linux/dma-mapping.h>
|
||||
#include <linux/mem_encrypt.h>
|
||||
|
||||
#define DIRECT_MAPPING_ERROR 0
|
||||
#define DIRECT_MAPPING_ERROR (~(dma_addr_t)0)
|
||||
|
||||
#ifdef CONFIG_ARCH_HAS_PHYS_TO_DMA
|
||||
#include <asm/dma-direct.h>
|
||||
|
|
|
|||
|
|
@ -1167,6 +1167,8 @@ static inline bool efi_enabled(int feature)
|
|||
extern void efi_reboot(enum reboot_mode reboot_mode, const char *__unused);
|
||||
|
||||
extern bool efi_is_table_address(unsigned long phys_addr);
|
||||
|
||||
extern int efi_apply_persistent_mem_reservations(void);
|
||||
#else
|
||||
static inline bool efi_enabled(int feature)
|
||||
{
|
||||
|
|
@ -1185,6 +1187,11 @@ static inline bool efi_is_table_address(unsigned long phys_addr)
|
|||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
static inline int efi_apply_persistent_mem_reservations(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
extern int efi_status_to_err(efi_status_t status);
|
||||
|
|
|
|||
|
|
@ -449,6 +449,13 @@ struct sock_reuseport;
|
|||
offsetof(TYPE, MEMBER) ... offsetofend(TYPE, MEMBER) - 1
|
||||
#define bpf_ctx_range_till(TYPE, MEMBER1, MEMBER2) \
|
||||
offsetof(TYPE, MEMBER1) ... offsetofend(TYPE, MEMBER2) - 1
|
||||
#if BITS_PER_LONG == 64
|
||||
# define bpf_ctx_range_ptr(TYPE, MEMBER) \
|
||||
offsetof(TYPE, MEMBER) ... offsetofend(TYPE, MEMBER) - 1
|
||||
#else
|
||||
# define bpf_ctx_range_ptr(TYPE, MEMBER) \
|
||||
offsetof(TYPE, MEMBER) ... offsetof(TYPE, MEMBER) + 8 - 1
|
||||
#endif /* BITS_PER_LONG == 64 */
|
||||
|
||||
#define bpf_target_off(TYPE, MEMBER, SIZE, PTR_SIZE) \
|
||||
({ \
|
||||
|
|
@ -866,6 +873,10 @@ void bpf_jit_binary_free(struct bpf_binary_header *hdr);
|
|||
|
||||
void bpf_jit_free(struct bpf_prog *fp);
|
||||
|
||||
int bpf_jit_get_func_addr(const struct bpf_prog *prog,
|
||||
const struct bpf_insn *insn, bool extra_pass,
|
||||
u64 *func_addr, bool *func_addr_fixed);
|
||||
|
||||
struct bpf_prog *bpf_jit_blind_constants(struct bpf_prog *fp);
|
||||
void bpf_jit_prog_release_other(struct bpf_prog *fp, struct bpf_prog *fp_other);
|
||||
|
||||
|
|
|
|||
|
|
@ -1752,6 +1752,25 @@ struct block_device_operations;
|
|||
#define NOMMU_VMFLAGS \
|
||||
(NOMMU_MAP_READ | NOMMU_MAP_WRITE | NOMMU_MAP_EXEC)
|
||||
|
||||
/*
|
||||
* These flags control the behavior of the remap_file_range function pointer.
|
||||
* If it is called with len == 0 that means "remap to end of source file".
|
||||
* See Documentation/filesystems/vfs.txt for more details about this call.
|
||||
*
|
||||
* REMAP_FILE_DEDUP: only remap if contents identical (i.e. deduplicate)
|
||||
* REMAP_FILE_CAN_SHORTEN: caller can handle a shortened request
|
||||
*/
|
||||
#define REMAP_FILE_DEDUP (1 << 0)
|
||||
#define REMAP_FILE_CAN_SHORTEN (1 << 1)
|
||||
|
||||
/*
|
||||
* These flags signal that the caller is ok with altering various aspects of
|
||||
* the behavior of the remap operation. The changes must be made by the
|
||||
* implementation; the vfs remap helper functions can take advantage of them.
|
||||
* Flags in this category exist to preserve the quirky behavior of the hoisted
|
||||
* btrfs clone/dedupe ioctls.
|
||||
*/
|
||||
#define REMAP_FILE_ADVISORY (REMAP_FILE_CAN_SHORTEN)
|
||||
|
||||
struct iov_iter;
|
||||
|
||||
|
|
@ -1790,10 +1809,9 @@ struct file_operations {
|
|||
#endif
|
||||
ssize_t (*copy_file_range)(struct file *, loff_t, struct file *,
|
||||
loff_t, size_t, unsigned int);
|
||||
int (*clone_file_range)(struct file *, loff_t, struct file *, loff_t,
|
||||
u64);
|
||||
int (*dedupe_file_range)(struct file *, loff_t, struct file *, loff_t,
|
||||
u64);
|
||||
loff_t (*remap_file_range)(struct file *file_in, loff_t pos_in,
|
||||
struct file *file_out, loff_t pos_out,
|
||||
loff_t len, unsigned int remap_flags);
|
||||
int (*fadvise)(struct file *, loff_t, loff_t, int);
|
||||
} __randomize_layout;
|
||||
|
||||
|
|
@ -1856,21 +1874,21 @@ extern ssize_t vfs_readv(struct file *, const struct iovec __user *,
|
|||
unsigned long, loff_t *, rwf_t);
|
||||
extern ssize_t vfs_copy_file_range(struct file *, loff_t , struct file *,
|
||||
loff_t, size_t, unsigned int);
|
||||
extern int vfs_clone_file_prep_inodes(struct inode *inode_in, loff_t pos_in,
|
||||
struct inode *inode_out, loff_t pos_out,
|
||||
u64 *len, bool is_dedupe);
|
||||
extern int do_clone_file_range(struct file *file_in, loff_t pos_in,
|
||||
struct file *file_out, loff_t pos_out, u64 len);
|
||||
extern int vfs_clone_file_range(struct file *file_in, loff_t pos_in,
|
||||
struct file *file_out, loff_t pos_out, u64 len);
|
||||
extern int vfs_dedupe_file_range_compare(struct inode *src, loff_t srcoff,
|
||||
struct inode *dest, loff_t destoff,
|
||||
loff_t len, bool *is_same);
|
||||
extern int generic_remap_file_range_prep(struct file *file_in, loff_t pos_in,
|
||||
struct file *file_out, loff_t pos_out,
|
||||
loff_t *count,
|
||||
unsigned int remap_flags);
|
||||
extern loff_t do_clone_file_range(struct file *file_in, loff_t pos_in,
|
||||
struct file *file_out, loff_t pos_out,
|
||||
loff_t len, unsigned int remap_flags);
|
||||
extern loff_t vfs_clone_file_range(struct file *file_in, loff_t pos_in,
|
||||
struct file *file_out, loff_t pos_out,
|
||||
loff_t len, unsigned int remap_flags);
|
||||
extern int vfs_dedupe_file_range(struct file *file,
|
||||
struct file_dedupe_range *same);
|
||||
extern int vfs_dedupe_file_range_one(struct file *src_file, loff_t src_pos,
|
||||
struct file *dst_file, loff_t dst_pos,
|
||||
u64 len);
|
||||
extern loff_t vfs_dedupe_file_range_one(struct file *src_file, loff_t src_pos,
|
||||
struct file *dst_file, loff_t dst_pos,
|
||||
loff_t len, unsigned int remap_flags);
|
||||
|
||||
|
||||
struct super_operations {
|
||||
|
|
@ -2998,6 +3016,9 @@ extern int sb_min_blocksize(struct super_block *, int);
|
|||
extern int generic_file_mmap(struct file *, struct vm_area_struct *);
|
||||
extern int generic_file_readonly_mmap(struct file *, struct vm_area_struct *);
|
||||
extern ssize_t generic_write_checks(struct kiocb *, struct iov_iter *);
|
||||
extern int generic_remap_checks(struct file *file_in, loff_t pos_in,
|
||||
struct file *file_out, loff_t pos_out,
|
||||
loff_t *count, unsigned int remap_flags);
|
||||
extern ssize_t generic_file_read_iter(struct kiocb *, struct iov_iter *);
|
||||
extern ssize_t __generic_file_write_iter(struct kiocb *, struct iov_iter *);
|
||||
extern ssize_t generic_file_write_iter(struct kiocb *, struct iov_iter *);
|
||||
|
|
|
|||
|
|
@ -196,8 +196,7 @@ static inline void fscache_enqueue_retrieval(struct fscache_retrieval *op)
|
|||
static inline void fscache_retrieval_complete(struct fscache_retrieval *op,
|
||||
int n_pages)
|
||||
{
|
||||
atomic_sub(n_pages, &op->n_pages);
|
||||
if (atomic_read(&op->n_pages) <= 0)
|
||||
if (atomic_sub_return_relaxed(n_pages, &op->n_pages) <= 0)
|
||||
fscache_op_complete(&op->op, false);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -777,8 +777,8 @@ struct ftrace_ret_stack {
|
|||
extern void return_to_handler(void);
|
||||
|
||||
extern int
|
||||
ftrace_push_return_trace(unsigned long ret, unsigned long func, int *depth,
|
||||
unsigned long frame_pointer, unsigned long *retp);
|
||||
function_graph_enter(unsigned long ret, unsigned long func,
|
||||
unsigned long frame_pointer, unsigned long *retp);
|
||||
|
||||
unsigned long ftrace_graph_ret_addr(struct task_struct *task, int *idx,
|
||||
unsigned long ret, unsigned long *retp);
|
||||
|
|
|
|||
|
|
@ -511,14 +511,14 @@ alloc_pages(gfp_t gfp_mask, unsigned int order)
|
|||
extern struct page *alloc_pages_vma(gfp_t gfp_mask, int order,
|
||||
struct vm_area_struct *vma, unsigned long addr,
|
||||
int node, bool hugepage);
|
||||
#define alloc_hugepage_vma(gfp_mask, vma, addr, order) \
|
||||
#define alloc_hugepage_vma(gfp_mask, vma, addr, order) \
|
||||
alloc_pages_vma(gfp_mask, order, vma, addr, numa_node_id(), true)
|
||||
#else
|
||||
#define alloc_pages(gfp_mask, order) \
|
||||
alloc_pages_node(numa_node_id(), gfp_mask, order)
|
||||
#define alloc_pages_vma(gfp_mask, order, vma, addr, node, false)\
|
||||
alloc_pages(gfp_mask, order)
|
||||
#define alloc_hugepage_vma(gfp_mask, vma, addr, order) \
|
||||
#define alloc_hugepage_vma(gfp_mask, vma, addr, order) \
|
||||
alloc_pages(gfp_mask, order)
|
||||
#endif
|
||||
#define alloc_page(gfp_mask) alloc_pages(gfp_mask, 0)
|
||||
|
|
|
|||
|
|
@ -177,6 +177,7 @@ int sensor_hub_input_get_attribute_info(struct hid_sensor_hub_device *hsdev,
|
|||
* @attr_usage_id: Attribute usage id as per spec
|
||||
* @report_id: Report id to look for
|
||||
* @flag: Synchronous or asynchronous read
|
||||
* @is_signed: If true then fields < 32 bits will be sign-extended
|
||||
*
|
||||
* Issues a synchronous or asynchronous read request for an input attribute.
|
||||
* Returns data upto 32 bits.
|
||||
|
|
@ -190,7 +191,8 @@ enum sensor_hub_read_flags {
|
|||
int sensor_hub_input_attr_get_raw_value(struct hid_sensor_hub_device *hsdev,
|
||||
u32 usage_id,
|
||||
u32 attr_usage_id, u32 report_id,
|
||||
enum sensor_hub_read_flags flag
|
||||
enum sensor_hub_read_flags flag,
|
||||
bool is_signed
|
||||
);
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -219,6 +219,7 @@ struct hid_item {
|
|||
#define HID_GD_VBRZ 0x00010045
|
||||
#define HID_GD_VNO 0x00010046
|
||||
#define HID_GD_FEATURE 0x00010047
|
||||
#define HID_GD_RESOLUTION_MULTIPLIER 0x00010048
|
||||
#define HID_GD_SYSTEM_CONTROL 0x00010080
|
||||
#define HID_GD_UP 0x00010090
|
||||
#define HID_GD_DOWN 0x00010091
|
||||
|
|
@ -232,12 +233,14 @@ struct hid_item {
|
|||
#define HID_DC_BATTERYSTRENGTH 0x00060020
|
||||
|
||||
#define HID_CP_CONSUMER_CONTROL 0x000c0001
|
||||
#define HID_CP_AC_PAN 0x000c0238
|
||||
|
||||
#define HID_DG_DIGITIZER 0x000d0001
|
||||
#define HID_DG_PEN 0x000d0002
|
||||
#define HID_DG_LIGHTPEN 0x000d0003
|
||||
#define HID_DG_TOUCHSCREEN 0x000d0004
|
||||
#define HID_DG_TOUCHPAD 0x000d0005
|
||||
#define HID_DG_WHITEBOARD 0x000d0006
|
||||
#define HID_DG_STYLUS 0x000d0020
|
||||
#define HID_DG_PUCK 0x000d0021
|
||||
#define HID_DG_FINGER 0x000d0022
|
||||
|
|
@ -427,6 +430,7 @@ struct hid_local {
|
|||
*/
|
||||
|
||||
struct hid_collection {
|
||||
struct hid_collection *parent;
|
||||
unsigned type;
|
||||
unsigned usage;
|
||||
unsigned level;
|
||||
|
|
@ -436,12 +440,16 @@ struct hid_usage {
|
|||
unsigned hid; /* hid usage code */
|
||||
unsigned collection_index; /* index into collection array */
|
||||
unsigned usage_index; /* index into usage array */
|
||||
__s8 resolution_multiplier;/* Effective Resolution Multiplier
|
||||
(HUT v1.12, 4.3.1), default: 1 */
|
||||
/* hidinput data */
|
||||
__s8 wheel_factor; /* 120/resolution_multiplier */
|
||||
__u16 code; /* input driver code */
|
||||
__u8 type; /* input driver type */
|
||||
__s8 hat_min; /* hat switch fun */
|
||||
__s8 hat_max; /* ditto */
|
||||
__s8 hat_dir; /* ditto */
|
||||
__s16 wheel_accumulated; /* hi-res wheel */
|
||||
};
|
||||
|
||||
struct hid_input;
|
||||
|
|
@ -650,6 +658,7 @@ struct hid_parser {
|
|||
unsigned int *collection_stack;
|
||||
unsigned int collection_stack_ptr;
|
||||
unsigned int collection_stack_size;
|
||||
struct hid_collection *active_collection;
|
||||
struct hid_device *device;
|
||||
unsigned int scan_flags;
|
||||
};
|
||||
|
|
@ -836,7 +845,11 @@ static inline bool hid_is_using_ll_driver(struct hid_device *hdev,
|
|||
|
||||
/* Applications from HID Usage Tables 4/8/99 Version 1.1 */
|
||||
/* We ignore a few input applications that are not widely used */
|
||||
#define IS_INPUT_APPLICATION(a) (((a >= 0x00010000) && (a <= 0x00010008)) || (a == 0x00010080) || (a == 0x000c0001) || ((a >= 0x000d0002) && (a <= 0x000d0006)))
|
||||
#define IS_INPUT_APPLICATION(a) \
|
||||
(((a >= HID_UP_GENDESK) && (a <= HID_GD_MULTIAXIS)) \
|
||||
|| ((a >= HID_DG_PEN) && (a <= HID_DG_WHITEBOARD)) \
|
||||
|| (a == HID_GD_SYSTEM_CONTROL) || (a == HID_CP_CONSUMER_CONTROL) \
|
||||
|| (a == HID_GD_WIRELESS_RADIO_CTLS))
|
||||
|
||||
/* HID core API */
|
||||
|
||||
|
|
@ -892,6 +905,8 @@ struct hid_report *hid_validate_values(struct hid_device *hid,
|
|||
unsigned int type, unsigned int id,
|
||||
unsigned int field_index,
|
||||
unsigned int report_counts);
|
||||
|
||||
void hid_setup_resolution_multiplier(struct hid_device *hid);
|
||||
int hid_open_report(struct hid_device *device);
|
||||
int hid_check_keys_pressed(struct hid_device *hid);
|
||||
int hid_connect(struct hid_device *hid, unsigned int connect_mask);
|
||||
|
|
|
|||
|
|
@ -905,6 +905,13 @@ struct vmbus_channel {
|
|||
|
||||
bool probe_done;
|
||||
|
||||
/*
|
||||
* We must offload the handling of the primary/sub channels
|
||||
* from the single-threaded vmbus_connection.work_queue to
|
||||
* two different workqueue, otherwise we can block
|
||||
* vmbus_connection.work_queue and hang: see vmbus_process_offer().
|
||||
*/
|
||||
struct work_struct add_channel_work;
|
||||
};
|
||||
|
||||
static inline bool is_hvsock_channel(const struct vmbus_channel *c)
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@
|
|||
#define PIT_LATCH ((PIT_TICK_RATE + HZ/2) / HZ)
|
||||
|
||||
extern raw_spinlock_t i8253_lock;
|
||||
extern bool i8253_clear_counter_on_shutdown;
|
||||
extern struct clock_event_device i8253_clockevent;
|
||||
extern void clockevent_i8253_init(bool oneshot);
|
||||
|
||||
|
|
|
|||
|
|
@ -37,7 +37,9 @@ struct in_device {
|
|||
unsigned long mr_v1_seen;
|
||||
unsigned long mr_v2_seen;
|
||||
unsigned long mr_maxdelay;
|
||||
unsigned char mr_qrv;
|
||||
unsigned long mr_qi; /* Query Interval */
|
||||
unsigned long mr_qri; /* Query Response Interval */
|
||||
unsigned char mr_qrv; /* Query Robustness Variable */
|
||||
unsigned char mr_gq_running;
|
||||
unsigned char mr_ifc_count;
|
||||
struct timer_list mr_gq_timer; /* general query timer */
|
||||
|
|
|
|||
|
|
@ -17,6 +17,9 @@
|
|||
|
||||
#ifdef CONFIG_KEYS
|
||||
|
||||
struct kernel_pkey_query;
|
||||
struct kernel_pkey_params;
|
||||
|
||||
/*
|
||||
* key under-construction record
|
||||
* - passed to the request_key actor if supplied
|
||||
|
|
@ -155,6 +158,14 @@ struct key_type {
|
|||
*/
|
||||
struct key_restriction *(*lookup_restriction)(const char *params);
|
||||
|
||||
/* Asymmetric key accessor functions. */
|
||||
int (*asym_query)(const struct kernel_pkey_params *params,
|
||||
struct kernel_pkey_query *info);
|
||||
int (*asym_eds_op)(struct kernel_pkey_params *params,
|
||||
const void *in, void *out);
|
||||
int (*asym_verify_signature)(struct kernel_pkey_params *params,
|
||||
const void *in, const void *in2);
|
||||
|
||||
/* internal fields */
|
||||
struct list_head link; /* link in types list */
|
||||
struct lock_class_key lock_class; /* key->sem lock class */
|
||||
|
|
|
|||
46
include/linux/keyctl.h
Normal file
46
include/linux/keyctl.h
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
/* keyctl kernel bits
|
||||
*
|
||||
* Copyright (C) 2016 Red Hat, Inc. All Rights Reserved.
|
||||
* Written by David Howells (dhowells@redhat.com)
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public Licence
|
||||
* as published by the Free Software Foundation; either version
|
||||
* 2 of the Licence, or (at your option) any later version.
|
||||
*/
|
||||
|
||||
#ifndef __LINUX_KEYCTL_H
|
||||
#define __LINUX_KEYCTL_H
|
||||
|
||||
#include <uapi/linux/keyctl.h>
|
||||
|
||||
struct kernel_pkey_query {
|
||||
__u32 supported_ops; /* Which ops are supported */
|
||||
__u32 key_size; /* Size of the key in bits */
|
||||
__u16 max_data_size; /* Maximum size of raw data to sign in bytes */
|
||||
__u16 max_sig_size; /* Maximum size of signature in bytes */
|
||||
__u16 max_enc_size; /* Maximum size of encrypted blob in bytes */
|
||||
__u16 max_dec_size; /* Maximum size of decrypted blob in bytes */
|
||||
};
|
||||
|
||||
enum kernel_pkey_operation {
|
||||
kernel_pkey_encrypt,
|
||||
kernel_pkey_decrypt,
|
||||
kernel_pkey_sign,
|
||||
kernel_pkey_verify,
|
||||
};
|
||||
|
||||
struct kernel_pkey_params {
|
||||
struct key *key;
|
||||
const char *encoding; /* Encoding (eg. "oaep" or "raw" for none) */
|
||||
const char *hash_algo; /* Digest algorithm used (eg. "sha1") or NULL if N/A */
|
||||
char *info; /* Modified info string to be released later */
|
||||
__u32 in_len; /* Input data size */
|
||||
union {
|
||||
__u32 out_len; /* Output buffer size (enc/dec/sign) */
|
||||
__u32 in2_len; /* 2nd input data size (verify) */
|
||||
};
|
||||
enum kernel_pkey_operation op : 8;
|
||||
};
|
||||
|
||||
#endif /* __LINUX_KEYCTL_H */
|
||||
|
|
@ -2473,14 +2473,15 @@ struct mlx5_ifc_xrc_srqc_bits {
|
|||
|
||||
u8 wq_signature[0x1];
|
||||
u8 cont_srq[0x1];
|
||||
u8 dbr_umem_valid[0x1];
|
||||
u8 reserved_at_22[0x1];
|
||||
u8 rlky[0x1];
|
||||
u8 basic_cyclic_rcv_wqe[0x1];
|
||||
u8 log_rq_stride[0x3];
|
||||
u8 xrcd[0x18];
|
||||
|
||||
u8 page_offset[0x6];
|
||||
u8 reserved_at_46[0x2];
|
||||
u8 reserved_at_46[0x1];
|
||||
u8 dbr_umem_valid[0x1];
|
||||
u8 cqn[0x18];
|
||||
|
||||
u8 reserved_at_60[0x20];
|
||||
|
|
@ -6689,9 +6690,12 @@ struct mlx5_ifc_create_xrc_srq_in_bits {
|
|||
|
||||
struct mlx5_ifc_xrc_srqc_bits xrc_srq_context_entry;
|
||||
|
||||
u8 reserved_at_280[0x40];
|
||||
u8 reserved_at_280[0x60];
|
||||
|
||||
u8 xrc_srq_umem_valid[0x1];
|
||||
u8 reserved_at_2c1[0x5bf];
|
||||
u8 reserved_at_2e1[0x1f];
|
||||
|
||||
u8 reserved_at_300[0x580];
|
||||
|
||||
u8 pas[0][0x40];
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1744,11 +1744,15 @@ int __pud_alloc(struct mm_struct *mm, p4d_t *p4d, unsigned long address);
|
|||
|
||||
static inline void mm_inc_nr_puds(struct mm_struct *mm)
|
||||
{
|
||||
if (mm_pud_folded(mm))
|
||||
return;
|
||||
atomic_long_add(PTRS_PER_PUD * sizeof(pud_t), &mm->pgtables_bytes);
|
||||
}
|
||||
|
||||
static inline void mm_dec_nr_puds(struct mm_struct *mm)
|
||||
{
|
||||
if (mm_pud_folded(mm))
|
||||
return;
|
||||
atomic_long_sub(PTRS_PER_PUD * sizeof(pud_t), &mm->pgtables_bytes);
|
||||
}
|
||||
#endif
|
||||
|
|
@ -1768,11 +1772,15 @@ int __pmd_alloc(struct mm_struct *mm, pud_t *pud, unsigned long address);
|
|||
|
||||
static inline void mm_inc_nr_pmds(struct mm_struct *mm)
|
||||
{
|
||||
if (mm_pmd_folded(mm))
|
||||
return;
|
||||
atomic_long_add(PTRS_PER_PMD * sizeof(pmd_t), &mm->pgtables_bytes);
|
||||
}
|
||||
|
||||
static inline void mm_dec_nr_pmds(struct mm_struct *mm)
|
||||
{
|
||||
if (mm_pmd_folded(mm))
|
||||
return;
|
||||
atomic_long_sub(PTRS_PER_PMD * sizeof(pmd_t), &mm->pgtables_bytes);
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -324,9 +324,8 @@ static inline unsigned int nanddev_ntargets(const struct nand_device *nand)
|
|||
*/
|
||||
static inline unsigned int nanddev_neraseblocks(const struct nand_device *nand)
|
||||
{
|
||||
return (u64)nand->memorg.luns_per_target *
|
||||
nand->memorg.eraseblocks_per_lun *
|
||||
nand->memorg.pages_per_eraseblock;
|
||||
return nand->memorg.ntargets * nand->memorg.luns_per_target *
|
||||
nand->memorg.eraseblocks_per_lun;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -569,7 +568,7 @@ static inline void nanddev_pos_next_eraseblock(struct nand_device *nand,
|
|||
}
|
||||
|
||||
/**
|
||||
* nanddev_pos_next_eraseblock() - Move a position to the next page
|
||||
* nanddev_pos_next_page() - Move a position to the next page
|
||||
* @nand: NAND device
|
||||
* @pos: the position to update
|
||||
*
|
||||
|
|
|
|||
|
|
@ -406,6 +406,8 @@ static inline void net_dim(struct net_dim *dim,
|
|||
}
|
||||
/* fall through */
|
||||
case NET_DIM_START_MEASURE:
|
||||
net_dim_sample(end_sample.event_ctr, end_sample.pkt_ctr, end_sample.byte_ctr,
|
||||
&dim->start_sample);
|
||||
dim->state = NET_DIM_MEASURE_IN_PROGRESS;
|
||||
break;
|
||||
case NET_DIM_APPLY_NEW_PROFILE:
|
||||
|
|
|
|||
|
|
@ -3190,6 +3190,26 @@ static inline void netdev_tx_sent_queue(struct netdev_queue *dev_queue,
|
|||
#endif
|
||||
}
|
||||
|
||||
/* Variant of netdev_tx_sent_queue() for drivers that are aware
|
||||
* that they should not test BQL status themselves.
|
||||
* We do want to change __QUEUE_STATE_STACK_XOFF only for the last
|
||||
* skb of a batch.
|
||||
* Returns true if the doorbell must be used to kick the NIC.
|
||||
*/
|
||||
static inline bool __netdev_tx_sent_queue(struct netdev_queue *dev_queue,
|
||||
unsigned int bytes,
|
||||
bool xmit_more)
|
||||
{
|
||||
if (xmit_more) {
|
||||
#ifdef CONFIG_BQL
|
||||
dql_queued(&dev_queue->dql, bytes);
|
||||
#endif
|
||||
return netif_tx_queue_stopped(dev_queue);
|
||||
}
|
||||
netdev_tx_sent_queue(dev_queue, bytes);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* netdev_sent_queue - report the number of bytes queued to hardware
|
||||
* @dev: network device
|
||||
|
|
|
|||
|
|
@ -314,7 +314,7 @@ enum {
|
|||
extern ip_set_id_t ip_set_get_byname(struct net *net,
|
||||
const char *name, struct ip_set **set);
|
||||
extern void ip_set_put_byindex(struct net *net, ip_set_id_t index);
|
||||
extern const char *ip_set_name_byindex(struct net *net, ip_set_id_t index);
|
||||
extern void ip_set_name_byindex(struct net *net, ip_set_id_t index, char *name);
|
||||
extern ip_set_id_t ip_set_nfnl_get_byindex(struct net *net, ip_set_id_t index);
|
||||
extern void ip_set_nfnl_put(struct net *net, ip_set_id_t index);
|
||||
|
||||
|
|
|
|||
|
|
@ -43,11 +43,11 @@ ip_set_init_comment(struct ip_set *set, struct ip_set_comment *comment,
|
|||
rcu_assign_pointer(comment->c, c);
|
||||
}
|
||||
|
||||
/* Used only when dumping a set, protected by rcu_read_lock_bh() */
|
||||
/* Used only when dumping a set, protected by rcu_read_lock() */
|
||||
static inline int
|
||||
ip_set_put_comment(struct sk_buff *skb, const struct ip_set_comment *comment)
|
||||
{
|
||||
struct ip_set_comment_rcu *c = rcu_dereference_bh(comment->c);
|
||||
struct ip_set_comment_rcu *c = rcu_dereference(comment->c);
|
||||
|
||||
if (!c)
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -21,6 +21,19 @@ struct nf_ct_gre_keymap {
|
|||
struct nf_conntrack_tuple tuple;
|
||||
};
|
||||
|
||||
enum grep_conntrack {
|
||||
GRE_CT_UNREPLIED,
|
||||
GRE_CT_REPLIED,
|
||||
GRE_CT_MAX
|
||||
};
|
||||
|
||||
struct netns_proto_gre {
|
||||
struct nf_proto_net nf;
|
||||
rwlock_t keymap_lock;
|
||||
struct list_head keymap_list;
|
||||
unsigned int gre_timeouts[GRE_CT_MAX];
|
||||
};
|
||||
|
||||
/* add new tuple->key_reply pair to keymap */
|
||||
int nf_ct_gre_keymap_add(struct nf_conn *ct, enum ip_conntrack_dir dir,
|
||||
struct nf_conntrack_tuple *t);
|
||||
|
|
|
|||
|
|
@ -119,6 +119,8 @@ static inline int hardlockup_detector_perf_init(void) { return 0; }
|
|||
void watchdog_nmi_stop(void);
|
||||
void watchdog_nmi_start(void);
|
||||
int watchdog_nmi_probe(void);
|
||||
int watchdog_nmi_enable(unsigned int cpu);
|
||||
void watchdog_nmi_disable(unsigned int cpu);
|
||||
|
||||
/**
|
||||
* touch_nmi_watchdog - restart NMI watchdog timeout.
|
||||
|
|
|
|||
|
|
@ -122,8 +122,7 @@ extern void srcu_init_notifier_head(struct srcu_notifier_head *nh);
|
|||
|
||||
#ifdef CONFIG_TREE_SRCU
|
||||
#define _SRCU_NOTIFIER_HEAD(name, mod) \
|
||||
static DEFINE_PER_CPU(struct srcu_data, \
|
||||
name##_head_srcu_data); \
|
||||
static DEFINE_PER_CPU(struct srcu_data, name##_head_srcu_data); \
|
||||
mod struct srcu_notifier_head name = \
|
||||
SRCU_NOTIFIER_INIT(name, name##_head_srcu_data)
|
||||
|
||||
|
|
|
|||
|
|
@ -17,6 +17,8 @@
|
|||
#define __DAVINCI_GPIO_PLATFORM_H
|
||||
|
||||
struct davinci_gpio_platform_data {
|
||||
bool no_auto_base;
|
||||
u32 base;
|
||||
u32 ngpio;
|
||||
u32 gpio_unbanked;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
#ifndef _LINUX_PSI_H
|
||||
#define _LINUX_PSI_H
|
||||
|
||||
#include <linux/jump_label.h>
|
||||
#include <linux/psi_types.h>
|
||||
#include <linux/sched.h>
|
||||
|
||||
|
|
@ -9,7 +10,7 @@ struct css_set;
|
|||
|
||||
#ifdef CONFIG_PSI
|
||||
|
||||
extern bool psi_disabled;
|
||||
extern struct static_key_false psi_disabled;
|
||||
|
||||
void psi_init(void);
|
||||
|
||||
|
|
|
|||
|
|
@ -90,7 +90,10 @@ struct pstore_record {
|
|||
*
|
||||
* @buf_lock: spinlock to serialize access to @buf
|
||||
* @buf: preallocated crash dump buffer
|
||||
* @bufsize: size of @buf available for crash dump writes
|
||||
* @bufsize: size of @buf available for crash dump bytes (must match
|
||||
* smallest number of bytes available for writing to a
|
||||
* backend entry, since compressed bytes don't take kindly
|
||||
* to being truncated)
|
||||
*
|
||||
* @read_mutex: serializes @open, @read, @close, and @erase callbacks
|
||||
* @flags: bitfield of frontends the backend can accept writes for
|
||||
|
|
|
|||
|
|
@ -64,15 +64,12 @@ extern void exit_ptrace(struct task_struct *tracer, struct list_head *dead);
|
|||
#define PTRACE_MODE_NOAUDIT 0x04
|
||||
#define PTRACE_MODE_FSCREDS 0x08
|
||||
#define PTRACE_MODE_REALCREDS 0x10
|
||||
#define PTRACE_MODE_SCHED 0x20
|
||||
#define PTRACE_MODE_IBPB 0x40
|
||||
|
||||
/* shorthands for READ/ATTACH and FSCREDS/REALCREDS combinations */
|
||||
#define PTRACE_MODE_READ_FSCREDS (PTRACE_MODE_READ | PTRACE_MODE_FSCREDS)
|
||||
#define PTRACE_MODE_READ_REALCREDS (PTRACE_MODE_READ | PTRACE_MODE_REALCREDS)
|
||||
#define PTRACE_MODE_ATTACH_FSCREDS (PTRACE_MODE_ATTACH | PTRACE_MODE_FSCREDS)
|
||||
#define PTRACE_MODE_ATTACH_REALCREDS (PTRACE_MODE_ATTACH | PTRACE_MODE_REALCREDS)
|
||||
#define PTRACE_MODE_SPEC_IBPB (PTRACE_MODE_ATTACH_REALCREDS | PTRACE_MODE_IBPB)
|
||||
|
||||
/**
|
||||
* ptrace_may_access - check whether the caller is permitted to access
|
||||
|
|
@ -90,20 +87,6 @@ extern void exit_ptrace(struct task_struct *tracer, struct list_head *dead);
|
|||
*/
|
||||
extern bool ptrace_may_access(struct task_struct *task, unsigned int mode);
|
||||
|
||||
/**
|
||||
* ptrace_may_access - check whether the caller is permitted to access
|
||||
* a target task.
|
||||
* @task: target task
|
||||
* @mode: selects type of access and caller credentials
|
||||
*
|
||||
* Returns true on success, false on denial.
|
||||
*
|
||||
* Similar to ptrace_may_access(). Only to be called from context switch
|
||||
* code. Does not call into audit and the regular LSM hooks due to locking
|
||||
* constraints.
|
||||
*/
|
||||
extern bool ptrace_may_access_sched(struct task_struct *task, unsigned int mode);
|
||||
|
||||
static inline int ptrace_reparented(struct task_struct *child)
|
||||
{
|
||||
return !same_thread_group(child->real_parent, child->parent);
|
||||
|
|
|
|||
|
|
@ -1116,6 +1116,7 @@ struct task_struct {
|
|||
#ifdef CONFIG_FUNCTION_GRAPH_TRACER
|
||||
/* Index of current stored address in ret_stack: */
|
||||
int curr_ret_stack;
|
||||
int curr_ret_depth;
|
||||
|
||||
/* Stack of return addresses for return function tracing: */
|
||||
struct ftrace_ret_stack *ret_stack;
|
||||
|
|
@ -1200,6 +1201,11 @@ struct task_struct {
|
|||
void *security;
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_GCC_PLUGIN_STACKLEAK
|
||||
unsigned long lowest_stack;
|
||||
unsigned long prev_lowest_stack;
|
||||
#endif
|
||||
|
||||
/*
|
||||
* New fields for task_struct should be added above here, so that
|
||||
* they are included in the randomized portion of task_struct.
|
||||
|
|
@ -1448,6 +1454,8 @@ static inline bool is_percpu_thread(void)
|
|||
#define PFA_SPREAD_SLAB 2 /* Spread some slab caches over cpuset */
|
||||
#define PFA_SPEC_SSB_DISABLE 3 /* Speculative Store Bypass disabled */
|
||||
#define PFA_SPEC_SSB_FORCE_DISABLE 4 /* Speculative Store Bypass force disabled*/
|
||||
#define PFA_SPEC_IB_DISABLE 5 /* Indirect branch speculation restricted */
|
||||
#define PFA_SPEC_IB_FORCE_DISABLE 6 /* Indirect branch speculation permanently restricted */
|
||||
|
||||
#define TASK_PFA_TEST(name, func) \
|
||||
static inline bool task_##func(struct task_struct *p) \
|
||||
|
|
@ -1479,6 +1487,13 @@ TASK_PFA_CLEAR(SPEC_SSB_DISABLE, spec_ssb_disable)
|
|||
TASK_PFA_TEST(SPEC_SSB_FORCE_DISABLE, spec_ssb_force_disable)
|
||||
TASK_PFA_SET(SPEC_SSB_FORCE_DISABLE, spec_ssb_force_disable)
|
||||
|
||||
TASK_PFA_TEST(SPEC_IB_DISABLE, spec_ib_disable)
|
||||
TASK_PFA_SET(SPEC_IB_DISABLE, spec_ib_disable)
|
||||
TASK_PFA_CLEAR(SPEC_IB_DISABLE, spec_ib_disable)
|
||||
|
||||
TASK_PFA_TEST(SPEC_IB_FORCE_DISABLE, spec_ib_force_disable)
|
||||
TASK_PFA_SET(SPEC_IB_FORCE_DISABLE, spec_ib_force_disable)
|
||||
|
||||
static inline void
|
||||
current_restore_flags(unsigned long orig_flags, unsigned long flags)
|
||||
{
|
||||
|
|
|
|||
20
include/linux/sched/smt.h
Normal file
20
include/linux/sched/smt.h
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#ifndef _LINUX_SCHED_SMT_H
|
||||
#define _LINUX_SCHED_SMT_H
|
||||
|
||||
#include <linux/static_key.h>
|
||||
|
||||
#ifdef CONFIG_SCHED_SMT
|
||||
extern struct static_key_false sched_smt_present;
|
||||
|
||||
static __always_inline bool sched_smt_active(void)
|
||||
{
|
||||
return static_branch_likely(&sched_smt_present);
|
||||
}
|
||||
#else
|
||||
static inline bool sched_smt_active(void) { return false; }
|
||||
#endif
|
||||
|
||||
void arch_smt_update(void);
|
||||
|
||||
#endif
|
||||
|
|
@ -224,7 +224,7 @@ struct sfp_eeprom_ext {
|
|||
*
|
||||
* See the SFF-8472 specification and related documents for the definition
|
||||
* of these structure members. This can be obtained from
|
||||
* ftp://ftp.seagate.com/sff
|
||||
* https://www.snia.org/technology-communities/sff/specifications
|
||||
*/
|
||||
struct sfp_eeprom_id {
|
||||
struct sfp_eeprom_base base;
|
||||
|
|
|
|||
|
|
@ -1326,6 +1326,22 @@ static inline void skb_zcopy_set(struct sk_buff *skb, struct ubuf_info *uarg)
|
|||
}
|
||||
}
|
||||
|
||||
static inline void skb_zcopy_set_nouarg(struct sk_buff *skb, void *val)
|
||||
{
|
||||
skb_shinfo(skb)->destructor_arg = (void *)((uintptr_t) val | 0x1UL);
|
||||
skb_shinfo(skb)->tx_flags |= SKBTX_ZEROCOPY_FRAG;
|
||||
}
|
||||
|
||||
static inline bool skb_zcopy_is_nouarg(struct sk_buff *skb)
|
||||
{
|
||||
return (uintptr_t) skb_shinfo(skb)->destructor_arg & 0x1UL;
|
||||
}
|
||||
|
||||
static inline void *skb_zcopy_get_nouarg(struct sk_buff *skb)
|
||||
{
|
||||
return (void *)((uintptr_t) skb_shinfo(skb)->destructor_arg & ~0x1UL);
|
||||
}
|
||||
|
||||
/* Release a reference on a zerocopy structure */
|
||||
static inline void skb_zcopy_clear(struct sk_buff *skb, bool zerocopy)
|
||||
{
|
||||
|
|
@ -1335,7 +1351,7 @@ static inline void skb_zcopy_clear(struct sk_buff *skb, bool zerocopy)
|
|||
if (uarg->callback == sock_zerocopy_callback) {
|
||||
uarg->zerocopy = uarg->zerocopy && zerocopy;
|
||||
sock_zerocopy_put(uarg);
|
||||
} else {
|
||||
} else if (!skb_zcopy_is_nouarg(skb)) {
|
||||
uarg->callback(uarg, zerocopy);
|
||||
}
|
||||
|
||||
|
|
|
|||
35
include/linux/stackleak.h
Normal file
35
include/linux/stackleak.h
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
#ifndef _LINUX_STACKLEAK_H
|
||||
#define _LINUX_STACKLEAK_H
|
||||
|
||||
#include <linux/sched.h>
|
||||
#include <linux/sched/task_stack.h>
|
||||
|
||||
/*
|
||||
* Check that the poison value points to the unused hole in the
|
||||
* virtual memory map for your platform.
|
||||
*/
|
||||
#define STACKLEAK_POISON -0xBEEF
|
||||
#define STACKLEAK_SEARCH_DEPTH 128
|
||||
|
||||
#ifdef CONFIG_GCC_PLUGIN_STACKLEAK
|
||||
#include <asm/stacktrace.h>
|
||||
|
||||
static inline void stackleak_task_init(struct task_struct *t)
|
||||
{
|
||||
t->lowest_stack = (unsigned long)end_of_stack(t) + sizeof(unsigned long);
|
||||
# ifdef CONFIG_STACKLEAK_METRICS
|
||||
t->prev_lowest_stack = t->lowest_stack;
|
||||
# endif
|
||||
}
|
||||
|
||||
#ifdef CONFIG_STACKLEAK_RUNTIME_DISABLE
|
||||
int stack_erasing_sysctl(struct ctl_table *table, int write,
|
||||
void __user *buffer, size_t *lenp, loff_t *ppos);
|
||||
#endif
|
||||
|
||||
#else /* !CONFIG_GCC_PLUGIN_STACKLEAK */
|
||||
static inline void stackleak_task_init(struct task_struct *t) { }
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
@ -107,8 +107,8 @@ struct krb5_ctx {
|
|||
u8 Ksess[GSS_KRB5_MAX_KEYLEN]; /* session key */
|
||||
u8 cksum[GSS_KRB5_MAX_KEYLEN];
|
||||
s32 endtime;
|
||||
u32 seq_send;
|
||||
u64 seq_send64;
|
||||
atomic_t seq_send;
|
||||
atomic64_t seq_send64;
|
||||
struct xdr_netobj mech_used;
|
||||
u8 initiator_sign[GSS_KRB5_MAX_KEYLEN];
|
||||
u8 acceptor_sign[GSS_KRB5_MAX_KEYLEN];
|
||||
|
|
@ -118,9 +118,6 @@ struct krb5_ctx {
|
|||
u8 acceptor_integ[GSS_KRB5_MAX_KEYLEN];
|
||||
};
|
||||
|
||||
extern u32 gss_seq_send_fetch_and_inc(struct krb5_ctx *ctx);
|
||||
extern u64 gss_seq_send64_fetch_and_inc(struct krb5_ctx *ctx);
|
||||
|
||||
/* The length of the Kerberos GSS token header */
|
||||
#define GSS_KRB5_TOK_HDR_LEN (16)
|
||||
|
||||
|
|
|
|||
|
|
@ -72,7 +72,6 @@ xdr_buf_init(struct xdr_buf *buf, void *start, size_t len)
|
|||
buf->head[0].iov_base = start;
|
||||
buf->head[0].iov_len = len;
|
||||
buf->tail[0].iov_len = 0;
|
||||
buf->bvec = NULL;
|
||||
buf->pages = NULL;
|
||||
buf->page_len = 0;
|
||||
buf->flags = 0;
|
||||
|
|
|
|||
|
|
@ -196,6 +196,7 @@ struct tcp_sock {
|
|||
u32 rcv_tstamp; /* timestamp of last received ACK (for keepalives) */
|
||||
u32 lsndtime; /* timestamp of last sent data packet (for restart window) */
|
||||
u32 last_oow_ack_time; /* timestamp of last out-of-window ACK */
|
||||
u32 compressed_ack_rcv_nxt;
|
||||
|
||||
u32 tsoffset; /* timestamp offset */
|
||||
|
||||
|
|
|
|||
|
|
@ -83,8 +83,8 @@ static inline int ptrace_report_syscall(struct pt_regs *regs)
|
|||
* tracehook_report_syscall_entry - task is about to attempt a system call
|
||||
* @regs: user register state of current task
|
||||
*
|
||||
* This will be called if %TIF_SYSCALL_TRACE has been set, when the
|
||||
* current task has just entered the kernel for a system call.
|
||||
* This will be called if %TIF_SYSCALL_TRACE or %TIF_SYSCALL_EMU have been set,
|
||||
* when the current task has just entered the kernel for a system call.
|
||||
* Full user register state is available here. Changing the values
|
||||
* in @regs can affect the system call number and arguments to be tried.
|
||||
* It is safe to block here, preventing the system call from beginning.
|
||||
|
|
|
|||
|
|
@ -166,7 +166,7 @@ static inline struct tracepoint *tracepoint_ptr_deref(tracepoint_ptr_t *p)
|
|||
struct tracepoint_func *it_func_ptr; \
|
||||
void *it_func; \
|
||||
void *__data; \
|
||||
int __maybe_unused idx = 0; \
|
||||
int __maybe_unused __idx = 0; \
|
||||
\
|
||||
if (!(cond)) \
|
||||
return; \
|
||||
|
|
@ -182,7 +182,7 @@ static inline struct tracepoint *tracepoint_ptr_deref(tracepoint_ptr_t *p)
|
|||
* doesn't work from the idle path. \
|
||||
*/ \
|
||||
if (rcuidle) { \
|
||||
idx = srcu_read_lock_notrace(&tracepoint_srcu); \
|
||||
__idx = srcu_read_lock_notrace(&tracepoint_srcu);\
|
||||
rcu_irq_enter_irqson(); \
|
||||
} \
|
||||
\
|
||||
|
|
@ -198,7 +198,7 @@ static inline struct tracepoint *tracepoint_ptr_deref(tracepoint_ptr_t *p)
|
|||
\
|
||||
if (rcuidle) { \
|
||||
rcu_irq_exit_irqson(); \
|
||||
srcu_read_unlock_notrace(&tracepoint_srcu, idx);\
|
||||
srcu_read_unlock_notrace(&tracepoint_srcu, __idx);\
|
||||
} \
|
||||
\
|
||||
preempt_enable_notrace(); \
|
||||
|
|
|
|||
|
|
@ -556,6 +556,7 @@ extern struct tty_struct *tty_init_dev(struct tty_driver *driver, int idx);
|
|||
extern void tty_release_struct(struct tty_struct *tty, int idx);
|
||||
extern int tty_release(struct inode *inode, struct file *filp);
|
||||
extern void tty_init_termios(struct tty_struct *tty);
|
||||
extern void tty_save_termios(struct tty_struct *tty);
|
||||
extern int tty_standard_install(struct tty_driver *driver,
|
||||
struct tty_struct *tty);
|
||||
|
||||
|
|
|
|||
|
|
@ -21,15 +21,16 @@ struct kvec {
|
|||
size_t iov_len;
|
||||
};
|
||||
|
||||
enum {
|
||||
enum iter_type {
|
||||
ITER_IOVEC = 0,
|
||||
ITER_KVEC = 2,
|
||||
ITER_BVEC = 4,
|
||||
ITER_PIPE = 8,
|
||||
ITER_DISCARD = 16,
|
||||
};
|
||||
|
||||
struct iov_iter {
|
||||
int type;
|
||||
unsigned int type;
|
||||
size_t iov_offset;
|
||||
size_t count;
|
||||
union {
|
||||
|
|
@ -47,6 +48,41 @@ struct iov_iter {
|
|||
};
|
||||
};
|
||||
|
||||
static inline enum iter_type iov_iter_type(const struct iov_iter *i)
|
||||
{
|
||||
return i->type & ~(READ | WRITE);
|
||||
}
|
||||
|
||||
static inline bool iter_is_iovec(const struct iov_iter *i)
|
||||
{
|
||||
return iov_iter_type(i) == ITER_IOVEC;
|
||||
}
|
||||
|
||||
static inline bool iov_iter_is_kvec(const struct iov_iter *i)
|
||||
{
|
||||
return iov_iter_type(i) == ITER_KVEC;
|
||||
}
|
||||
|
||||
static inline bool iov_iter_is_bvec(const struct iov_iter *i)
|
||||
{
|
||||
return iov_iter_type(i) == ITER_BVEC;
|
||||
}
|
||||
|
||||
static inline bool iov_iter_is_pipe(const struct iov_iter *i)
|
||||
{
|
||||
return iov_iter_type(i) == ITER_PIPE;
|
||||
}
|
||||
|
||||
static inline bool iov_iter_is_discard(const struct iov_iter *i)
|
||||
{
|
||||
return iov_iter_type(i) == ITER_DISCARD;
|
||||
}
|
||||
|
||||
static inline unsigned char iov_iter_rw(const struct iov_iter *i)
|
||||
{
|
||||
return i->type & (READ | WRITE);
|
||||
}
|
||||
|
||||
/*
|
||||
* Total number of bytes covered by an iovec.
|
||||
*
|
||||
|
|
@ -74,7 +110,8 @@ static inline struct iovec iov_iter_iovec(const struct iov_iter *iter)
|
|||
}
|
||||
|
||||
#define iov_for_each(iov, iter, start) \
|
||||
if (!((start).type & (ITER_BVEC | ITER_PIPE))) \
|
||||
if (iov_iter_type(start) == ITER_IOVEC || \
|
||||
iov_iter_type(start) == ITER_KVEC) \
|
||||
for (iter = (start); \
|
||||
(iter).count && \
|
||||
((iov = iov_iter_iovec(&(iter))), 1); \
|
||||
|
|
@ -181,14 +218,15 @@ size_t copy_to_iter_mcsafe(void *addr, size_t bytes, struct iov_iter *i)
|
|||
size_t iov_iter_zero(size_t bytes, struct iov_iter *);
|
||||
unsigned long iov_iter_alignment(const struct iov_iter *i);
|
||||
unsigned long iov_iter_gap_alignment(const struct iov_iter *i);
|
||||
void iov_iter_init(struct iov_iter *i, int direction, const struct iovec *iov,
|
||||
void iov_iter_init(struct iov_iter *i, unsigned int direction, const struct iovec *iov,
|
||||
unsigned long nr_segs, size_t count);
|
||||
void iov_iter_kvec(struct iov_iter *i, int direction, const struct kvec *kvec,
|
||||
void iov_iter_kvec(struct iov_iter *i, unsigned int direction, const struct kvec *kvec,
|
||||
unsigned long nr_segs, size_t count);
|
||||
void iov_iter_bvec(struct iov_iter *i, int direction, const struct bio_vec *bvec,
|
||||
void iov_iter_bvec(struct iov_iter *i, unsigned int direction, const struct bio_vec *bvec,
|
||||
unsigned long nr_segs, size_t count);
|
||||
void iov_iter_pipe(struct iov_iter *i, int direction, struct pipe_inode_info *pipe,
|
||||
void iov_iter_pipe(struct iov_iter *i, unsigned int direction, struct pipe_inode_info *pipe,
|
||||
size_t count);
|
||||
void iov_iter_discard(struct iov_iter *i, unsigned int direction, size_t count);
|
||||
ssize_t iov_iter_get_pages(struct iov_iter *i, struct page **pages,
|
||||
size_t maxsize, unsigned maxpages, size_t *start);
|
||||
ssize_t iov_iter_get_pages_alloc(struct iov_iter *i, struct page ***pages,
|
||||
|
|
@ -202,19 +240,6 @@ static inline size_t iov_iter_count(const struct iov_iter *i)
|
|||
return i->count;
|
||||
}
|
||||
|
||||
static inline bool iter_is_iovec(const struct iov_iter *i)
|
||||
{
|
||||
return !(i->type & (ITER_BVEC | ITER_KVEC | ITER_PIPE));
|
||||
}
|
||||
|
||||
/*
|
||||
* Get one of READ or WRITE out of iter->type without any other flags OR'd in
|
||||
* with it.
|
||||
*
|
||||
* The ?: is just for type safety.
|
||||
*/
|
||||
#define iov_iter_rw(i) ((0 ? (struct iov_iter *)0 : (i))->type & (READ | WRITE))
|
||||
|
||||
/*
|
||||
* Cap the iov_iter by given limit; note that the second argument is
|
||||
* *not* the new size - it's upper limit for such. Passing it a value
|
||||
|
|
|
|||
|
|
@ -407,11 +407,11 @@ struct usb_host_bos {
|
|||
};
|
||||
|
||||
int __usb_get_extra_descriptor(char *buffer, unsigned size,
|
||||
unsigned char type, void **ptr);
|
||||
unsigned char type, void **ptr, size_t min);
|
||||
#define usb_get_extra_descriptor(ifpoint, type, ptr) \
|
||||
__usb_get_extra_descriptor((ifpoint)->extra, \
|
||||
(ifpoint)->extralen, \
|
||||
type, (void **)ptr)
|
||||
type, (void **)ptr, sizeof(**(ptr)))
|
||||
|
||||
/* ----------------------------------------------------------------------- */
|
||||
|
||||
|
|
|
|||
|
|
@ -66,4 +66,7 @@
|
|||
/* Device needs a pause after every control message. */
|
||||
#define USB_QUIRK_DELAY_CTRL_MSG BIT(13)
|
||||
|
||||
/* Hub needs extra delay after resetting its port. */
|
||||
#define USB_QUIRK_HUB_SLOW_RESET BIT(14)
|
||||
|
||||
#endif /* __LINUX_USB_QUIRKS_H */
|
||||
|
|
|
|||
|
|
@ -246,8 +246,7 @@ static inline void wbc_attach_fdatawrite_inode(struct writeback_control *wbc,
|
|||
*
|
||||
* @bio is a part of the writeback in progress controlled by @wbc. Perform
|
||||
* writeback specific initialization. This is used to apply the cgroup
|
||||
* writeback context. Must be called after the bio has been associated with
|
||||
* a device.
|
||||
* writeback context.
|
||||
*/
|
||||
static inline void wbc_init_bio(struct writeback_control *wbc, struct bio *bio)
|
||||
{
|
||||
|
|
@ -258,7 +257,7 @@ static inline void wbc_init_bio(struct writeback_control *wbc, struct bio *bio)
|
|||
* regular writeback instead of writing things out itself.
|
||||
*/
|
||||
if (wbc->wb)
|
||||
bio_associate_blkg_from_css(bio, wbc->wb->blkcg_css);
|
||||
bio_associate_blkcg(bio, wbc->wb->blkcg_css);
|
||||
}
|
||||
|
||||
#else /* CONFIG_CGROUP_WRITEBACK */
|
||||
|
|
|
|||
|
|
@ -289,9 +289,7 @@ struct xarray {
|
|||
void xa_init_flags(struct xarray *, gfp_t flags);
|
||||
void *xa_load(struct xarray *, unsigned long index);
|
||||
void *xa_store(struct xarray *, unsigned long index, void *entry, gfp_t);
|
||||
void *xa_cmpxchg(struct xarray *, unsigned long index,
|
||||
void *old, void *entry, gfp_t);
|
||||
int xa_reserve(struct xarray *, unsigned long index, gfp_t);
|
||||
void *xa_erase(struct xarray *, unsigned long index);
|
||||
void *xa_store_range(struct xarray *, unsigned long first, unsigned long last,
|
||||
void *entry, gfp_t);
|
||||
bool xa_get_mark(struct xarray *, unsigned long index, xa_mark_t);
|
||||
|
|
@ -343,65 +341,6 @@ static inline bool xa_marked(const struct xarray *xa, xa_mark_t mark)
|
|||
return xa->xa_flags & XA_FLAGS_MARK(mark);
|
||||
}
|
||||
|
||||
/**
|
||||
* xa_erase() - Erase this entry from the XArray.
|
||||
* @xa: XArray.
|
||||
* @index: Index of entry.
|
||||
*
|
||||
* This function is the equivalent of calling xa_store() with %NULL as
|
||||
* the third argument. The XArray does not need to allocate memory, so
|
||||
* the user does not need to provide GFP flags.
|
||||
*
|
||||
* Context: Process context. Takes and releases the xa_lock.
|
||||
* Return: The entry which used to be at this index.
|
||||
*/
|
||||
static inline void *xa_erase(struct xarray *xa, unsigned long index)
|
||||
{
|
||||
return xa_store(xa, index, NULL, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* xa_insert() - Store this entry in the XArray unless another entry is
|
||||
* already present.
|
||||
* @xa: XArray.
|
||||
* @index: Index into array.
|
||||
* @entry: New entry.
|
||||
* @gfp: Memory allocation flags.
|
||||
*
|
||||
* If you would rather see the existing entry in the array, use xa_cmpxchg().
|
||||
* This function is for users who don't care what the entry is, only that
|
||||
* one is present.
|
||||
*
|
||||
* Context: Process context. Takes and releases the xa_lock.
|
||||
* May sleep if the @gfp flags permit.
|
||||
* Return: 0 if the store succeeded. -EEXIST if another entry was present.
|
||||
* -ENOMEM if memory could not be allocated.
|
||||
*/
|
||||
static inline int xa_insert(struct xarray *xa, unsigned long index,
|
||||
void *entry, gfp_t gfp)
|
||||
{
|
||||
void *curr = xa_cmpxchg(xa, index, NULL, entry, gfp);
|
||||
if (!curr)
|
||||
return 0;
|
||||
if (xa_is_err(curr))
|
||||
return xa_err(curr);
|
||||
return -EEXIST;
|
||||
}
|
||||
|
||||
/**
|
||||
* xa_release() - Release a reserved entry.
|
||||
* @xa: XArray.
|
||||
* @index: Index of entry.
|
||||
*
|
||||
* After calling xa_reserve(), you can call this function to release the
|
||||
* reservation. If the entry at @index has been stored to, this function
|
||||
* will do nothing.
|
||||
*/
|
||||
static inline void xa_release(struct xarray *xa, unsigned long index)
|
||||
{
|
||||
xa_cmpxchg(xa, index, NULL, NULL, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* xa_for_each() - Iterate over a portion of an XArray.
|
||||
* @xa: XArray.
|
||||
|
|
@ -455,6 +394,7 @@ void *__xa_store(struct xarray *, unsigned long index, void *entry, gfp_t);
|
|||
void *__xa_cmpxchg(struct xarray *, unsigned long index, void *old,
|
||||
void *entry, gfp_t);
|
||||
int __xa_alloc(struct xarray *, u32 *id, u32 max, void *entry, gfp_t);
|
||||
int __xa_reserve(struct xarray *, unsigned long index, gfp_t);
|
||||
void __xa_set_mark(struct xarray *, unsigned long index, xa_mark_t);
|
||||
void __xa_clear_mark(struct xarray *, unsigned long index, xa_mark_t);
|
||||
|
||||
|
|
@ -486,6 +426,58 @@ static inline int __xa_insert(struct xarray *xa, unsigned long index,
|
|||
return -EEXIST;
|
||||
}
|
||||
|
||||
/**
|
||||
* xa_store_bh() - Store this entry in the XArray.
|
||||
* @xa: XArray.
|
||||
* @index: Index into array.
|
||||
* @entry: New entry.
|
||||
* @gfp: Memory allocation flags.
|
||||
*
|
||||
* This function is like calling xa_store() except it disables softirqs
|
||||
* while holding the array lock.
|
||||
*
|
||||
* Context: Any context. Takes and releases the xa_lock while
|
||||
* disabling softirqs.
|
||||
* Return: The entry which used to be at this index.
|
||||
*/
|
||||
static inline void *xa_store_bh(struct xarray *xa, unsigned long index,
|
||||
void *entry, gfp_t gfp)
|
||||
{
|
||||
void *curr;
|
||||
|
||||
xa_lock_bh(xa);
|
||||
curr = __xa_store(xa, index, entry, gfp);
|
||||
xa_unlock_bh(xa);
|
||||
|
||||
return curr;
|
||||
}
|
||||
|
||||
/**
|
||||
* xa_store_irq() - Erase this entry from the XArray.
|
||||
* @xa: XArray.
|
||||
* @index: Index into array.
|
||||
* @entry: New entry.
|
||||
* @gfp: Memory allocation flags.
|
||||
*
|
||||
* This function is like calling xa_store() except it disables interrupts
|
||||
* while holding the array lock.
|
||||
*
|
||||
* Context: Process context. Takes and releases the xa_lock while
|
||||
* disabling interrupts.
|
||||
* Return: The entry which used to be at this index.
|
||||
*/
|
||||
static inline void *xa_store_irq(struct xarray *xa, unsigned long index,
|
||||
void *entry, gfp_t gfp)
|
||||
{
|
||||
void *curr;
|
||||
|
||||
xa_lock_irq(xa);
|
||||
curr = __xa_store(xa, index, entry, gfp);
|
||||
xa_unlock_irq(xa);
|
||||
|
||||
return curr;
|
||||
}
|
||||
|
||||
/**
|
||||
* xa_erase_bh() - Erase this entry from the XArray.
|
||||
* @xa: XArray.
|
||||
|
|
@ -495,7 +487,7 @@ static inline int __xa_insert(struct xarray *xa, unsigned long index,
|
|||
* the third argument. The XArray does not need to allocate memory, so
|
||||
* the user does not need to provide GFP flags.
|
||||
*
|
||||
* Context: Process context. Takes and releases the xa_lock while
|
||||
* Context: Any context. Takes and releases the xa_lock while
|
||||
* disabling softirqs.
|
||||
* Return: The entry which used to be at this index.
|
||||
*/
|
||||
|
|
@ -534,6 +526,61 @@ static inline void *xa_erase_irq(struct xarray *xa, unsigned long index)
|
|||
return entry;
|
||||
}
|
||||
|
||||
/**
|
||||
* xa_cmpxchg() - Conditionally replace an entry in the XArray.
|
||||
* @xa: XArray.
|
||||
* @index: Index into array.
|
||||
* @old: Old value to test against.
|
||||
* @entry: New value to place in array.
|
||||
* @gfp: Memory allocation flags.
|
||||
*
|
||||
* If the entry at @index is the same as @old, replace it with @entry.
|
||||
* If the return value is equal to @old, then the exchange was successful.
|
||||
*
|
||||
* Context: Any context. Takes and releases the xa_lock. May sleep
|
||||
* if the @gfp flags permit.
|
||||
* Return: The old value at this index or xa_err() if an error happened.
|
||||
*/
|
||||
static inline void *xa_cmpxchg(struct xarray *xa, unsigned long index,
|
||||
void *old, void *entry, gfp_t gfp)
|
||||
{
|
||||
void *curr;
|
||||
|
||||
xa_lock(xa);
|
||||
curr = __xa_cmpxchg(xa, index, old, entry, gfp);
|
||||
xa_unlock(xa);
|
||||
|
||||
return curr;
|
||||
}
|
||||
|
||||
/**
|
||||
* xa_insert() - Store this entry in the XArray unless another entry is
|
||||
* already present.
|
||||
* @xa: XArray.
|
||||
* @index: Index into array.
|
||||
* @entry: New entry.
|
||||
* @gfp: Memory allocation flags.
|
||||
*
|
||||
* If you would rather see the existing entry in the array, use xa_cmpxchg().
|
||||
* This function is for users who don't care what the entry is, only that
|
||||
* one is present.
|
||||
*
|
||||
* Context: Process context. Takes and releases the xa_lock.
|
||||
* May sleep if the @gfp flags permit.
|
||||
* Return: 0 if the store succeeded. -EEXIST if another entry was present.
|
||||
* -ENOMEM if memory could not be allocated.
|
||||
*/
|
||||
static inline int xa_insert(struct xarray *xa, unsigned long index,
|
||||
void *entry, gfp_t gfp)
|
||||
{
|
||||
void *curr = xa_cmpxchg(xa, index, NULL, entry, gfp);
|
||||
if (!curr)
|
||||
return 0;
|
||||
if (xa_is_err(curr))
|
||||
return xa_err(curr);
|
||||
return -EEXIST;
|
||||
}
|
||||
|
||||
/**
|
||||
* xa_alloc() - Find somewhere to store this entry in the XArray.
|
||||
* @xa: XArray.
|
||||
|
|
@ -575,7 +622,7 @@ static inline int xa_alloc(struct xarray *xa, u32 *id, u32 max, void *entry,
|
|||
* Updates the @id pointer with the index, then stores the entry at that
|
||||
* index. A concurrent lookup will not see an uninitialised @id.
|
||||
*
|
||||
* Context: Process context. Takes and releases the xa_lock while
|
||||
* Context: Any context. Takes and releases the xa_lock while
|
||||
* disabling softirqs. May sleep if the @gfp flags permit.
|
||||
* Return: 0 on success, -ENOMEM if memory allocation fails or -ENOSPC if
|
||||
* there is no more space in the XArray.
|
||||
|
|
@ -621,6 +668,98 @@ static inline int xa_alloc_irq(struct xarray *xa, u32 *id, u32 max, void *entry,
|
|||
return err;
|
||||
}
|
||||
|
||||
/**
|
||||
* xa_reserve() - Reserve this index in the XArray.
|
||||
* @xa: XArray.
|
||||
* @index: Index into array.
|
||||
* @gfp: Memory allocation flags.
|
||||
*
|
||||
* Ensures there is somewhere to store an entry at @index in the array.
|
||||
* If there is already something stored at @index, this function does
|
||||
* nothing. If there was nothing there, the entry is marked as reserved.
|
||||
* Loading from a reserved entry returns a %NULL pointer.
|
||||
*
|
||||
* If you do not use the entry that you have reserved, call xa_release()
|
||||
* or xa_erase() to free any unnecessary memory.
|
||||
*
|
||||
* Context: Any context. Takes and releases the xa_lock.
|
||||
* May sleep if the @gfp flags permit.
|
||||
* Return: 0 if the reservation succeeded or -ENOMEM if it failed.
|
||||
*/
|
||||
static inline
|
||||
int xa_reserve(struct xarray *xa, unsigned long index, gfp_t gfp)
|
||||
{
|
||||
int ret;
|
||||
|
||||
xa_lock(xa);
|
||||
ret = __xa_reserve(xa, index, gfp);
|
||||
xa_unlock(xa);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* xa_reserve_bh() - Reserve this index in the XArray.
|
||||
* @xa: XArray.
|
||||
* @index: Index into array.
|
||||
* @gfp: Memory allocation flags.
|
||||
*
|
||||
* A softirq-disabling version of xa_reserve().
|
||||
*
|
||||
* Context: Any context. Takes and releases the xa_lock while
|
||||
* disabling softirqs.
|
||||
* Return: 0 if the reservation succeeded or -ENOMEM if it failed.
|
||||
*/
|
||||
static inline
|
||||
int xa_reserve_bh(struct xarray *xa, unsigned long index, gfp_t gfp)
|
||||
{
|
||||
int ret;
|
||||
|
||||
xa_lock_bh(xa);
|
||||
ret = __xa_reserve(xa, index, gfp);
|
||||
xa_unlock_bh(xa);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* xa_reserve_irq() - Reserve this index in the XArray.
|
||||
* @xa: XArray.
|
||||
* @index: Index into array.
|
||||
* @gfp: Memory allocation flags.
|
||||
*
|
||||
* An interrupt-disabling version of xa_reserve().
|
||||
*
|
||||
* Context: Process context. Takes and releases the xa_lock while
|
||||
* disabling interrupts.
|
||||
* Return: 0 if the reservation succeeded or -ENOMEM if it failed.
|
||||
*/
|
||||
static inline
|
||||
int xa_reserve_irq(struct xarray *xa, unsigned long index, gfp_t gfp)
|
||||
{
|
||||
int ret;
|
||||
|
||||
xa_lock_irq(xa);
|
||||
ret = __xa_reserve(xa, index, gfp);
|
||||
xa_unlock_irq(xa);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* xa_release() - Release a reserved entry.
|
||||
* @xa: XArray.
|
||||
* @index: Index of entry.
|
||||
*
|
||||
* After calling xa_reserve(), you can call this function to release the
|
||||
* reservation. If the entry at @index has been stored to, this function
|
||||
* will do nothing.
|
||||
*/
|
||||
static inline void xa_release(struct xarray *xa, unsigned long index)
|
||||
{
|
||||
xa_cmpxchg(xa, index, NULL, NULL, 0);
|
||||
}
|
||||
|
||||
/* Everything below here is the Advanced API. Proceed with caution. */
|
||||
|
||||
/*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue