Skip to content

Commit

Permalink
tf300t: initial kernel bringup for Android 5.0. Based on changes from…
Browse files Browse the repository at this point in the history
… Grouper Kernel

Change-Id: Ic82ea9595db42be073576a2fff717dbaf1449611
  • Loading branch information
Hardslog authored and clamor-s committed Aug 5, 2017
1 parent db07c98 commit b20e6f8
Show file tree
Hide file tree
Showing 51 changed files with 932 additions and 89 deletions.
14 changes: 14 additions & 0 deletions Documentation/networking/ip-sysctl.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,13 @@ ip_no_pmtu_disc - BOOLEAN
min_pmtu - INTEGER
default 562 - minimum discovered Path MTU

fwmark_reflect - BOOLEAN
Controls the fwmark of kernel-generated IPv4 reply packets that are not
associated with a socket for example, TCP RSTs or ICMP echo replies).
If unset, these packets have a fwmark of zero. If set, they have the
fwmark of the packet they are replying to.
Default: 0

route/max_size - INTEGER
Maximum number of routes allowed in the kernel. Increase
this when using large numbers of interfaces and/or routes.
Expand Down Expand Up @@ -1036,6 +1043,13 @@ conf/all/forwarding - BOOLEAN
proxy_ndp - BOOLEAN
Do proxy ndp.

fwmark_reflect - BOOLEAN
Controls the fwmark of kernel-generated IPv6 reply packets that are not
associated with a socket for example, TCP RSTs or ICMPv6 echo replies).
If unset, these packets have a fwmark of zero. If set, they have the
fwmark of the packet they are replying to.
Default: 0

conf/interface/*:
Change special settings per interface.

Expand Down
1 change: 0 additions & 1 deletion arch/arm/configs/tegra3_android_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -487,7 +487,6 @@ CONFIG_RTC_DRV_RC5T583=y
CONFIG_STAGING=y
CONFIG_ANDROID=y
CONFIG_ANDROID_BINDER_IPC=y
CONFIG_ANDROID_LOGGER=y
CONFIG_ANDROID_RAM_CONSOLE=y
CONFIG_ANDROID_RAM_CONSOLE_ERROR_CORRECTION=y
CONFIG_ANDROID_TIMED_GPIO=y
Expand Down
3 changes: 2 additions & 1 deletion arch/arm/mach-tegra/pm-irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include <linux/moduleparam.h>
#include <linux/seq_file.h>
#include <linux/syscore_ops.h>
#include <linux/wakeup_reason.h>

#include <mach/iomap.h>

Expand Down Expand Up @@ -218,7 +219,7 @@ static void tegra_pm_irq_syscore_resume_helper(
(wake + 32 * index));
continue;
}

log_wakeup_reason(irq);
desc = irq_to_desc(irq);
if (!desc || !desc->action || !desc->action->name) {
pr_info("Resume caused by WAKE%d, irq %d\n",
Expand Down
2 changes: 2 additions & 0 deletions arch/um/os-Linux/start_up.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
#include <sys/ptrace.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include <sys/time.h>
#include <sys/resource.h>
#include <asm/unistd.h>
#include "init.h"
#include "kern_constants.h"
Expand Down
3 changes: 3 additions & 0 deletions drivers/net/wireless/bcmdhd/wl_cfg80211.c
Original file line number Diff line number Diff line change
Expand Up @@ -4753,6 +4753,9 @@ static s32 wl_setup_wiphy(struct wireless_dev *wdev, struct device *sdiofunc_dev
#endif
/* AP_SME flag can be advertised to remove patch from wpa_supplicant */
wdev->wiphy->flags |= WIPHY_FLAG_HAVE_AP_SME;
#if defined(CONFIG_PM)
wdev->wiphy->wowlan.flags = WIPHY_WOWLAN_ANY;
#endif
WL_DBG(("Registering custom regulatory)\n"));
wdev->wiphy->flags |= WIPHY_FLAG_CUSTOM_REGULATORY;
wiphy_apply_custom_regulatory(wdev->wiphy, &brcm_regdom);
Expand Down
2 changes: 2 additions & 0 deletions include/linux/fib_rules.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ enum {
FRA_TABLE, /* Extended table id */
FRA_FWMASK, /* mask for netfilter mark */
FRA_OIFNAME,
FRA_UID_START, /* UID range */
FRA_UID_END,
__FRA_MAX
};

