Skip to contentSkip to conversation

intel_th: Fixes for v5.2

GIT PULL Alexander Shishkin 2 participants 9 messages Jun 21, 2019 – Jul 3, 2019

Subsystems (2)
lore
Share & tools
lore

Alexander Shishkin

author maintainer
#0 lore raw

Hi Greg,

Here are the fixes I have for v5.2 cycle: two gcc warnings, one dma mapping issue and a new PCI ID. All issues were introduced in the same cycle, so no -stable involvement.

All patches are aiaiai-clean. Signed git tag below. Individual patches in follow-up emails. Please consider pulling or applying. Thanks!

The following changes since commit a188339ca5a396acc588e5851ed7e19f66b0ebd9:

Linux 5.2-rc1 (2019-05-19 15:47:09 -0700)

are available in the Git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/ash/stm.git tags/intel_th-fixes-for-greg-20190621

for you to fetch changes up to 0001019cdade192cb05a3c4e07df3b30a20c8ed0:

intel_th: pci: Add Ice Lake NNPI support (2019-06-21 18:34:27 +0300)

----------------------------------------------------------------
intel_th: Fixes for v5.2

These are:
* two trivial fixes for gcc warnings introduced in v5.2-rc1
* a fix for a dma mapping problem, introduced in v5.2-rc1
* a new PCI ID

----------------------------------------------------------------
Alexander Shishkin (2):
intel_th: msu: Fix single mode with disabled IOMMU
intel_th: pci: Add Ice Lake NNPI support

Shaokun Zhang (1):
intel_th: msu: Fix unused variable warning on arm64 platform

YueHaibing (1):
intel_th: msu: Remove set but not used variable 'last'

 drivers/hwtracing/intel_th/msu.c | 45 ++++++++++++++++++++++++++--------------
 drivers/hwtracing/intel_th/pci.c |  5 +++++
 2 files changed, 34 insertions(+), 16 deletions(-)
Signature · 1 line
2.20.1
author maintainer
#1 lore raw

[GIT PULL 1/4] intel_th: msu: Fix unused variable warning on arm64 platform

From: Shaokun Zhang <[email protected]>

Commit ba39bd8306057 ("intel_th: msu: Switch over to scatterlist") introduced the following warnings on non-x86 architectures, as a result of reordering the multi mode buffer allocation sequence:

Quoted 10 lines

drivers/hwtracing/intel_th/msu.c: In function ‘msc_buffer_win_alloc’:
drivers/hwtracing/intel_th/msu.c:783:21: warning: unused variable ‘i’ [-Wunused-variable]

int ret = -ENOMEM, i;
                   ^
drivers/hwtracing/intel_th/msu.c: In function ‘msc_buffer_win_free’:
drivers/hwtracing/intel_th/msu.c:863:6: warning: unused variable ‘i’
[-Wunused-variable]
int i;
    ^

Fix this compiler warning by factoring out set_memory sequences and making them x86-only.

Fixes ba39bd8306057 ("intel_th: msu: Switch over to scatterlist")
---
 drivers/hwtracing/intel_th/msu.c | 40 +++++++++++++++++++++-----------
 1 file changed, 27 insertions(+), 13 deletions(-)
drivers/hwtracing/intel_th/msu.c +27 -13
index 81bb54fa3ce8..8c568b5c8920 100644
@@ -767,6 +767,30 @@ static int __msc_buffer_win_alloc(struct msc_window *win,
 	return -ENOMEM;
 }
 
