Skip to content

Commit

Permalink
Synchronize code for OnePlus PJD110_14.0.0.810(CN01)
Browse files Browse the repository at this point in the history
Based on QCOM release TAG:AU_LINUX_KERNEL.PLATFORM.3.0.R1.00.00.00.017.045
  • Loading branch information
pswbuild committed Jul 10, 2024
1 parent 39a77a7 commit 3f11281
Show file tree
Hide file tree
Showing 13 changed files with 253 additions and 21 deletions.
2 changes: 0 additions & 2 deletions android/abi_gki_aarch64_qcom
Original file line number Diff line number Diff line change
Expand Up @@ -3441,7 +3441,6 @@
__traceiter_android_vh_ufs_send_uic_command
__traceiter_android_vh_ufs_update_sdev
__traceiter_android_vh_update_topology_flags_workfn
__traceiter_android_vh_mpam_set
__traceiter_binder_transaction_received
__traceiter_cpu_frequency_limits
__traceiter_cpu_idle
Expand Down Expand Up @@ -3591,7 +3590,6 @@
__tracepoint_android_vh_ufs_send_uic_command
__tracepoint_android_vh_ufs_update_sdev
__tracepoint_android_vh_update_topology_flags_workfn
__tracepoint_android_vh_mpam_set
__tracepoint_binder_transaction_received
__tracepoint_cpu_frequency_limits
__tracepoint_cpu_idle
Expand Down
2 changes: 1 addition & 1 deletion arch/arm64/configs/vendor/pineapple_GKI.config
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ CONFIG_QCOM_DMABUF_HEAPS_PAGE_POOL_REFILL=y
CONFIG_QCOM_DMABUF_HEAPS_SYSTEM=y
CONFIG_QCOM_DMABUF_HEAPS_SYSTEM_SECURE=y
CONFIG_QCOM_DMABUF_HEAPS_UBWCP=y
# CONFIG_QCOM_DYN_MINIDUMP_STACK is not set
CONFIG_QCOM_DYN_MINIDUMP_STACK=y
CONFIG_QCOM_EUD=m
CONFIG_QCOM_FORCE_WDOG_BITE_ON_PANIC=y
CONFIG_QCOM_GDSC_REGULATOR=m
Expand Down
4 changes: 3 additions & 1 deletion drivers/android/binder.c
Original file line number Diff line number Diff line change
Expand Up @@ -1890,8 +1890,10 @@ static size_t binder_get_object(struct binder_proc *proc,
size_t object_size = 0;

read_size = min_t(size_t, sizeof(*object), buffer->data_size - offset);
if (offset > buffer->data_size || read_size < sizeof(*hdr))
if (offset > buffer->data_size || read_size < sizeof(*hdr) ||
!IS_ALIGNED(offset, sizeof(u32)))
return 0;

if (u) {
if (copy_from_user(object, u + offset, read_size))
return 0;
Expand Down
2 changes: 1 addition & 1 deletion drivers/media/platform/qcom/venus/hfi_msgs.c
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ session_get_prop_buf_req(struct hfi_msg_session_property_info_pkt *pkt,
memcpy(&bufreq[idx], buf_req, sizeof(*bufreq));
idx++;

if (idx > HFI_BUFFER_TYPE_MAX)
if (idx >= HFI_BUFFER_TYPE_MAX)
return HFI_ERR_SESSION_INVALID_PARAMETER;

req_bytes -= sizeof(struct hfi_buffer_requirements);
Expand Down
2 changes: 1 addition & 1 deletion drivers/soc/qcom/dcvs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ obj-$(CONFIG_QTI_PMU_SCMI_CLIENT) += pmu_scmi.o
obj-$(CONFIG_QTI_C1DCVS_SCMI_CLIENT) += c1dcvs_scmi.o
obj-$(CONFIG_QTI_QCOM_SCMI_CLIENT) += qcom_scmi_client.o
obj-$(CONFIG_QTI_C1DCVS_SCMI_V2) += c1dcvs_scmi_v2.o
obj-$(CONFIG_QTI_MPAM) += mpam.o mpam_test.o
obj-$(CONFIG_QTI_MPAM) += mpam.o
obj-$(CONFIG_QTI_CPUFREQ_STATS_SCMI_V2) += cpufreq_stats_scmi_v2.o
obj-$(CONFIG_QTI_DYNPF_SCMI) += dynpf_scmi.o
183 changes: 183 additions & 0 deletions drivers/soc/qcom/minidump_log.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include <linux/vmalloc.h>
#include <linux/panic_notifier.h>
#include "debug_symbol.h"
#include <linux/version.h>
#ifdef CONFIG_QCOM_MINIDUMP_PSTORE
#include <linux/math64.h>
#include <linux/of.h>
Expand Down Expand Up @@ -98,6 +99,10 @@ static struct md_suspend_context_data md_suspend_context;

static bool is_vmap_stack __read_mostly;

/* #ifdef OPLUS_FEATURE_DFR */
static bool md_stack_inited = false;
/* #endif */

#ifdef CONFIG_QCOM_MINIDUMP_FTRACE
#include <trace/hooks/ftrace_dump.h>
#include <linux/ring_buffer.h>
Expand Down Expand Up @@ -1518,16 +1523,194 @@ static void register_pstore_info(void)
}
}
#endif
/* #ifdef OPLUS_FEATURE_DFR */
static bool current_stack_enable = false;
unsigned long ZeroPage = 0;

static int clear_md_region(int regno,struct md_region *ksp_entry)
{
int ret;

if (NULL == (void *)ZeroPage) {
pr_err("md get_zeroed_page fail");
return -ENOMEM;
}
ksp_entry->virt_addr = ZeroPage;
ksp_entry->phys_addr = virt_to_phys((void *)ZeroPage);
ret = msm_minidump_update_region(regno,ksp_entry);
return ret;
}

static void clear_current_stack(void)
{
struct md_stack_cpu_data *md_stack_cpu_d;
int ret = 0, i = 0;
unsigned int cpu;
struct md_region *mdr;
int *mdno;

unregister_trace_sched_switch(md_current_stack_notifer, NULL);
for_each_possible_cpu(cpu) {
md_stack_cpu_d = &per_cpu(md_stack_data, cpu);
if (is_vmap_stack) {
mdr = md_stack_cpu_d->stack_mdr;
mdno = md_stack_cpu_d->stack_mdidx;
for (i = 0; i < STACK_NUM_PAGES; i++) {
ret = clear_md_region(*mdno,mdr);
if (ret < 0)
pr_err("failed to clear cpu:%d,vmap:%d current stack", cpu ,i);
mdr++;
mdno++;
}
}
else {
ret = clear_md_region(*(md_stack_cpu_d->stack_mdidx),md_stack_cpu_d->stack_mdr);
if (ret < 0)
pr_err("failed to clear current stack");
}
}
}
static void clear_suspend_context(void)
{
int ret = 0;
int i;
struct md_region *mdr;
int *mdno;

mdr = md_suspend_context.stack_mdr;
mdno = md_suspend_context.stack_mdidx;
if (is_vmap_stack) {
for (i = 0; i < STACK_NUM_PAGES; i++) {
ret = clear_md_region(*mdno,mdr);
if (ret < 0)
pr_err("failed to clear vmap:%d suspend stack",i);
mdr++;
mdno++;
}
}
else {
ret = clear_md_region(*(md_suspend_context.stack_mdidx),md_suspend_context.stack_mdr);
if (ret < 0)
pr_err("failed to clear suspend stack");
}

ret = clear_md_region(md_suspend_context.task_mdno,&md_suspend_context.task_mdr);
if (ret < 0)
pr_err("failed to clear suspend task");
}
static void unregister_current_stack(void)
{
unregister_trace_sched_switch(md_current_stack_notifer, NULL);
if (md_stack_inited)
{
pr_err("start clean current_stack");
clear_current_stack();
}
}
static void unregister_suspend_context(void)
{
unregister_pm_notifier(&minidump_pm_nb);
if (md_stack_inited)
{
pr_err("start clean suspend_context");
clear_suspend_context();
}
}
static ssize_t current_stack_trigger(struct file *filp, const char *ubuf, size_t cnt, loff_t *data)
{
char buf[64];
int val = 0;
int ret = 0;

if (cnt >= sizeof(buf)) {
return -EINVAL;
}
if (copy_from_user(&buf, ubuf, cnt)) {
return -EFAULT;
}
buf[cnt] = 0;
ret = kstrtoint(buf, 0, (int *)&val);
if (ret < 0) {
return ret;
}

if ((!!val) && (current_stack_enable == false)) {
pr_info("current_stack enable");
if (md_stack_inited == false) {
register_current_stack();
register_suspend_context();
md_stack_inited = true;
}
else {
register_pm_notifier(&minidump_pm_nb);
register_trace_sched_switch(md_current_stack_notifer, NULL);
smp_call_function(md_current_stack_ipi_handler, NULL, 1);
}
current_stack_enable = true;
}
else if ((!val) && (current_stack_enable == true)) {
pr_info("current_stack disable");
unregister_current_stack();
unregister_suspend_context();
current_stack_enable = false;
}
return cnt;
}
static ssize_t current_stack_show(struct file *file, char __user *buf,
size_t count,loff_t *off)
{
char page[64] = {0};
int len = 0;

len = sprintf(&page[len], "=== current_stack_enable:%d ===\n", current_stack_enable);
if(len > *off)
len -= *off;
else
len = 0;
if(copy_to_user(buf,page,(len < count ? len : count))) {
return -EFAULT;
}
*off += len < count ? len : count;
return (len < count ? len : count);
}
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0))
static const struct proc_ops current_stack_fops = {
.proc_read = current_stack_show,
.proc_write = current_stack_trigger,
.proc_lseek = seq_lseek,
};
#else
struct file_operations current_stack_fops = {
.write = current_stack_trigger,
.read = current_stack_show,
};
#endif
/* #endif */
int msm_minidump_log_init(void)
{
/* #ifdef OPLUS_FEATURE_DFR */
struct proc_dir_entry *pe;
pr_info("msm_minidump_log_init\n");
pe = proc_create("minidump_vcpu_stack", 0666, NULL, &current_stack_fops);
if (!pe) {
pr_err("Failed to register minidump_vcpu_stack interface\n");
return -ENOMEM;
}
ZeroPage = get_zeroed_page(GFP_KERNEL);
if (NULL == (void *)ZeroPage ) {
pr_err("md get_zeroed_page fail");
return -ENOMEM;
}
/* #endif */
register_kernel_sections();
is_vmap_stack = IS_ENABLED(CONFIG_VMAP_STACK);
register_irq_stack();
/*#ifdef OPLUS_FEATURE_DFR
#ifdef CONFIG_QCOM_DYN_MINIDUMP_STACK
register_current_stack();
register_suspend_context();
#endif
#endif */
#ifdef CONFIG_QCOM_MINIDUMP_PSTORE
register_pstore_info();
#endif
Expand Down
45 changes: 45 additions & 0 deletions drivers/usb/dwc3/dwc3-msm-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -647,6 +647,9 @@ struct dwc3_msm {
u32 qos_rec_irq[PM_QOS_REC_MAX_RECORD];

int repeater_rev;
#ifdef OPLUS_FEATURE_CHG_BASIC
bool force_disconnect;
#endif
};

#define USB_HSPHY_3P3_VOL_MIN 3050000 /* uV */
Expand Down Expand Up @@ -6360,6 +6363,9 @@ static int dwc3_msm_probe(struct platform_device *pdev)
dwc3_ext_event_notify(mdwc);
}

