Skip to content

Commit 5d2b978

Browse files
Mani-Sadhasivamkwilczynski
authored andcommitted
perf/dwc_pcie: Move common DWC struct definitions to 'pcie-dwc.h'
Move the common DWC struct definitions, which are shared across all the DesginWare PCIe IPs, to a new header file called 'pcie-dwc.h', so that other users e.g., debugfs, perf and sysfs can make use of them. Signed-off-by: Manivannan Sadhasivam <[email protected]> Signed-off-by: Shradha Todi <[email protected]> Reviewed-by: Shuai Xue <[email protected]> Reviewed-by: Fan Ni <[email protected]> Tested-by: Hrishikesh Deleep <[email protected]> Link: https://lore.kernel.org/r/[email protected] [kwilczynski: commit log, tidy up the new header file] Signed-off-by: Krzysztof Wilczyński <[email protected]>
1 parent 2014c95 commit 5d2b978

File tree

3 files changed

+38
-22
lines changed

3 files changed

+38
-22
lines changed

MAINTAINERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18123,6 +18123,7 @@ S: Maintained
1812318123
F: Documentation/devicetree/bindings/pci/snps,dw-pcie-ep.yaml
1812418124
F: Documentation/devicetree/bindings/pci/snps,dw-pcie.yaml
1812518125
F: drivers/pci/controller/dwc/*designware*
18126+
F: include/linux/pcie-dwc.h
1812618127

1812718128
PCI DRIVER FOR TI DRA7XX/J721E
1812818129
M: Vignesh Raghavendra <[email protected]>

drivers/perf/dwc_pcie_pmu.c

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include <linux/errno.h>
1414
#include <linux/kernel.h>
1515
#include <linux/list.h>
16+
#include <linux/pcie-dwc.h>
1617
#include <linux/perf_event.h>
1718
#include <linux/pci.h>
1819
#include <linux/platform_device.h>
@@ -99,26 +100,6 @@ struct dwc_pcie_dev_info {
99100
struct list_head dev_node;
100101
};
101102

102-
struct dwc_pcie_pmu_vsec_id {
103-
u16 vendor_id;
104-
u16 vsec_id;
105-
u8 vsec_rev;
106-
};
107-
108-
/*
109-
* VSEC IDs are allocated by the vendor, so a given ID may mean different
110-
* things to different vendors. See PCIe r6.0, sec 7.9.5.2.
111-
*/
112-
static const struct dwc_pcie_pmu_vsec_id dwc_pcie_pmu_vsec_ids[] = {
113-
{ .vendor_id = PCI_VENDOR_ID_ALIBABA,
114-
.vsec_id = 0x02, .vsec_rev = 0x4 },
115-
{ .vendor_id = PCI_VENDOR_ID_AMPERE,
116-
.vsec_id = 0x02, .vsec_rev = 0x4 },
117-
{ .vendor_id = PCI_VENDOR_ID_QCOM,
118-
.vsec_id = 0x02, .vsec_rev = 0x4 },
119-
{} /* terminator */
120-
};
121-
122103
static ssize_t cpumask_show(struct device *dev,
123104
struct device_attribute *attr,
124105
char *buf)
@@ -529,14 +510,14 @@ static void dwc_pcie_unregister_pmu(void *data)
529510

530511
static u16 dwc_pcie_des_cap(struct pci_dev *pdev)
531512
{
532-
const struct dwc_pcie_pmu_vsec_id *vid;
513+
const struct dwc_pcie_vsec_id *vid;
533514
u16 vsec;
534515
u32 val;
535516

536517
if (!pci_is_pcie(pdev) || !(pci_pcie_type(pdev) == PCI_EXP_TYPE_ROOT_PORT))
537518
return 0;
538519

539-
for (vid = dwc_pcie_pmu_vsec_ids; vid->vendor_id; vid++) {
520+
for (vid = dwc_pcie_rasdes_vsec_ids; vid->vendor_id; vid++) {
540521
vsec = pci_find_vsec_capability(pdev, vid->vendor_id,
541522
vid->vsec_id);
542523
if (vsec) {

include/linux/pcie-dwc.h

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/* SPDX-License-Identifier: GPL-2.0 */
2+
/*
3+
* Copyright (C) 2021-2023 Alibaba Inc.
4+
* Copyright (C) 2025 Linaro Ltd.
5+
*
6+
* Author: Manivannan Sadhasivam <[email protected]>
7+
*/
8+
9+
#ifndef LINUX_PCIE_DWC_H
10+
#define LINUX_PCIE_DWC_H
11+
12+
#include <linux/pci_ids.h>
13+
14+
struct dwc_pcie_vsec_id {
15+
u16 vendor_id;
16+
u16 vsec_id;
17+
u8 vsec_rev;
18+
};
19+
20+
/*
21+
* VSEC IDs are allocated by the vendor, so a given ID may mean different
22+
* things to different vendors. See PCIe r6.0, sec 7.9.5.2.
23+
*/
24+
static const struct dwc_pcie_vsec_id dwc_pcie_rasdes_vsec_ids[] = {
25+
{ .vendor_id = PCI_VENDOR_ID_ALIBABA,
26+
.vsec_id = 0x02, .vsec_rev = 0x4 },
27+
{ .vendor_id = PCI_VENDOR_ID_AMPERE,
28+
.vsec_id = 0x02, .vsec_rev = 0x4 },
29+
{ .vendor_id = PCI_VENDOR_ID_QCOM,
30+
.vsec_id = 0x02, .vsec_rev = 0x4 },
31+
{}
32+
};
33+
34+
#endif /* LINUX_PCIE_DWC_H */

0 commit comments

Comments
 (0)