intel_th: Fixes for v5.19
Subsystems (2)
Alexander Shishkin
maintainercover intel_th: Fixes for v5.19
Hi Greg,
Here are a few fixes I have for v5.19, among which are 3 new PCI IDs. Andy provided his reviewed-bys. Please consider applying. Thanks!
Alexander Shishkin (4):
intel_th: msu: Fix vmalloced buffers
intel_th: pci: Add Meteor Lake-P support
intel_th: pci: Add Raptor Lake-S PCH support
intel_th: pci: Add Raptor Lake-S CPU support
Christophe JAILLET (1):
intel_th: Fix a resource leak in an error handling path
Jiasheng Jiang (1):
intel_th: msu-sink: Potential dereference of null pointer
drivers/hwtracing/intel_th/msu-sink.c | 3 +++ drivers/hwtracing/intel_th/msu.c | 14 ++++++++++++-- drivers/hwtracing/intel_th/pci.c | 25 +++++++++++++++++++++++-- 3 files changed, 38 insertions(+), 4 deletions(-)
Signature · 1 line
2.35.1
Alexander Shishkin
maintainerPATCH 1/6 intel_th: Fix a resource leak in an error handling path
From: Christophe JAILLET <[email protected]>
If an error occurs after calling 'pci_alloc_irq_vectors()', 'pci_free_irq_vectors()' must be called as already done in the remove function.
--- drivers/hwtracing/intel_th/pci.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
drivers/hwtracing/intel_th/pci.c +8 -2
@@ -100,8 +100,10 @@ static int intel_th_pci_probe(struct pci_dev *pdev, } th =intel_th_alloc (&pdev->dev, drvdata, resource, r); -if (IS_ERR (th)) -return PTR_ERR (th); +if (IS_ERR (th)) { + err =PTR_ERR (th); + goto err_free_irq; + } th->activate = intel_th_pci_activate; th->deactivate = intel_th_pci_deactivate;
@@ -109,6 +111,10 @@ static int intel_th_pci_probe(struct pci_dev *pdev,pci_set_master (pdev);return 0 ; + +err_free_irq: +pci_free_irq_vectors (pdev); +return err; }static void intel_th_pci_remove (struct pci_dev *pdev)
Signature · 1 line
2.35.1
Alexander Shishkin
maintainerPATCH 2/6 intel_th: msu-sink: Potential dereference of null pointer
In reply to Alexander ShishkinFrom: Jiasheng Jiang <[email protected]>
The return value of dma_alloc_coherent() needs to be checked. To avoid use of null pointer in sg_set_buf() in case of the failure of alloc.
--- drivers/hwtracing/intel_th/msu-sink.c | 3 +++ 1 file changed, 3 insertions(+)
drivers/hwtracing/intel_th/msu-sink.c +3 -0
@@ -71,6 +71,9 @@ static int msu_sink_alloc_window(void *data, struct sg_table **sgt, size_t size) block =dma_alloc_coherent (priv->dev->parent->parent,PAGE_SIZE , &sg_dma_address (sg_ptr),GFP_KERNEL ); +if (!block) +return -ENOMEM ; +sg_set_buf (sg_ptr, block,PAGE_SIZE ); }
Signature · 1 line
2.35.1
Alexander Shishkin
maintainerPATCH 3/6 intel_th: msu: Fix vmalloced buffers
In reply to Alexander ShishkinAfter commit f5ff79fddf0e ("dma-mapping: remove CONFIG_DMA_REMAP") there's a chance of DMA buffer getting allocated via vmalloc(), which messes up the mmapping code:
Quoted 5 lines
RIP: msc_mmap_fault [intel_th_msu] Call Trace: <TASK> __do_fault do_fault
...
Fix this by accounting for vmalloc possibility.
--- drivers/hwtracing/intel_th/msu.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-)
drivers/hwtracing/intel_th/msu.c +12 -2
@@ -1067,6 +1067,16 @@ msc_buffer_set_uc(struct msc *msc) {}static inline void msc_buffer_set_wb (struct msc *msc) {}#endif /* CONFIG_X86 */ +static struct page *msc_sg_page (struct scatterlist *sg) +{ +void *addr =sg_virt (sg); + +if (is_vmalloc_addr (addr)) +return vmalloc_to_page (addr); + +return sg_page (sg); +} +/** * msc_buffer_win_alloc() - alloc a window for a multiblock mode * @msc: MSC device
@@ -1137,7 +1147,7 @@ static void __msc_buffer_win_free(struct msc *msc, struct msc_window *win)int i;for_each_sg (win->sgt->sgl, sg, win->nr_segs, i) { -struct page *page =sg_page (sg); +struct page *page =msc_sg_page (sg); page->mapping =NULL ; dma_free_coherent(msc_dev(win->msc)->parent->parent, PAGE_SIZE,
@@ -1401,7 +1411,7 @@ static struct page *msc_buffer_get_page(struct msc *msc, unsigned long pgoff) pgoff -= win->pgoff;for_each_sg (win->sgt->sgl, sg, win->nr_segs, blk) { -struct page *page =sg_page (sg); +struct page *page =msc_sg_page (sg);size_t pgsz =PFN_DOWN (sg->length);if (pgoff < pgsz)
Signature · 1 line
2.35.1
Alexander Shishkin
maintainerPATCH 4/6 intel_th: pci: Add Meteor Lake-P support
In reply to Alexander ShishkinAdd support for the Trace Hub in Meteor Lake-P.
--- drivers/hwtracing/intel_th/pci.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/hwtracing/intel_th/pci.c +5 -0
@@ -284,6 +284,11 @@ static const struct pci_device_id intel_th_pci_id_table[] = { PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x54a6), .driver_data = (kernel_ulong_t)&intel_th_2x, }, + { +/* Meteor Lake-P */ +PCI_DEVICE (PCI_VENDOR_ID_INTEL ,0x7e24 ), + .driver_data = (kernel_ulong_t)&intel_th_2x, + }, {/* Alder Lake CPU */ PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x466f),
Signature · 1 line
2.35.1
Alexander Shishkin
maintainerPATCH 5/6 intel_th: pci: Add Raptor Lake-S PCH support
In reply to Alexander ShishkinAdd support for the Trace Hub in Raptor Lake-S PCH.
--- drivers/hwtracing/intel_th/pci.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/hwtracing/intel_th/pci.c +5 -0
@@ -289,6 +289,11 @@ static const struct pci_device_id intel_th_pci_id_table[] = { PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x7e24), .driver_data = (kernel_ulong_t)&intel_th_2x, }, + { +/* Raptor Lake-S */ +PCI_DEVICE (PCI_VENDOR_ID_INTEL ,0x7a26 ), + .driver_data = (kernel_ulong_t)&intel_th_2x, + }, {/* Alder Lake CPU */ PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x466f),
Signature · 1 line
2.35.1
Alexander Shishkin
maintainerPATCH 6/6 intel_th: pci: Add Raptor Lake-S CPU support
In reply to Alexander ShishkinAdd support for the Trace Hub in Raptor Lake-S CPU.
--- drivers/hwtracing/intel_th/pci.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/hwtracing/intel_th/pci.c +5 -0
@@ -294,6 +294,11 @@ static const struct pci_device_id intel_th_pci_id_table[] = { PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x7a26), .driver_data = (kernel_ulong_t)&intel_th_2x, }, + { +/* Raptor Lake-S CPU */ +PCI_DEVICE (PCI_VENDOR_ID_INTEL ,0xa76f ), + .driver_data = (kernel_ulong_t)&intel_th_2x, + }, {/* Alder Lake CPU */ PCI_DEVICE(PCI_VENDOR_ID_INTEL, 0x466f),
Signature · 1 line
2.35.1