#ifdef OPLUS_FEATURE_CHG_BASIC
mdwc->force_disconnect = false;
#endif
return 0;

put_dwc3:
Expand Down Expand Up @@ -6931,7 +6937,12 @@ static void dwc3_override_vbus_status(struct dwc3_msm *mdwc, bool vbus_present)
static int dwc3_otg_start_peripheral(struct dwc3_msm *mdwc, int on)
{
struct dwc3 *dwc = platform_get_drvdata(mdwc->dwc3);
#ifdef OPLUS_FEATURE_CHG_BASIC
unsigned long flags;
int timeout = 100;
#else
int timeout = 1000;
#endif
int ret;

ret = pm_runtime_resume_and_get(mdwc->dev);
Expand Down Expand Up @@ -6999,6 +7010,21 @@ static int dwc3_otg_start_peripheral(struct dwc3_msm *mdwc, int on)

usb_role_switch_set_role(mdwc->dwc3_drd_sw, USB_ROLE_DEVICE);
clk_set_rate(mdwc->core_clk, mdwc->core_clk_rate);
#ifdef OPLUS_FEATURE_CHG_BASIC
/*
* Check udc->driver to find out if we are bound to udc or not.
*/
spin_lock_irqsave(&dwc->lock, flags);
if ((mdwc->force_disconnect) && (dwc->gadget_driver) &&
(!dwc->softconnect)) {
spin_unlock_irqrestore(&dwc->lock, flags);
dbg_event(0xFF, "Force Pullup", 0);
usb_gadget_connect(dwc->gadget);
spin_lock_irqsave(&dwc->lock, flags);
}
spin_unlock_irqrestore(&dwc->lock, flags);
mdwc->force_disconnect = false;
#endif
} else {
dev_dbg(mdwc->dev, "%s: turn off gadget\n", __func__);

Expand All @@ -7022,13 +7048,32 @@ static int dwc3_otg_start_peripheral(struct dwc3_msm *mdwc, int on)
* or pullup disable), and retry suspend again.
*/
ret = pm_runtime_put_sync(&mdwc->dwc3->dev);
#ifndef OPLUS_FEATURE_CHG_BASIC
if (ret == -EBUSY) {
#else
if (!pm_runtime_suspended(&mdwc->dwc3->dev)) {
#endif
while (--timeout && dwc->connected)
msleep(20);
dbg_event(0xFF, "StopGdgt connected", dwc->connected);
pm_runtime_suspend(&mdwc->dwc3->dev);
}

#ifdef OPLUS_FEATURE_CHG_BASIC
if ((timeout == 0) && (dwc->connected)) {
dbg_event(0xFF, "Force Pulldown", 0);

/*
* Since we are not taking the udc_lock, there is a
* chance that this might race with gadget_remove driver
* in case this is called in parallel to UDC getting
* cleared in userspace
*/
usb_gadget_disconnect(dwc->gadget);
mdwc->force_disconnect = true;
}
#endif

/* wait for LPM, to ensure h/w is reset after stop_peripheral */
set_bit(WAIT_FOR_LPM, &mdwc->inputs);

Expand Down
1 change: 0 additions & 1 deletion include/linux/sched/walt.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,6 @@ struct walt_task_struct {
cpumask_t reduce_mask;
u64 mark_start_birth_ts;
u8 high_util_history;
u64 mpam_partid;
};

/*
Expand Down
Loading

0 comments on commit 3f11281

Please sign in to comment.