+#ifdef CONFIG_X86
+static void msc_buffer_set_uc(struct msc_window *win, unsigned int nr_blocks)
+{
+	int i;
+
+	for (i = 0; i < nr_blocks; i++)
+		/* Set the page as uncached */
+		set_memory_uc((unsigned long)msc_win_block(win, i), 1);
+}
+
+static void msc_buffer_set_wb(struct msc_window *win)
+{
+	int i;
+
+	for (i = 0; i < win->nr_blocks; i++)
+		/* Reset the page to write-back */
+		set_memory_wb((unsigned long)msc_win_block(win, i), 1);
+}
+#else /* !X86 */
+static inline void
+msc_buffer_set_uc(struct msc_window *win, unsigned int nr_blocks) {}
+static inline void msc_buffer_set_wb(struct msc_window *win) {}
+#endif /* CONFIG_X86 */
+
 /**
  * msc_buffer_win_alloc() - alloc a window for a multiblock mode
  * @msc:	MSC device
@@ -780,7 +804,7 @@ static int __msc_buffer_win_alloc(struct msc_window *win,
 static int msc_buffer_win_alloc(struct msc *msc, unsigned int nr_blocks)
 {
 	struct msc_window *win;
-	int ret = -ENOMEM, i;
+	int ret = -ENOMEM;
 
 	if (!nr_blocks)
 		return 0;
@@ -811,11 +835,7 @@ static int msc_buffer_win_alloc(struct msc *msc, unsigned int nr_blocks)
 	if (ret < 0)
 		goto err_nomem;
 
-#ifdef CONFIG_X86
-	for (i = 0; i < ret; i++)
-		/* Set the page as uncached */
-		set_memory_uc((unsigned long)msc_win_block(win, i), 1);
-#endif
+	msc_buffer_set_uc(win, ret);
 
 	win->nr_blocks = ret;
 
@@ -860,8 +880,6 @@ static void __msc_buffer_win_free(struct msc *msc, struct msc_window *win)
  */
 static void msc_buffer_win_free(struct msc *msc, struct msc_window *win)
 {
-	int i;
-
 	msc->nr_pages -= win->nr_blocks;
 
 	list_del(&win->entry);
@@ -870,11 +888,7 @@ static void msc_buffer_win_free(struct msc *msc, struct msc_window *win)
 		msc->base_addr = 0;
 	}
 
-#ifdef CONFIG_X86
-	for (i = 0; i < win->nr_blocks; i++)
-		/* Reset the page to write-back */
-		set_memory_wb((unsigned long)msc_win_block(win, i), 1);
-#endif
+	msc_buffer_set_wb(win);
 
 	__msc_buffer_win_free(msc, win);
 
Signature · 1 line
2.20.1
author maintainer
#2 lore raw

[GIT PULL 3/4] intel_th: msu: Fix single mode with disabled IOMMU

In reply to Alexander Shishkin

Commit 4e0eaf239fb3 ("intel_th: msu: Fix single mode with IOMMU") switched the single mode code to use dma mapping pages obtained from the page allocator, but with IOMMU disabled, that may lead to using SWIOTLB bounce buffers and without additional sync'ing, produces empty trace buffers.

Fix this by using a DMA32 GFP flag to the page allocation in single mode, as the device supports full 32-bit DMA addressing.

Fixes 4e0eaf239fb3 ("intel_th: msu: Fix single mode with IOMMU")
---
 drivers/hwtracing/intel_th/msu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwtracing/intel_th/msu.c +1 -1
index 6bfce03c6489..cfd48c81b9d9 100644
@@ -667,7 +667,7 @@ static int msc_buffer_contig_alloc(struct msc *msc, unsigned long size)
 		goto err_out;
 
 	ret = -ENOMEM;
-	page = alloc_pages(GFP_KERNEL | __GFP_ZERO, order);
+	page = alloc_pages(GFP_KERNEL | __GFP_ZERO | GFP_DMA32, order);
 	if (!page)
 		goto err_free_sgt;
 
Signature · 1 line
2.20.1
#3 lore raw

Re: [GIT PULL 3/4] intel_th: msu: Fix single mode with disabled IOMMU

Quoted 8 lines · Alexander Shishkin

Commit 4e0eaf239fb3 ("intel_th: msu: Fix single mode with IOMMU") switched the single mode code to use dma mapping pages obtained from the page allocator, but with IOMMU disabled, that may lead to using SWIOTLB bounce buffers and without additional sync'ing, produces empty trace buffers.

Fix this by using a DMA32 GFP flag to the page allocation in single mode, as the device supports full 32-bit DMA addressing.

Quoted 7 lines
Fixes 4e0eaf239fb3 ("intel_th: msu: Fix single mode with IOMMU")
---
 drivers/hwtracing/intel_th/msu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

You should have had a stable tag on here anyway...

author maintainer
#4 lore raw

[GIT PULL 2/4] intel_th: msu: Remove set but not used variable 'last'

