From: Dongdong Liu <hidden> Date: 2021-06-13 09:30:24
10-Bit Tag capability, introduced in PCIe-4.0 increases the total Tag
field size from 8 bits to 10 bits.
This patchset is to enable 10-Bit tag for PCIe EP devices (include VF) and
RP devices.
V2->V3:
- Use cached Device Capabilities Register suggested by Christoph.
- Fix code style to avoid > 80 char lines.
- Renamve devcap2 to pcie_devcap2.
V1->V2: Fix some comments by Christoph.
- Store the devcap2 value in the pci_dev instead of reading it multiple
times.
- Change pci_info to pci_dbg to avoid the noisy log.
- Rename ext_10bit_tag_comp_path to ext_10bit_tag.
- Fix the compile error.
- Rebased on v5.13-rc1.
Dongdong Liu (6):
PCI: Use cached Device Capabilities Register
PCI: Use cached Device Capabilities 2 Register
PCI: Add 10-Bit Tag register definitions
PCI: Enable 10-Bit tag support for PCIe Endpoint devices
PCI/IOV: Enable 10-Bit tag support for PCIe VF devices
PCI: Enable 10-Bit tag support for PCIe RP devices
drivers/media/pci/cobalt/cobalt-driver.c | 4 +-
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | 4 +-
drivers/pci/iov.c | 8 +++
drivers/pci/pci.c | 13 ++---
drivers/pci/pcie/aspm.c | 11 ++--
drivers/pci/pcie/portdrv_pci.c | 75 +++++++++++++++++++++++++
drivers/pci/probe.c | 65 ++++++++++++++++-----
drivers/pci/quirks.c | 3 +-
include/linux/pci.h | 5 ++
include/uapi/linux/pci_regs.h | 5 ++
10 files changed, 156 insertions(+), 37 deletions(-)
--
2.7.4
From: Dongdong Liu <hidden> Date: 2021-06-13 09:30:24
10-Bit Tag capability, introduced in PCIe-4.0 increases the total Tag
field size from 8 bits to 10 bits.
For platforms where the RC supports 10-Bit Tag Completer capability,
it is highly recommended for platform firmware or operating software
that configures PCIe hierarchies to Set the 10-Bit Tag Requester Enable
bit automatically in Endpoints with 10-Bit Tag Requester capability. This
enables the important class of 10-Bit Tag capable adapters that send
Memory Read Requests only to host memory.
Signed-off-by: Dongdong Liu <redacted>
---
drivers/pci/probe.c | 36 ++++++++++++++++++++++++++++++++++++
include/linux/pci.h | 2 ++
2 files changed, 38 insertions(+)
From: Dongdong Liu <hidden> Date: 2021-06-13 09:30:24
Add 10-Bit Tag register definitions for use in subsequen patches.
See the PCIe 5.0 spec section 7.5.3.15 and 9.3.3.2.
Signed-off-by: Dongdong Liu <redacted>
---
include/uapi/linux/pci_regs.h | 5 +++++
1 file changed, 5 insertions(+)
From: Dongdong Liu <hidden> Date: 2021-06-13 09:30:24
It will make sense to store the pcie_devcap value in the pci_dev
structure instead of reading Device Capabilities Register multiple
times. The fisrt place to use pcie_devcap is in set_pcie_port_type(),
get the pcie_devcap value here, then use cached pcie_devcap in the
needed place.
Acked-by: Hans Verkuil <redacted>
Signed-off-by: Dongdong Liu <redacted>
---
drivers/media/pci/cobalt/cobalt-driver.c | 4 ++--
drivers/pci/pci.c | 5 +----
drivers/pci/pcie/aspm.c | 11 ++++-------
drivers/pci/probe.c | 11 +++--------
drivers/pci/quirks.c | 3 +--
include/linux/pci.h | 1 +
6 files changed, 12 insertions(+), 23 deletions(-)
@@ -831,8 +829,7 @@ static int pcie_aspm_sanity_check(struct pci_dev *pdev)*DisableASPMforpre-1.1PCIedevice,wefollowMStouse*RBERbittodetermineifafunctionis1.1versiondevice*/-pcie_capability_read_dword(child,PCI_EXP_DEVCAP,®32);-if(!(reg32&PCI_EXP_DEVCAP_RBER)&&!aspm_force){+if(!(child->pcie_devcap&PCI_EXP_DEVCAP_RBER)&&!aspm_force){pci_info(child,"disabling ASPM on pre-1.1 PCIe device. You can enable it with 'pcie_aspm=force'\n");return-EINVAL;}
From: Dongdong Liu <hidden> Date: 2021-06-13 09:30:25
PCIe spec 5.0r1.0 section 2.2.6.2 implementation note, In configurations
where a Requester with 10-Bit Tag Requester capability needs to target
multiple Completers, one needs to ensure that the Requester sends 10-Bit
Tag Requests only to Completers that have 10-Bit Tag Completer capability.
So we enable 10-Bit Tag Requester for root port only when the devices
under the root port support 10-Bit Tag Completer.
Signed-off-by: Dongdong Liu <redacted>
---
drivers/pci/pcie/portdrv_pci.c | 75 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 75 insertions(+)
@@ -90,6 +90,78 @@ static const struct dev_pm_ops pcie_portdrv_pm_ops = {#define PCIE_PORTDRV_PM_OPS NULL#endif /* !PM */+staticintpci_10bit_tag_comp_support(structpci_dev*dev,void*data)+{+u8*support=data;++if(*support==0)+return0;++if(!pci_is_pcie(dev)){+*support=0;+return0;+}++/*+*PCIespec5.0r1.0section2.2.6.2implementationnote.+*ForconfigurationswhereaRequesterwith10-BitTagRequester+*capabilitytargetsCompleterswheresomedoandsomedonothave+*10-BitTagCompletercapability,howtheRequesterdetermineswhich+*NPRsinclude10-BitTagsisoutsidethescopeofthisspecification.+*Sowedonotconsiderhotplugscenario.+*/+if(dev->is_hotplug_bridge){+*support=0;+return0;+}++if(!(dev->pcie_devcap2&PCI_EXP_DEVCAP2_10BIT_TAG_COMP)){+*support=0;+return0;+}++return0;+}++staticvoidpci_configure_rp_10bit_tag(structpci_dev*dev)+{+u8support=1;+structpci_dev*pchild;++if(dev->subordinate==NULL)+return;++/* If no devices under the root port, no need to enable 10-Bit Tag. */+pchild=list_first_entry_or_null(&dev->subordinate->devices,+structpci_dev,bus_list);+if(pchild==NULL)+return;++pci_10bit_tag_comp_support(dev,&support);+if(!support)+return;++/*+*PCIespec5.0r1.0section2.2.6.2implementationnote.+*InconfigurationswhereaRequesterwith10-BitTagRequester+*capabilityneedstotargetmultipleCompleters,oneneedstoensure+*thattheRequestersends10-BitTagRequestsonlytoCompleters+*thathave10-BitTagCompletercapability.Soweenable10-BitTag+*Requesterforrootportonlywhenthedevicesundertherootport+*support10-BitTagCompleter.+*/+pci_walk_bus(dev->subordinate,pci_10bit_tag_comp_support,&support);+if(!support)+return;++if(!(dev->pcie_devcap2&PCI_EXP_DEVCAP2_10BIT_TAG_REQ))+return;++pci_dbg(dev,"enabling 10-Bit Tag Requester\n");+pcie_capability_set_word(dev,PCI_EXP_DEVCTL2,+PCI_EXP_DEVCTL2_10BIT_TAG_REQ_EN);+}+/**pcie_portdrv_probe-ProbePCI-Expressportdevices*@dev:PCI-Expressportdevicebeingprobed
@@ -111,6 +183,9 @@ static int pcie_portdrv_probe(struct pci_dev *dev,(type!=PCI_EXP_TYPE_RC_EC)))return-ENODEV;+if(type==PCI_EXP_TYPE_ROOT_PORT)+pci_configure_rp_10bit_tag(dev);+if(type==PCI_EXP_TYPE_RC_EC)pcie_link_rcec(dev);
From: Dongdong Liu <hidden> Date: 2021-06-13 09:30:25
It will make sense to store the pcie_devcap2 value in the pci_dev
structure instead of reading Device Capabilities 2 Register multiple
times. Add pci_init_devcap2() to get the pcie_devcap2 value, then
use cached pcie_devcap2 in the needed place.
Signed-off-by: Dongdong Liu <redacted>
---
drivers/net/ethernet/chelsio/cxgb4/cxgb4_main.c | 4 +---
drivers/pci/pci.c | 8 +++-----
drivers/pci/probe.c | 18 ++++++++++++------
include/linux/pci.h | 2 ++
4 files changed, 18 insertions(+), 14 deletions(-)
@@ -6303,7 +6303,6 @@ static int cxgb4_iov_configure(struct pci_dev *pdev, int num_vfs)structpci_dev*pbridge;structport_info*pi;charname[IFNAMSIZ];-u32devcap2;u16flags;/* If we want to instantiate Virtual Functions, then our
@@ -6313,10 +6312,9 @@ static int cxgb4_iov_configure(struct pci_dev *pdev, int num_vfs)*/pbridge=pdev->bus->self;pcie_capability_read_word(pbridge,PCI_EXP_FLAGS,&flags);-pcie_capability_read_dword(pbridge,PCI_EXP_DEVCAP2,&devcap2);if((flags&PCI_EXP_FLAGS_VERS)<2||-!(devcap2&PCI_EXP_DEVCAP2_ARI)){+!(pbridge->pcie_devcap2&PCI_EXP_DEVCAP2_ARI)){/* Our parent bridge does not support ARI so issue a*warningandskipinstantiatingtheVFs.They*won'tbereachable.
@@ -3690,7 +3690,7 @@ int pci_enable_atomic_ops_to_root(struct pci_dev *dev, u32 cap_mask){structpci_bus*bus=dev->bus;structpci_dev*bridge;-u32cap,ctl2;+u32ctl2;if(!pci_is_pcie(dev))return-EINVAL;
@@ -3714,19 +3714,17 @@ int pci_enable_atomic_ops_to_root(struct pci_dev *dev, u32 cap_mask)while(bus->parent){bridge=bus->self;-pcie_capability_read_dword(bridge,PCI_EXP_DEVCAP2,&cap);-switch(pci_pcie_type(bridge)){/* Ensure switch ports support AtomicOp routing */casePCI_EXP_TYPE_UPSTREAM:casePCI_EXP_TYPE_DOWNSTREAM:-if(!(cap&PCI_EXP_DEVCAP2_ATOMIC_ROUTE))+if(!(bridge->pcie_devcap2&PCI_EXP_DEVCAP2_ATOMIC_ROUTE))return-EINVAL;break;/* Ensure root port supports all the sizes we care about */casePCI_EXP_TYPE_ROOT_PORT:-if((cap&cap_mask)!=cap_mask)+if((bridge->pcie_devcap2&cap_mask)!=cap_mask)return-EINVAL;break;}
From: Christoph Hellwig <hch@infradead.org> Date: 2021-06-14 05:43:05
On Sun, Jun 13, 2021 at 05:29:10PM +0800, Dongdong Liu wrote:
quoted hunk
It will make sense to store the pcie_devcap value in the pci_dev
structure instead of reading Device Capabilities Register multiple
times. The fisrt place to use pcie_devcap is in set_pcie_port_type(),
get the pcie_devcap value here, then use cached pcie_devcap in the
needed place.
Acked-by: Hans Verkuil <redacted>
Signed-off-by: Dongdong Liu <redacted>
---
drivers/media/pci/cobalt/cobalt-driver.c | 4 ++--
drivers/pci/pci.c | 5 +----
drivers/pci/pcie/aspm.c | 11 ++++-------
drivers/pci/probe.c | 11 +++--------
drivers/pci/quirks.c | 3 +--
include/linux/pci.h | 1 +
6 files changed, 12 insertions(+), 23 deletions(-)
From: Christoph Hellwig <hch@infradead.org> Date: 2021-06-14 05:58:14
On Sun, Jun 13, 2021 at 05:29:15PM +0800, Dongdong Liu wrote:
quoted hunk
PCIe spec 5.0r1.0 section 2.2.6.2 implementation note, In configurations
where a Requester with 10-Bit Tag Requester capability needs to target
multiple Completers, one needs to ensure that the Requester sends 10-Bit
Tag Requests only to Completers that have 10-Bit Tag Completer capability.
So we enable 10-Bit Tag Requester for root port only when the devices
under the root port support 10-Bit Tag Completer.
Signed-off-by: Dongdong Liu <redacted>
---
drivers/pci/pcie/portdrv_pci.c | 75 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 75 insertions(+)
@@ -90,6 +90,78 @@ static const struct dev_pm_ops pcie_portdrv_pm_ops = {#define PCIE_PORTDRV_PM_OPS NULL#endif /* !PM */+staticintpci_10bit_tag_comp_support(structpci_dev*dev,void*data)+{+u8*support=data;++if(*support==0)+return0;++if(!pci_is_pcie(dev)){+*support=0;+return0;+}++/*+*PCIespec5.0r1.0section2.2.6.2implementationnote.+*ForconfigurationswhereaRequesterwith10-BitTagRequester+*capabilitytargetsCompleterswheresomedoandsomedonothave+*10-BitTagCompletercapability,howtheRequesterdetermineswhich+*NPRsinclude10-BitTagsisoutsidethescopeofthisspecification.+*Sowedonotconsiderhotplugscenario.+*/+if(dev->is_hotplug_bridge){+*support=0;+return0;+}++if(!(dev->pcie_devcap2&PCI_EXP_DEVCAP2_10BIT_TAG_COMP)){+*support=0;+return0;+}++return0;+}++staticvoidpci_configure_rp_10bit_tag(structpci_dev*dev)+{+u8support=1;+structpci_dev*pchild;++if(dev->subordinate==NULL)+return;++/* If no devices under the root port, no need to enable 10-Bit Tag. */+pchild=list_first_entry_or_null(&dev->subordinate->devices,+structpci_dev,bus_list);+if(pchild==NULL)+return;
pchild is never used after this check, so this could be simplified to
a list_empty(&dev->subordinate->devices).
From: Dongdong Liu <hidden> Date: 2021-06-15 03:03:41
On 2021/6/14 13:42, Christoph Hellwig wrote:
On Sun, Jun 13, 2021 at 05:29:10PM +0800, Dongdong Liu wrote:
quoted
It will make sense to store the pcie_devcap value in the pci_dev
structure instead of reading Device Capabilities Register multiple
times. The fisrt place to use pcie_devcap is in set_pcie_port_type(),
get the pcie_devcap value here, then use cached pcie_devcap in the
needed place.
Acked-by: Hans Verkuil <redacted>
Signed-off-by: Dongdong Liu <redacted>
---
drivers/media/pci/cobalt/cobalt-driver.c | 4 ++--
drivers/pci/pci.c | 5 +----
drivers/pci/pcie/aspm.c | 11 ++++-------
drivers/pci/probe.c | 11 +++--------
drivers/pci/quirks.c | 3 +--
include/linux/pci.h | 1 +
6 files changed, 12 insertions(+), 23 deletions(-)
From: Dongdong Liu <hidden> Date: 2021-06-15 03:08:12
On 2021/6/14 13:57, Christoph Hellwig wrote:
On Sun, Jun 13, 2021 at 05:29:15PM +0800, Dongdong Liu wrote:
quoted
PCIe spec 5.0r1.0 section 2.2.6.2 implementation note, In configurations
where a Requester with 10-Bit Tag Requester capability needs to target
multiple Completers, one needs to ensure that the Requester sends 10-Bit
Tag Requests only to Completers that have 10-Bit Tag Completer capability.
So we enable 10-Bit Tag Requester for root port only when the devices
under the root port support 10-Bit Tag Completer.
Signed-off-by: Dongdong Liu <redacted>
---
drivers/pci/pcie/portdrv_pci.c | 75 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 75 insertions(+)
@@ -90,6 +90,78 @@ static const struct dev_pm_ops pcie_portdrv_pm_ops = {#define PCIE_PORTDRV_PM_OPS NULL#endif /* !PM */+staticintpci_10bit_tag_comp_support(structpci_dev*dev,void*data)+{+u8*support=data;++if(*support==0)+return0;++if(!pci_is_pcie(dev)){+*support=0;+return0;+}++/*+*PCIespec5.0r1.0section2.2.6.2implementationnote.+*ForconfigurationswhereaRequesterwith10-BitTagRequester+*capabilitytargetsCompleterswheresomedoandsomedonothave+*10-BitTagCompletercapability,howtheRequesterdetermineswhich+*NPRsinclude10-BitTagsisoutsidethescopeofthisspecification.+*Sowedonotconsiderhotplugscenario.+*/+if(dev->is_hotplug_bridge){+*support=0;+return0;+}++if(!(dev->pcie_devcap2&PCI_EXP_DEVCAP2_10BIT_TAG_COMP)){+*support=0;+return0;+}++return0;+}++staticvoidpci_configure_rp_10bit_tag(structpci_dev*dev)+{+u8support=1;+structpci_dev*pchild;++if(dev->subordinate==NULL)+return;++/* If no devices under the root port, no need to enable 10-Bit Tag. */+pchild=list_first_entry_or_null(&dev->subordinate->devices,+structpci_dev,bus_list);+if(pchild==NULL)+return;
pchild is never used after this check, so this could be simplified to
a list_empty(&dev->subordinate->devices).
From: kernel test robot <hidden> Date: 2021-06-18 14:52:19
Hi Dongdong,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on pci/next]
[also build test WARNING on linuxtv-media/master linus/master v5.13-rc6 next-20210618]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Dongdong-Liu/PCI-Enable-10-Bit-tag-support-for-PCIe-devices/20210617-041115
base: https://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git next
config: s390-randconfig-r032-20210618 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 64720f57bea6a6bf033feef4a5751ab9c0c3b401)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install s390 cross compiling tool for clang build
# apt-get install binutils-s390x-linux-gnu
# https://github.com/0day-ci/linux/commit/caefa7e6d0209bc08eb1934b58dae3aaa0b9dbba
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Dongdong-Liu/PCI-Enable-10-Bit-tag-support-for-PCIe-devices/20210617-041115
git checkout caefa7e6d0209bc08eb1934b58dae3aaa0b9dbba
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=s390
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <redacted>
All warnings (new ones prefixed by >>):
In file included from drivers/media/pci/cobalt/cobalt-driver.c:18:
In file included from drivers/media/pci/cobalt/cobalt-driver.h:16:
In file included from include/linux/pci.h:39:
In file included from include/linux/io.h:13:
In file included from arch/s390/include/asm/io.h:75:
include/asm-generic/io.h:464:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
val = __raw_readb(PCI_IOBASE + addr);
~~~~~~~~~~ ^
include/asm-generic/io.h:477:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
val = __le16_to_cpu((__le16 __force)__raw_readw(PCI_IOBASE + addr));
~~~~~~~~~~ ^
include/uapi/linux/byteorder/big_endian.h:36:59: note: expanded from macro '__le16_to_cpu'
#define __le16_to_cpu(x) __swab16((__force __u16)(__le16)(x))
^
include/uapi/linux/swab.h:102:54: note: expanded from macro '__swab16'
#define __swab16(x) (__u16)__builtin_bswap16((__u16)(x))
^
In file included from drivers/media/pci/cobalt/cobalt-driver.c:18:
In file included from drivers/media/pci/cobalt/cobalt-driver.h:16:
In file included from include/linux/pci.h:39:
In file included from include/linux/io.h:13:
In file included from arch/s390/include/asm/io.h:75:
include/asm-generic/io.h:490:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr));
~~~~~~~~~~ ^
include/uapi/linux/byteorder/big_endian.h:34:59: note: expanded from macro '__le32_to_cpu'
#define __le32_to_cpu(x) __swab32((__force __u32)(__le32)(x))
^
include/uapi/linux/swab.h:115:54: note: expanded from macro '__swab32'
#define __swab32(x) (__u32)__builtin_bswap32((__u32)(x))
^
In file included from drivers/media/pci/cobalt/cobalt-driver.c:18:
In file included from drivers/media/pci/cobalt/cobalt-driver.h:16:
In file included from include/linux/pci.h:39:
In file included from include/linux/io.h:13:
In file included from arch/s390/include/asm/io.h:75:
include/asm-generic/io.h:501:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
__raw_writeb(value, PCI_IOBASE + addr);
~~~~~~~~~~ ^
include/asm-generic/io.h:511:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
__raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr);
~~~~~~~~~~ ^
include/asm-generic/io.h:521:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
__raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr);
~~~~~~~~~~ ^
include/asm-generic/io.h:609:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
readsb(PCI_IOBASE + addr, buffer, count);
~~~~~~~~~~ ^
include/asm-generic/io.h:617:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
readsw(PCI_IOBASE + addr, buffer, count);
~~~~~~~~~~ ^
include/asm-generic/io.h:625:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
readsl(PCI_IOBASE + addr, buffer, count);
~~~~~~~~~~ ^
include/asm-generic/io.h:634:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
writesb(PCI_IOBASE + addr, buffer, count);
~~~~~~~~~~ ^
include/asm-generic/io.h:643:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
writesw(PCI_IOBASE + addr, buffer, count);
~~~~~~~~~~ ^
include/asm-generic/io.h:652:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
writesl(PCI_IOBASE + addr, buffer, count);
~~~~~~~~~~ ^
quoted
drivers/media/pci/cobalt/cobalt-driver.c:199:7: warning: variable 'capa' is uninitialized when used here [-Wuninitialized]
capa,
^~~~
drivers/media/pci/cobalt/cobalt-driver.h:160:71: note: expanded from macro 'cobalt_info'
#define cobalt_info(fmt, arg...) v4l2_info(&cobalt->v4l2_dev, fmt, ## arg)
^~~
include/media/v4l2-common.h:67:39: note: expanded from macro 'v4l2_info'
v4l2_printk(KERN_INFO, dev, fmt , ## arg)
^~~
include/media/v4l2-common.h:58:44: note: expanded from macro 'v4l2_printk'
printk(level "%s: " fmt, (dev)->name , ## arg)
^~~
drivers/media/pci/cobalt/cobalt-driver.c:189:10: note: initialize the variable 'capa' to silence this warning
u32 capa;
^
= 0
13 warnings generated.
vim +/capa +199 drivers/media/pci/cobalt/cobalt-driver.c
184
185 void cobalt_pcie_status_show(struct cobalt *cobalt)
186 {
187 struct pci_dev *pci_dev = cobalt->pci_dev;
188 struct pci_dev *pci_bus_dev = cobalt->pci_dev->bus->self;
189 u32 capa;
190 u16 stat, ctrl;
191
192 if (!pci_is_pcie(pci_dev) || !pci_is_pcie(pci_bus_dev))
193 return;
194
195 /* Device */
196 pcie_capability_read_word(pci_dev, PCI_EXP_DEVCTL, &ctrl);
197 pcie_capability_read_word(pci_dev, PCI_EXP_DEVSTA, &stat);
198 cobalt_info("PCIe device capability 0x%08x: Max payload %d\n",
> 199 capa,
200 get_payload_size(pci_dev->pcie_devcap & PCI_EXP_DEVCAP_PAYLOAD));
201 cobalt_info("PCIe device control 0x%04x: Max payload %d. Max read request %d\n",
202 ctrl,
203 get_payload_size((ctrl & PCI_EXP_DEVCTL_PAYLOAD) >> 5),
204 get_payload_size((ctrl & PCI_EXP_DEVCTL_READRQ) >> 12));
205 cobalt_info("PCIe device status 0x%04x\n", stat);
206
207 /* Link */
208 pcie_capability_read_dword(pci_dev, PCI_EXP_LNKCAP, &capa);
209 pcie_capability_read_word(pci_dev, PCI_EXP_LNKCTL, &ctrl);
210 pcie_capability_read_word(pci_dev, PCI_EXP_LNKSTA, &stat);
211 cobalt_info("PCIe link capability 0x%08x: %s per lane and %u lanes\n",
212 capa, get_link_speed(capa),
213 (capa & PCI_EXP_LNKCAP_MLW) >> 4);
214 cobalt_info("PCIe link control 0x%04x\n", ctrl);
215 cobalt_info("PCIe link status 0x%04x: %s per lane and %u lanes\n",
216 stat, get_link_speed(stat),
217 (stat & PCI_EXP_LNKSTA_NLW) >> 4);
218
219 /* Bus */
220 pcie_capability_read_dword(pci_bus_dev, PCI_EXP_LNKCAP, &capa);
221 cobalt_info("PCIe bus link capability 0x%08x: %s per lane and %u lanes\n",
222 capa, get_link_speed(capa),
223 (capa & PCI_EXP_LNKCAP_MLW) >> 4);
224
225 /* Slot */
226 pcie_capability_read_dword(pci_dev, PCI_EXP_SLTCAP, &capa);
227 pcie_capability_read_word(pci_dev, PCI_EXP_SLTCTL, &ctrl);
228 pcie_capability_read_word(pci_dev, PCI_EXP_SLTSTA, &stat);
229 cobalt_info("PCIe slot capability 0x%08x\n", capa);
230 cobalt_info("PCIe slot control 0x%04x\n", ctrl);
231 cobalt_info("PCIe slot status 0x%04x\n", stat);
232 }
233
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
From: Dongdong Liu <hidden> Date: 2021-06-21 07:18:37
On 2021/6/18 22:51, kernel test robot wrote:
Hi Dongdong,
Thank you for the patch! Perhaps something to improve:
[auto build test WARNING on pci/next]
[also build test WARNING on linuxtv-media/master linus/master v5.13-rc6 next-20210618]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Dongdong-Liu/PCI-Enable-10-Bit-tag-support-for-PCIe-devices/20210617-041115
base: https://git.kernel.org/pub/scm/linux/kernel/git/helgaas/pci.git next
config: s390-randconfig-r032-20210618 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 64720f57bea6a6bf033feef4a5751ab9c0c3b401)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install s390 cross compiling tool for clang build
# apt-get install binutils-s390x-linux-gnu
# https://github.com/0day-ci/linux/commit/caefa7e6d0209bc08eb1934b58dae3aaa0b9dbba
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Dongdong-Liu/PCI-Enable-10-Bit-tag-support-for-PCIe-devices/20210617-041115
git checkout caefa7e6d0209bc08eb1934b58dae3aaa0b9dbba
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=s390
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <redacted>
All warnings (new ones prefixed by >>):
In file included from drivers/media/pci/cobalt/cobalt-driver.c:18:
In file included from drivers/media/pci/cobalt/cobalt-driver.h:16:
In file included from include/linux/pci.h:39:
In file included from include/linux/io.h:13:
In file included from arch/s390/include/asm/io.h:75:
include/asm-generic/io.h:464:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
val = __raw_readb(PCI_IOBASE + addr);
~~~~~~~~~~ ^
include/asm-generic/io.h:477:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
val = __le16_to_cpu((__le16 __force)__raw_readw(PCI_IOBASE + addr));
~~~~~~~~~~ ^
include/uapi/linux/byteorder/big_endian.h:36:59: note: expanded from macro '__le16_to_cpu'
#define __le16_to_cpu(x) __swab16((__force __u16)(__le16)(x))
^
include/uapi/linux/swab.h:102:54: note: expanded from macro '__swab16'
#define __swab16(x) (__u16)__builtin_bswap16((__u16)(x))
^
In file included from drivers/media/pci/cobalt/cobalt-driver.c:18:
In file included from drivers/media/pci/cobalt/cobalt-driver.h:16:
In file included from include/linux/pci.h:39:
In file included from include/linux/io.h:13:
In file included from arch/s390/include/asm/io.h:75:
include/asm-generic/io.h:490:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr));
~~~~~~~~~~ ^
include/uapi/linux/byteorder/big_endian.h:34:59: note: expanded from macro '__le32_to_cpu'
#define __le32_to_cpu(x) __swab32((__force __u32)(__le32)(x))
^
include/uapi/linux/swab.h:115:54: note: expanded from macro '__swab32'
#define __swab32(x) (__u32)__builtin_bswap32((__u32)(x))
^
In file included from drivers/media/pci/cobalt/cobalt-driver.c:18:
In file included from drivers/media/pci/cobalt/cobalt-driver.h:16:
In file included from include/linux/pci.h:39:
In file included from include/linux/io.h:13:
In file included from arch/s390/include/asm/io.h:75:
include/asm-generic/io.h:501:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
__raw_writeb(value, PCI_IOBASE + addr);
~~~~~~~~~~ ^
include/asm-generic/io.h:511:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
__raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr);
~~~~~~~~~~ ^
include/asm-generic/io.h:521:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
__raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr);
~~~~~~~~~~ ^
include/asm-generic/io.h:609:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
readsb(PCI_IOBASE + addr, buffer, count);
~~~~~~~~~~ ^
include/asm-generic/io.h:617:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
readsw(PCI_IOBASE + addr, buffer, count);
~~~~~~~~~~ ^
include/asm-generic/io.h:625:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
readsl(PCI_IOBASE + addr, buffer, count);
~~~~~~~~~~ ^
include/asm-generic/io.h:634:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
writesb(PCI_IOBASE + addr, buffer, count);
~~~~~~~~~~ ^
include/asm-generic/io.h:643:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
writesw(PCI_IOBASE + addr, buffer, count);
~~~~~~~~~~ ^
include/asm-generic/io.h:652:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
writesl(PCI_IOBASE + addr, buffer, count);
~~~~~~~~~~ ^
quoted
quoted
drivers/media/pci/cobalt/cobalt-driver.c:199:7: warning: variable 'capa' is uninitialized when used here [-Wuninitialized]