From f2b43fc425b2eac5f1f6d9a6b8be6241bd1acdf9 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Tue, 4 Jun 2019 11:34:29 +0200 Subject: [PATCH] 4.9-stable patches added patches: alsa-hda-realtek-set-default-power-save-node-to-0.patch powerpc-perf-fix-mmcra-corruption-by-bhrb_filter.patch --- ...tek-set-default-power-save-node-to-0.patch | 36 ++++++ ...-fix-mmcra-corruption-by-bhrb_filter.patch | 106 ++++++++++++++++++ queue-4.9/series | 2 + 3 files changed, 144 insertions(+) create mode 100644 queue-4.9/alsa-hda-realtek-set-default-power-save-node-to-0.patch create mode 100644 queue-4.9/powerpc-perf-fix-mmcra-corruption-by-bhrb_filter.patch diff --git a/queue-4.9/alsa-hda-realtek-set-default-power-save-node-to-0.patch b/queue-4.9/alsa-hda-realtek-set-default-power-save-node-to-0.patch new file mode 100644 index 0000000000..ff41d5069a --- /dev/null +++ b/queue-4.9/alsa-hda-realtek-set-default-power-save-node-to-0.patch @@ -0,0 +1,36 @@ +From 317d9313925cd8388304286c0d3c8dda7f060a2d Mon Sep 17 00:00:00 2001 +From: Kailang Yang +Date: Thu, 23 May 2019 14:43:04 +0800 +Subject: ALSA: hda/realtek - Set default power save node to 0 + +From: Kailang Yang + +commit 317d9313925cd8388304286c0d3c8dda7f060a2d upstream. + +I measured power consumption between power_save_node=1 and power_save_node=0. +It's almost the same. +Codec will enter to runtime suspend and suspend. +That pin also will enter to D3. Don't need to enter to D3 by single pin. +So, Disable power_save_node as default. It will avoid more issues. +Windows Driver also has not this option at runtime PM. + +Signed-off-by: Kailang Yang +Cc: +Signed-off-by: Takashi Iwai +Signed-off-by: Greg Kroah-Hartman + +--- + sound/pci/hda/patch_realtek.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +--- a/sound/pci/hda/patch_realtek.c ++++ b/sound/pci/hda/patch_realtek.c +@@ -6317,7 +6317,7 @@ static int patch_alc269(struct hda_codec + + spec = codec->spec; + spec->gen.shared_mic_vref_pin = 0x18; +- codec->power_save_node = 1; ++ codec->power_save_node = 0; + + #ifdef CONFIG_PM + codec->patch_ops.suspend = alc269_suspend; diff --git a/queue-4.9/powerpc-perf-fix-mmcra-corruption-by-bhrb_filter.patch b/queue-4.9/powerpc-perf-fix-mmcra-corruption-by-bhrb_filter.patch new file mode 100644 index 0000000000..cd9743026d --- /dev/null +++ b/queue-4.9/powerpc-perf-fix-mmcra-corruption-by-bhrb_filter.patch @@ -0,0 +1,106 @@ +From 3202e35ec1c8fc19cea24253ff83edf702a60a02 Mon Sep 17 00:00:00 2001 +From: Ravi Bangoria +Date: Sat, 11 May 2019 08:12:17 +0530 +Subject: powerpc/perf: Fix MMCRA corruption by bhrb_filter + +From: Ravi Bangoria + +commit 3202e35ec1c8fc19cea24253ff83edf702a60a02 upstream. + +Consider a scenario where user creates two events: + + 1st event: + attr.sample_type |= PERF_SAMPLE_BRANCH_STACK; + attr.branch_sample_type = PERF_SAMPLE_BRANCH_ANY; + fd = perf_event_open(attr, 0, 1, -1, 0); + + This sets cpuhw->bhrb_filter to 0 and returns valid fd. + + 2nd event: + attr.sample_type |= PERF_SAMPLE_BRANCH_STACK; + attr.branch_sample_type = PERF_SAMPLE_BRANCH_CALL; + fd = perf_event_open(attr, 0, 1, -1, 0); + + It overrides cpuhw->bhrb_filter to -1 and returns with error. + +Now if power_pmu_enable() gets called by any path other than +power_pmu_add(), ppmu->config_bhrb(-1) will set MMCRA to -1. + +Fixes: 3925f46bb590 ("powerpc/perf: Enable branch stack sampling framework") +Cc: stable@vger.kernel.org # v3.10+ +Signed-off-by: Ravi Bangoria +Reviewed-by: Madhavan Srinivasan +Signed-off-by: Michael Ellerman +Signed-off-by: Greg Kroah-Hartman + +--- + arch/powerpc/perf/core-book3s.c | 6 ++++-- + arch/powerpc/perf/power8-pmu.c | 3 +++ + arch/powerpc/perf/power9-pmu.c | 3 +++ + 3 files changed, 10 insertions(+), 2 deletions(-) + +--- a/arch/powerpc/perf/core-book3s.c ++++ b/arch/powerpc/perf/core-book3s.c +@@ -1800,6 +1800,7 @@ static int power_pmu_event_init(struct p + int n; + int err; + struct cpu_hw_events *cpuhw; ++ u64 bhrb_filter; + + if (!ppmu) + return -ENOENT; +@@ -1896,13 +1897,14 @@ static int power_pmu_event_init(struct p + err = power_check_constraints(cpuhw, events, cflags, n + 1); + + if (has_branch_stack(event)) { +- cpuhw->bhrb_filter = ppmu->bhrb_filter_map( ++ bhrb_filter = ppmu->bhrb_filter_map( + event->attr.branch_sample_type); + +- if (cpuhw->bhrb_filter == -1) { ++ if (bhrb_filter == -1) { + put_cpu_var(cpu_hw_events); + return -EOPNOTSUPP; + } ++ cpuhw->bhrb_filter = bhrb_filter; + } + + put_cpu_var(cpu_hw_events); +--- a/arch/powerpc/perf/power8-pmu.c ++++ b/arch/powerpc/perf/power8-pmu.c +@@ -29,6 +29,7 @@ enum { + #define POWER8_MMCRA_IFM1 0x0000000040000000UL + #define POWER8_MMCRA_IFM2 0x0000000080000000UL + #define POWER8_MMCRA_IFM3 0x00000000C0000000UL ++#define POWER8_MMCRA_BHRB_MASK 0x00000000C0000000UL + + /* Table of alternatives, sorted by column 0 */ + static const unsigned int event_alternatives[][MAX_ALT] = { +@@ -262,6 +263,8 @@ static u64 power8_bhrb_filter_map(u64 br + + static void power8_config_bhrb(u64 pmu_bhrb_filter) + { ++ pmu_bhrb_filter &= POWER8_MMCRA_BHRB_MASK; ++ + /* Enable BHRB filter in PMU */ + mtspr(SPRN_MMCRA, (mfspr(SPRN_MMCRA) | pmu_bhrb_filter)); + } +--- a/arch/powerpc/perf/power9-pmu.c ++++ b/arch/powerpc/perf/power9-pmu.c +@@ -30,6 +30,7 @@ enum { + #define POWER9_MMCRA_IFM1 0x0000000040000000UL + #define POWER9_MMCRA_IFM2 0x0000000080000000UL + #define POWER9_MMCRA_IFM3 0x00000000C0000000UL ++#define POWER9_MMCRA_BHRB_MASK 0x00000000C0000000UL + + GENERIC_EVENT_ATTR(cpu-cycles, PM_CYC); + GENERIC_EVENT_ATTR(stalled-cycles-frontend, PM_ICT_NOSLOT_CYC); +@@ -177,6 +178,8 @@ static u64 power9_bhrb_filter_map(u64 br + + static void power9_config_bhrb(u64 pmu_bhrb_filter) + { ++ pmu_bhrb_filter &= POWER9_MMCRA_BHRB_MASK; ++ + /* Enable BHRB filter in PMU */ + mtspr(SPRN_MMCRA, (mfspr(SPRN_MMCRA) | pmu_bhrb_filter)); + } diff --git a/queue-4.9/series b/queue-4.9/series index 821dfa31b8..87b8d7339d 100644 --- a/queue-4.9/series +++ b/queue-4.9/series @@ -34,3 +34,5 @@ media-smsusb-better-handle-optional-alignment.patch scsi-zfcp-fix-missing-zfcp_port-reference-put-on-ebusy-from-port_remove.patch scsi-zfcp-fix-to-prevent-port_remove-with-pure-auto-scan-luns-only-sdevs.patch btrfs-fix-race-updating-log-root-item-during-fsync.patch +powerpc-perf-fix-mmcra-corruption-by-bhrb_filter.patch +alsa-hda-realtek-set-default-power-save-node-to-0.patch -- 2.39.2