In reply to Alexander Shishkin

From: YueHaibing <[email protected]>

Commit aad14ad3cf3a ("intel_th: msu: Add current window tracking") added the following gcc warning:

Quoted 3 lines

drivers/hwtracing/intel_th/msu.c: In function msc_win_switch:
drivers/hwtracing/intel_th/msu.c:1389:21: warning: variable last set but not used [-Wunused-but-set-variable]

Fix it by removing the variable.

Fixes aad14ad3cf3a ("intel_th: msu: Add current window tracking")
---
 drivers/hwtracing/intel_th/msu.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/hwtracing/intel_th/msu.c +1 -2
index 8c568b5c8920..6bfce03c6489 100644
@@ -1400,10 +1400,9 @@ static int intel_th_msc_init(struct msc *msc)
 
 static void msc_win_switch(struct msc *msc)
 {
-	struct msc_window *last, *first;
+	struct msc_window *first;
 
 	first = list_first_entry(&msc->win_list, struct msc_window, entry);
-	last = list_last_entry(&msc->win_list, struct msc_window, entry);
 
 	if (msc_is_last_win(msc->cur_win))
 		msc->cur_win = first;
Signature · 1 line
2.20.1
author maintainer
#5 lore raw

[GIT PULL 4/4] intel_th: pci: Add Ice Lake NNPI support

In reply to Alexander Shishkin

This adds Ice Lake NNPI support to the Intel(R) Trace Hub.

---
 drivers/hwtracing/intel_th/pci.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/hwtracing/intel_th/pci.c +5 -0
index f1228708f2a2..c0378c3de9a4 100644
@@ -194,6 +194,11 @@ static const struct pci_device_id intel_th_pci_id_table[] = {
 		PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x02a6),
 		.driver_data = (kernel_ulong_t)&intel_th_2x,
 	},
+	{
+		/* Ice Lake NNPI */
+		PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x45c5),
+		.driver_data = (kernel_ulong_t)&intel_th_2x,
+	},
 	{ 0 },
 };
 
Signature · 1 line
2.20.1
author maintainer
#6 lore raw
In reply to Alexander Shishkin
Quoted 1 line · Alexander Shishkin

Hi Greg,

Hi Greg,

Quoted 6 lines

Here are the fixes I have for v5.2 cycle: two gcc warnings, one dma mapping issue and a new PCI ID. All issues were introduced in the same cycle, so no -stable involvement.

All patches are aiaiai-clean. Signed git tag below. Individual patches in follow-up emails. Please consider pulling or applying. Thanks!

Just in case this got buried under other email.

Thanks,
--
Alex

#7 lore raw
Quoted 6 lines · Alexander Shishkin
Quoted 1 line · Alexander Shishkin

Hi Greg,

Hi Greg,

Quoted 8 lines
Quoted 6 lines

Here are the fixes I have for v5.2 cycle: two gcc warnings, one dma mapping issue and a new PCI ID. All issues were introduced in the same cycle, so no -stable involvement.

All patches are aiaiai-clean. Signed git tag below. Individual patches in follow-up emails. Please consider pulling or applying. Thanks!

Just in case this got buried under other email.

It did, but it is in good company :)

thanks,

greg k-h

#8 lore raw
In reply to Alexander Shishkin
Quoted 11 lines · Alexander Shishkin

Hi Greg,

Here are the fixes I have for v5.2 cycle: two gcc warnings, one dma mapping issue and a new PCI ID. All issues were introduced in the same cycle, so no -stable involvement.

All patches are aiaiai-clean. Signed git tag below. Individual patches in follow-up emails. Please consider pulling or applying. Thanks!

The following changes since commit a188339ca5a396acc588e5851ed7e19f66b0ebd9:

Quoted 7 lines

Linux 5.2-rc1 (2019-05-19 15:47:09 -0700)

are available in the Git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/ash/stm.git tags/intel_th-fixes-for-greg-20190621

for you to fetch changes up to 0001019cdade192cb05a3c4e07df3b30a20c8ed0:

As it's too "late" for 5.2 (due to me traveling and the like), I'll just take this for 5.3-rc1 and add the proper stable tags so they get backported to 5.2.

thanks,

greg k-h