Expand Down
2 changes: 2 additions & 0 deletions include/linux/ipv6.h
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ struct ipv6_devconf {
__s32 accept_ra_rt_info_max_plen;
#endif
#endif
__s32 accept_ra_rt_table;
__s32 proxy_ndp;
__s32 accept_source_route;
#ifdef CONFIG_IPV6_OPTIMISTIC_DAD
Expand Down Expand Up @@ -213,6 +214,7 @@ enum {
DEVCONF_DISABLE_IPV6,
DEVCONF_ACCEPT_DAD,
DEVCONF_FORCE_TLLAO,
DEVCONF_ACCEPT_RA_RT_TABLE,
DEVCONF_MAX
};

Expand Down
6 changes: 6 additions & 0 deletions include/linux/prctl.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,4 +102,10 @@

#define PR_MCE_KILL_GET 34

/* Sets the timerslack for arbitrary threads
* arg2 slack value, 0 means "use default"
* arg3 pid of the thread whose timer slack needs to be set
*/
#define PR_SET_TIMERSLACK_PID 41

#endif /* _LINUX_PRCTL_H */
2 changes: 2 additions & 0 deletions include/linux/rtnetlink.h
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,8 @@ enum rtattr_type_t {
RTA_MP_ALGO, /* no longer used */
RTA_TABLE,
RTA_MARK,
RTA_MFC_STATS, /* not used - backported from the future */
RTA_UID,
__RTA_MAX
};

Expand Down
23 changes: 23 additions & 0 deletions include/linux/wakeup_reason.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* include/linux/wakeup_reason.h
*
* Logs the reason which caused the kernel to resume
* from the suspend mode.
*
* Copyright (C) 2014 Google, Inc.
* This software is licensed under the terms of the GNU General Public
* License version 2, as published by the Free Software Foundation, and
* may be copied, distributed, and modified under those terms.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*/

#ifndef _LINUX_WAKEUP_REASON_H
#define _LINUX_WAKEUP_REASON_H

void log_wakeup_reason(int irq);

#endif /* _LINUX_WAKEUP_REASON_H */
2 changes: 2 additions & 0 deletions include/net/addrconf.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,8 @@ extern int __ipv6_dev_ac_dec(struct inet6_dev *idev, const struct in6_addr *addr
extern int ipv6_chk_acast_addr(struct net *net, struct net_device *dev,
const struct in6_addr *addr);

u32 addrconf_rt_table(const struct net_device *dev, u32 default_table);


/* Device notifier */
extern int register_inet6addr_notifier(struct notifier_block *nb);
Expand Down
6 changes: 5 additions & 1 deletion include/net/fib_rules.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ struct fib_rule {
struct fib_rule __rcu *ctarget;
char iifname[IFNAMSIZ];
char oifname[IFNAMSIZ];
uid_t uid_start;
uid_t uid_end;
struct rcu_head rcu;
struct net * fr_net;
};
Expand Down Expand Up @@ -79,7 +81,9 @@ struct fib_rules_ops {
[FRA_FWMARK] = { .type = NLA_U32 }, \
[FRA_FWMASK] = { .type = NLA_U32 }, \
[FRA_TABLE] = { .type = NLA_U32 }, \
[FRA_GOTO] = { .type = NLA_U32 }
[FRA_GOTO] = { .type = NLA_U32 }, \
[FRA_UID_START] = { .type = NLA_U32 }, \
[FRA_UID_END] = { .type = NLA_U32 }

static inline void fib_rule_get(struct fib_rule *rule)
{
Expand Down
8 changes: 7 additions & 1 deletion include/net/flow.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ struct flowi_common {
#define FLOWI_FLAG_PRECOW_METRICS 0x02
#define FLOWI_FLAG_CAN_SLEEP 0x04
__u32 flowic_secid;
uid_t flowic_uid;
};

union flowi_uli {
Expand Down Expand Up @@ -59,6 +60,7 @@ struct flowi4 {
#define flowi4_proto __fl_common.flowic_proto
#define flowi4_flags __fl_common.flowic_flags
#define flowi4_secid __fl_common.flowic_secid
#define flowi4_uid __fl_common.flowic_uid
__be32 daddr;
__be32 saddr;
union flowi_uli uli;
Expand All @@ -75,7 +77,8 @@ static inline void flowi4_init_output(struct flowi4 *fl4, int oif,
__u32 mark, __u8 tos, __u8 scope,
__u8 proto, __u8 flags,
__be32 daddr, __be32 saddr,
__be16 dport, __be32 sport)
__be16 dport, __be32 sport,
uid_t uid)
{
fl4->flowi4_oif = oif;
fl4->flowi4_iif = 0;
Expand All @@ -85,6 +88,7 @@ static inline void flowi4_init_output(struct flowi4 *fl4, int oif,
fl4->flowi4_proto = proto;
fl4->flowi4_flags = flags;
fl4->flowi4_secid = 0;
fl4->flowi4_uid = uid;
fl4->daddr = daddr;
fl4->saddr = saddr;
fl4->fl4_dport = dport;
Expand All @@ -102,6 +106,7 @@ struct flowi6 {
#define flowi6_proto __fl_common.flowic_proto
#define flowi6_flags __fl_common.flowic_flags
#define flowi6_secid __fl_common.flowic_secid
#define flowi6_uid __fl_common.flowic_uid
struct in6_addr daddr;
struct in6_addr saddr;
__be32 flowlabel;
Expand Down Expand Up @@ -145,6 +150,7 @@ struct flowi {
#define flowi_proto u.__fl_common.flowic_proto
#define flowi_flags u.__fl_common.flowic_flags
#define flowi_secid u.__fl_common.flowic_secid
#define flowi_uid u.__fl_common.flowic_uid
} __attribute__((__aligned__(BITS_PER_LONG/8)));

static inline struct flowi *flowi4_to_flowi(struct flowi4 *fl4)
Expand Down
10 changes: 10 additions & 0 deletions include/net/inet_sock.h
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,23 @@ struct inet_request_sock {
no_srccheck: 1;
kmemcheck_bitfield_end(flags);
struct ip_options_rcu *opt;
u32 ir_mark;
};

static inline struct inet_request_sock *inet_rsk(const struct request_sock *sk)
{
return (struct inet_request_sock *)sk;
}

static inline u32 inet_request_mark(struct sock *sk, struct sk_buff *skb)
{
if (!sk->sk_mark && sock_net(sk)->ipv4.sysctl_tcp_fwmark_accept) {
return skb->mark;
} else {
return sk->sk_mark;
}
}

struct inet_cork {
unsigned int flags;
__be32 addr;
Expand Down
4 changes: 4 additions & 0 deletions include/net/ip.h
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ struct ip_reply_arg {
int csumoffset; /* u16 offset of csum in iov[0].iov_base */
/* -1 if not needed */
int bound_dev_if;
uid_t uid;
};

#define IP_REPLY_ARG_NOSRCCHECK 1
Expand Down Expand Up @@ -236,6 +237,9 @@ extern void ipfrag_init(void);

extern void ip_static_sysctl_init(void);

#define IP4_REPLY_MARK(net, mark) \
((net)->ipv4.sysctl_fwmark_reflect ? (mark) : 0)

static inline bool ip_is_fragment(const struct iphdr *iph)
{
return (iph->frag_off & htons(IP_MF | IP_OFFSET)) != 0;
Expand Down
3 changes: 3 additions & 0 deletions include/net/ipv6.h
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@ struct frag_hdr {

#define IP6_MF 0x0001

#define IP6_REPLY_MARK(net, mark) \
((net)->ipv6.sysctl.fwmark_reflect ? (mark) : 0)

#include <net/sock.h>

/* sysctls */
Expand Down
2 changes: 2 additions & 0 deletions include/net/netns/ipv4.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ struct netns_ipv4 {
int current_rt_cache_rebuild_count;

unsigned int sysctl_ping_group_range[2];
int sysctl_fwmark_reflect;
int sysctl_tcp_fwmark_accept;

atomic_t rt_genid;
atomic_t dev_addr_genid;
Expand Down
1 change: 1 addition & 0 deletions include/net/netns/ipv6.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ struct netns_sysctl_ipv6 {
int ip6_rt_mtu_expires;
int ip6_rt_min_advmss;
int icmpv6_time;
int fwmark_reflect;
};

struct netns_ipv6 {
Expand Down
6 changes: 4 additions & 2 deletions include/net/route.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ struct rtable {
int rt_iif;
int rt_oif;
__u32 rt_mark;
uid_t rt_uid;

/* Info on neighbour */
__be32 rt_gateway;
Expand Down Expand Up @@ -146,7 +147,7 @@ static inline struct rtable *ip_route_output_ports(struct net *net, struct flowi
flowi4_init_output(fl4, oif, sk ? sk->sk_mark : 0, tos,
RT_SCOPE_UNIVERSE, proto,
sk ? inet_sk_flowi_flags(sk) : 0,
daddr, saddr, dport, sport);
daddr, saddr, dport, sport, sk ? sock_i_uid(sk) : 0);
if (sk)
security_sk_classify_flow(sk, flowi4_to_flowi(fl4));
return ip_route_output_flow(net, fl4, sk);
Expand Down Expand Up @@ -250,7 +251,8 @@ static inline void ip_route_connect_init(struct flowi4 *fl4, __be32 dst, __be32
flow_flags |= FLOWI_FLAG_CAN_SLEEP;

flowi4_init_output(fl4, oif, sk->sk_mark, tos, RT_SCOPE_UNIVERSE,
protocol, flow_flags, dst, src, dport, sport);
protocol, flow_flags, dst, src, dport, sport,
sock_i_uid(sk));
}

static inline struct rtable *ip_route_connect(struct flowi4 *fl4,
Expand Down
20 changes: 14 additions & 6 deletions kernel/cgroup.c
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ static void check_for_release(struct cgroup *cgrp);

/*
* A queue for waiters to do rmdir() cgroup. A tasks will sleep when
* cgroup->count == 0 && list_empty(&cgroup->children) && subsys has some
* list_empty(&cgroup->children) && subsys has some
* reference to css->refcnt. In general, this refcnt is expected to goes down
* to zero, soon.
*
Expand Down Expand Up @@ -3935,6 +3935,10 @@ static int cgroup_clear_css_refs(struct cgroup *cgrp)
struct cgroup_subsys *ss;
unsigned long flags;
bool failed = false;

if (atomic_read(&cgrp->count) != 0)
return false;

local_irq_save(flags);
for_each_subsys(cgrp->root, ss) {
struct cgroup_subsys_state *css = cgrp->subsys[ss->subsys_id];
Expand Down Expand Up @@ -3977,19 +3981,23 @@ static int cgroup_clear_css_refs(struct cgroup *cgrp)
return !failed;
}

/* checks if all of the css_sets attached to a cgroup have a refcount of 0.
* Must be called with css_set_lock held */
/* Checks if all of the css_sets attached to a cgroup have a refcount of 0. */
static int cgroup_css_sets_empty(struct cgroup *cgrp)
{
struct cg_cgroup_link *link;
int retval = 1;

read_lock(&css_set_lock);
list_for_each_entry(link, &cgrp->css_sets, cgrp_link_list) {
struct css_set *cg = link->cg;
if (atomic_read(&cg->refcount) > 0)
return 0;
if (atomic_read(&cg->refcount) > 0) {
retval = 0;
break;
}
}
read_unlock(&css_set_lock);

return 1;
return retval;
}

static int cgroup_rmdir(struct inode *unused_dir, struct dentry *dentry)
Expand Down
2 changes: 2 additions & 0 deletions kernel/power/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,5 @@ obj-$(CONFIG_FB_EARLYSUSPEND) += fbearlysuspend.o
obj-$(CONFIG_SUSPEND_TIME) += suspend_time.o

obj-$(CONFIG_MAGIC_SYSRQ) += poweroff.o

obj-$(CONFIG_SUSPEND) += wakeup_reason.o
Loading

0 comments on commit b20e6f8

Please sign in to comment.