+++ /dev/null
-From 69d64bafe3b1c1f9a8323476b900b64001a304e9 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Mon, 30 Oct 2023 11:41:33 +0100
-Subject: s390/pai: cleanup event initialization
-
-From: Thomas Richter <tmricht@linux.ibm.com>
-
-[ Upstream commit 4711b7b8f99583f6105a33e91f106125134beacb ]
-
-Setting event::hw.last_tag to zero is not necessary. The memory
-for each event is dynamically allocated by the kernel common code and
-initialized to zero already. Remove this unnecessary assignment.
-Move the comment to function paicrypt_start() for clarification.
-
-Suggested-by: Sumanth Korikkar <sumanthk@linux.ibm.com>
-Acked-by: Sumanth Korikkar <sumanthk@linux.ibm.com>
-Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
-Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
-Stable-dep-of: e9f3af02f639 ("s390/pai: fix sampling event removal for PMU device driver")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- arch/s390/kernel/perf_pai_crypto.c | 11 +++++------
- arch/s390/kernel/perf_pai_ext.c | 1 -
- 2 files changed, 5 insertions(+), 7 deletions(-)
-
-diff --git a/arch/s390/kernel/perf_pai_crypto.c b/arch/s390/kernel/perf_pai_crypto.c
-index 1ac74333a78dc..270255acacb02 100644
---- a/arch/s390/kernel/perf_pai_crypto.c
-+++ b/arch/s390/kernel/perf_pai_crypto.c
-@@ -210,12 +210,6 @@ static int paicrypt_event_init(struct perf_event *event)
- if (rc)
- return rc;
-
-- /* Event initialization sets last_tag to 0. When later on the events
-- * are deleted and re-added, do not reset the event count value to zero.
-- * Events are added, deleted and re-added when 2 or more events
-- * are active at the same time.
-- */
-- event->hw.last_tag = 0;
- event->destroy = paicrypt_event_destroy;
-
- if (a->sample_period) {
-@@ -249,6 +243,11 @@ static void paicrypt_start(struct perf_event *event, int flags)
- {
- u64 sum;
-
-+ /* Event initialization sets last_tag to 0. When later on the events
-+ * are deleted and re-added, do not reset the event count value to zero.
-+ * Events are added, deleted and re-added when 2 or more events
-+ * are active at the same time.
-+ */
- if (!event->hw.last_tag) {
- event->hw.last_tag = 1;
- sum = paicrypt_getall(event); /* Get current value */
-diff --git a/arch/s390/kernel/perf_pai_ext.c b/arch/s390/kernel/perf_pai_ext.c
-index ac32107167eac..8fddde11cfb1f 100644
---- a/arch/s390/kernel/perf_pai_ext.c
-+++ b/arch/s390/kernel/perf_pai_ext.c
-@@ -261,7 +261,6 @@ static int paiext_event_init(struct perf_event *event)
- rc = paiext_alloc(a, event);
- if (rc)
- return rc;
-- event->hw.last_tag = 0;
- event->destroy = paiext_event_destroy;
-
- if (a->sample_period) {
---
-2.43.0
-
+++ /dev/null
-From edd91f101651c22faf624630ff57b9e477f6ea65 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Thu, 29 Feb 2024 15:00:28 +0100
-Subject: s390/pai: fix sampling event removal for PMU device driver
-
-From: Thomas Richter <tmricht@linux.ibm.com>
-
-[ Upstream commit e9f3af02f63909f41b43c28330434cc437639c5c ]
-
-In case of a sampling event, the PAI PMU device drivers need a
-reference to this event. Currently to PMU device driver reference
-is removed when a sampling event is destroyed. This may lead to
-situations where the reference of the PMU device driver is removed
-while being used by a different sampling event.
-Reset the event reference pointer of the PMU device driver when
-a sampling event is deleted and before the next one might be added.
-
-Fixes: 39d62336f5c1 ("s390/pai: add support for cryptography counters")
-Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
-Acked-by: Sumanth Korikkar <sumanthk@linux.ibm.com>
-Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- arch/s390/kernel/perf_pai_crypto.c | 10 +++++++---
- arch/s390/kernel/perf_pai_ext.c | 10 +++++++---
- 2 files changed, 14 insertions(+), 6 deletions(-)
-
-diff --git a/arch/s390/kernel/perf_pai_crypto.c b/arch/s390/kernel/perf_pai_crypto.c
-index 65cc74ab4cdd8..1eefbe2ff4189 100644
---- a/arch/s390/kernel/perf_pai_crypto.c
-+++ b/arch/s390/kernel/perf_pai_crypto.c
-@@ -53,7 +53,6 @@ static void paicrypt_event_destroy(struct perf_event *event)
- {
- struct paicrypt_map *cpump = per_cpu_ptr(&paicrypt_map, event->cpu);
-
-- cpump->event = NULL;
- static_branch_dec(&pai_key);
- mutex_lock(&pai_reserve_mutex);
- debug_sprintf_event(cfm_dbg, 5, "%s event %#llx cpu %d users %d"
-@@ -278,10 +277,15 @@ static int paicrypt_add(struct perf_event *event, int flags)
-
- static void paicrypt_stop(struct perf_event *event, int flags)
- {
-- if (!event->attr.sample_period) /* Counting */
-+ struct paicrypt_mapptr *mp = this_cpu_ptr(paicrypt_root.mapptr);
-+ struct paicrypt_map *cpump = mp->mapptr;
-+
-+ if (!event->attr.sample_period) { /* Counting */
- paicrypt_read(event);
-- else /* Sampling */
-+ } else { /* Sampling */
- perf_sched_cb_dec(event->pmu);
-+ cpump->event = NULL;
-+ }
- event->hw.state = PERF_HES_STOPPED;
- }
-
-diff --git a/arch/s390/kernel/perf_pai_ext.c b/arch/s390/kernel/perf_pai_ext.c
-index bac95261ec46d..a9235071ca70b 100644
---- a/arch/s390/kernel/perf_pai_ext.c
-+++ b/arch/s390/kernel/perf_pai_ext.c
-@@ -122,7 +122,6 @@ static void paiext_event_destroy(struct perf_event *event)
- struct paiext_map *cpump = mp->mapptr;
-
- mutex_lock(&paiext_reserve_mutex);
-- cpump->event = NULL;
- if (refcount_dec_and_test(&cpump->refcnt)) /* Last reference gone */
- paiext_free(mp);
- paiext_root_free();
-@@ -355,10 +354,15 @@ static int paiext_add(struct perf_event *event, int flags)
-
- static void paiext_stop(struct perf_event *event, int flags)
- {
-- if (!event->attr.sample_period) /* Counting */
-+ struct paiext_mapptr *mp = this_cpu_ptr(paiext_root.mapptr);
-+ struct paiext_map *cpump = mp->mapptr;
-+
-+ if (!event->attr.sample_period) { /* Counting */
- paiext_read(event);
-- else /* Sampling */
-+ } else { /* Sampling */
- perf_sched_cb_dec(event->pmu);
-+ cpump->event = NULL;
-+ }
- event->hw.state = PERF_HES_STOPPED;
- }
-
---
-2.43.0
-
+++ /dev/null
-From 71020b7334f94ffa19b4d924dd00d987495c9acc Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 11 Oct 2023 12:09:30 +0200
-Subject: s390/pai: initialize event count once at initialization
-
-From: Thomas Richter <tmricht@linux.ibm.com>
-
-[ Upstream commit b286997e83dcf7b498329a66a8a22fc8a5bf50f0 ]
-
-Event count value is initialized and set to zero in function
-paicrypt_start(). This function is called once per CPU when an
-event is started on that CPU. This leads to event count value
-being set to zero as many times as there are online CPUs.
-This is not necessary. The event count value is bound to the event
-and it is sufficient to initialize the event counter once at
-event creation time. This is done when the event structure
-is dynamicly allocated with __GFP_ZERO flag. This sets
-member count to zero.
-
-Acked-by: Sumanth Korikkar <sumanthk@linux.ibm.com>
-Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
-Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
-Stable-dep-of: e9f3af02f639 ("s390/pai: fix sampling event removal for PMU device driver")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- arch/s390/kernel/perf_pai_crypto.c | 1 -
- arch/s390/kernel/perf_pai_ext.c | 1 -
- 2 files changed, 2 deletions(-)
-
-diff --git a/arch/s390/kernel/perf_pai_crypto.c b/arch/s390/kernel/perf_pai_crypto.c
-index 4a4e914c283c8..0921cea849125 100644
---- a/arch/s390/kernel/perf_pai_crypto.c
-+++ b/arch/s390/kernel/perf_pai_crypto.c
-@@ -253,7 +253,6 @@ static void paicrypt_start(struct perf_event *event, int flags)
- if (!event->hw.last_tag) {
- event->hw.last_tag = 1;
- sum = paicrypt_getall(event); /* Get current value */
-- local64_set(&event->count, 0);
- local64_set(&event->hw.prev_count, sum);
- }
- }
-diff --git a/arch/s390/kernel/perf_pai_ext.c b/arch/s390/kernel/perf_pai_ext.c
-index b5febe22d0546..ac32107167eac 100644
---- a/arch/s390/kernel/perf_pai_ext.c
-+++ b/arch/s390/kernel/perf_pai_ext.c
-@@ -327,7 +327,6 @@ static void paiext_start(struct perf_event *event, int flags)
- event->hw.last_tag = 1;
- sum = paiext_getall(event); /* Get current value */
- local64_set(&event->hw.prev_count, sum);
-- local64_set(&event->count, 0);
- }
-
- static int paiext_add(struct perf_event *event, int flags)
---
-2.43.0
-
+++ /dev/null
-From a41f5e8eef58c810bf254494a5c31bd32c2afec2 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 15 Nov 2023 11:04:25 +0100
-Subject: s390/pai: rework paiXXX_start and paiXXX_stop functions
-
-From: Thomas Richter <tmricht@linux.ibm.com>
-
-[ Upstream commit cb1259b7b574bd90ef22dac2c6282327cdae31c6 ]
-
-The PAI crypto counter and PAI NNPA counters start and stop functions
-are streamlined. Move the conditions to invoke start and stop functions
-to its respective function body and call them unconditionally.
-The start and stop functions now determine how to proceed.
-No functional change.
-
-Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
-Acked-by: Mete Durlu <meted@linux.ibm.com>
-Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
-Stable-dep-of: e9f3af02f639 ("s390/pai: fix sampling event removal for PMU device driver")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- arch/s390/kernel/perf_pai_crypto.c | 29 ++++++++++++-------------
- arch/s390/kernel/perf_pai_ext.c | 35 ++++++++++++++----------------
- 2 files changed, 30 insertions(+), 34 deletions(-)
-
-diff --git a/arch/s390/kernel/perf_pai_crypto.c b/arch/s390/kernel/perf_pai_crypto.c
-index 270255acacb02..65cc74ab4cdd8 100644
---- a/arch/s390/kernel/perf_pai_crypto.c
-+++ b/arch/s390/kernel/perf_pai_crypto.c
-@@ -248,10 +248,14 @@ static void paicrypt_start(struct perf_event *event, int flags)
- * Events are added, deleted and re-added when 2 or more events
- * are active at the same time.
- */
-- if (!event->hw.last_tag) {
-- event->hw.last_tag = 1;
-- sum = paicrypt_getall(event); /* Get current value */
-- local64_set(&event->hw.prev_count, sum);
-+ if (!event->attr.sample_period) { /* Counting */
-+ if (!event->hw.last_tag) {
-+ event->hw.last_tag = 1;
-+ sum = paicrypt_getall(event); /* Get current value */
-+ local64_set(&event->hw.prev_count, sum);
-+ }
-+ } else { /* Sampling */
-+ perf_sched_cb_inc(event->pmu);
- }
- }
-
-@@ -266,19 +270,18 @@ static int paicrypt_add(struct perf_event *event, int flags)
- __ctl_set_bit(0, 50);
- }
- cpump->event = event;
-- if (flags & PERF_EF_START && !event->attr.sample_period) {
-- /* Only counting needs initial counter value */
-+ if (flags & PERF_EF_START)
- paicrypt_start(event, PERF_EF_RELOAD);
-- }
- event->hw.state = 0;
-- if (event->attr.sample_period)
-- perf_sched_cb_inc(event->pmu);
- return 0;
- }
-
- static void paicrypt_stop(struct perf_event *event, int flags)
- {
-- paicrypt_read(event);
-+ if (!event->attr.sample_period) /* Counting */
-+ paicrypt_read(event);
-+ else /* Sampling */
-+ perf_sched_cb_dec(event->pmu);
- event->hw.state = PERF_HES_STOPPED;
- }
-
-@@ -286,11 +289,7 @@ static void paicrypt_del(struct perf_event *event, int flags)
- {
- struct paicrypt_map *cpump = this_cpu_ptr(&paicrypt_map);
-
-- if (event->attr.sample_period)
-- perf_sched_cb_dec(event->pmu);
-- if (!event->attr.sample_period)
-- /* Only counting needs to read counter */
-- paicrypt_stop(event, PERF_EF_UPDATE);
-+ paicrypt_stop(event, PERF_EF_UPDATE);
- if (--cpump->active_events == 0) {
- __ctl_clear_bit(0, 50);
- WRITE_ONCE(S390_lowcore.ccd, 0);
-diff --git a/arch/s390/kernel/perf_pai_ext.c b/arch/s390/kernel/perf_pai_ext.c
-index 8fddde11cfb1f..bac95261ec46d 100644
---- a/arch/s390/kernel/perf_pai_ext.c
-+++ b/arch/s390/kernel/perf_pai_ext.c
-@@ -321,11 +321,15 @@ static void paiext_start(struct perf_event *event, int flags)
- {
- u64 sum;
-
-- if (event->hw.last_tag)
-- return;
-- event->hw.last_tag = 1;
-- sum = paiext_getall(event); /* Get current value */
-- local64_set(&event->hw.prev_count, sum);
-+ if (!event->attr.sample_period) { /* Counting */
-+ if (!event->hw.last_tag) {
-+ event->hw.last_tag = 1;
-+ sum = paiext_getall(event); /* Get current value */
-+ local64_set(&event->hw.prev_count, sum);
-+ }
-+ } else { /* Sampling */
-+ perf_sched_cb_inc(event->pmu);
-+ }
- }
-
- static int paiext_add(struct perf_event *event, int flags)
-@@ -342,21 +346,19 @@ static int paiext_add(struct perf_event *event, int flags)
- debug_sprintf_event(paiext_dbg, 4, "%s 1508 %llx acc %llx\n",
- __func__, S390_lowcore.aicd, pcb->acc);
- }
-- if (flags & PERF_EF_START && !event->attr.sample_period) {
-- /* Only counting needs initial counter value */
-+ cpump->event = event;
-+ if (flags & PERF_EF_START)
- paiext_start(event, PERF_EF_RELOAD);
-- }
- event->hw.state = 0;
-- if (event->attr.sample_period) {
-- cpump->event = event;
-- perf_sched_cb_inc(event->pmu);
-- }
- return 0;
- }
-
- static void paiext_stop(struct perf_event *event, int flags)
- {
-- paiext_read(event);
-+ if (!event->attr.sample_period) /* Counting */
-+ paiext_read(event);
-+ else /* Sampling */
-+ perf_sched_cb_dec(event->pmu);
- event->hw.state = PERF_HES_STOPPED;
- }
-
-@@ -366,12 +368,7 @@ static void paiext_del(struct perf_event *event, int flags)
- struct paiext_map *cpump = mp->mapptr;
- struct paiext_cb *pcb = cpump->paiext_cb;
-
-- if (event->attr.sample_period)
-- perf_sched_cb_dec(event->pmu);
-- if (!event->attr.sample_period) {
-- /* Only counting needs to read counter */
-- paiext_stop(event, PERF_EF_UPDATE);
-- }
-+ paiext_stop(event, PERF_EF_UPDATE);
- if (--cpump->active_events == 0) {
- /* Disable CPU instruction lookup for PAIE1 control block */
- __ctl_clear_bit(0, 49);
---
-2.43.0
-
+++ /dev/null
-From 4af1cf94635a824940b66a38e6f811e22d4bee74 Mon Sep 17 00:00:00 2001
-From: Sasha Levin <sashal@kernel.org>
-Date: Wed, 18 Oct 2023 11:53:52 +0200
-Subject: s390/pai_crypto: remove per-cpu variable assignement in event
- initialization
-
-From: Thomas Richter <tmricht@linux.ibm.com>
-
-[ Upstream commit aecd5a37b5ef4de4f6402dc079672e4243cc4c13 ]
-
-Function paicrypt_event_init() initializes the PMU device driver
-specific details for an event. It is called once per event creation.
-The function paicrypt_event_init() is not necessarily executed on
-that CPU the event will be used for.
-When an event is activated, function paicrypt_start() is used to
-start the event on that CPU.
-The per CPU data structure struct paicrypt_map has a pointer to
-the event which is active for a particular CPU. This pointer is
-set in function paicrypt_start() to point to the currently installed
-event. There is no need to also set this pointer in function
-paicrypt_event_init() where is might be assigned to the wrong CPU.
-Therefore remove this assignment in paicrypt_event_init().
-
-Acked-by: Sumanth Korikkar <sumanthk@linux.ibm.com>
-Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
-Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
-Stable-dep-of: e9f3af02f639 ("s390/pai: fix sampling event removal for PMU device driver")
-Signed-off-by: Sasha Levin <sashal@kernel.org>
----
- arch/s390/kernel/perf_pai_crypto.c | 1 -
- 1 file changed, 1 deletion(-)
-
-diff --git a/arch/s390/kernel/perf_pai_crypto.c b/arch/s390/kernel/perf_pai_crypto.c
-index 0921cea849125..1ac74333a78dc 100644
---- a/arch/s390/kernel/perf_pai_crypto.c
-+++ b/arch/s390/kernel/perf_pai_crypto.c
-@@ -216,7 +216,6 @@ static int paicrypt_event_init(struct perf_event *event)
- * are active at the same time.
- */
- event->hw.last_tag = 0;
-- cpump->event = event;
- event->destroy = paicrypt_event_destroy;
-
- if (a->sample_period) {
---
-2.43.0
-
revert-alsa-emu10k1-fix-synthesizer-sample-playback-.patch
cifs-fix-caching-to-try-to-do-open-o_wronly-as-rdwr-.patch
spi-mchp-pci1xxx-fix-a-possible-null-pointer-derefer.patch
-s390-pai-initialize-event-count-once-at-initializati.patch
-s390-pai_crypto-remove-per-cpu-variable-assignement-.patch
-s390-pai-cleanup-event-initialization.patch
-s390-pai-rework-paixxx_start-and-paixxx_stop-functio.patch
-s390-pai-fix-sampling-event-removal-for-pmu-device-d.patch
ata-sata_mv-fix-pci-device-id-table-declaration-comp.patch
asoc-sof-amd-fix-for-false-dsp-interrupts.patch
sunrpc-fix-a-slow-server-side-memory-leak-with-rpc-o.patch