All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] PCI/VPD: Silence warning if optional VPD PROM is missing
@ 2021-04-01 12:03 Heiner Kallweit
  2021-04-01 18:57 ` Bjorn Helgaas
  0 siblings, 1 reply; 2+ messages in thread
From: Heiner Kallweit @ 2021-04-01 12:03 UTC (permalink / raw)
  To: Bjorn Helgaas; +Cc: linux-pci

Realtek RTL8169/8168/8125 NIC families indicate VPD capability and an
optional VPD EEPROM can be connected via I2C/SPI. However I haven't
seen any card or system with such a VPD EEPROM yet. The missing EEPROM
causes the following warning whenever e.g. lscpi -vv is executed.

invalid short VPD tag 00 at offset 01

The warning confuses users, I think we should handle the situation more
gentle. Therefore, if first VPD byte is read as 0x00, assume a missing
optional VPD PROM and replace the warning with a more descriptive
message at info level.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
v2: - don't remove user info completely, replace the warning with a more
      message at info level
---
 drivers/pci/vpd.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/pci/vpd.c b/drivers/pci/vpd.c
index d1cbc5e64..48f4a9ae8 100644
--- a/drivers/pci/vpd.c
+++ b/drivers/pci/vpd.c
@@ -74,6 +74,11 @@ static size_t pci_vpd_size(struct pci_dev *dev, size_t old_size)
 	       pci_read_vpd(dev, off, 1, header) == 1) {
 		unsigned char tag;
 
+		if (!header[0] && !off) {
+			pci_info(dev, "Invalid VPD tag 00, assume missing optional VPD EPROM\n");
+			return 0;
+		}
+
 		if (header[0] & PCI_VPD_LRDT) {
 			/* Large Resource Data Type Tag */
 			tag = pci_vpd_lrdt_tag(header);
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] PCI/VPD: Silence warning if optional VPD PROM is missing
  2021-04-01 12:03 [PATCH v2] PCI/VPD: Silence warning if optional VPD PROM is missing Heiner Kallweit
@ 2021-04-01 18:57 ` Bjorn Helgaas
  0 siblings, 0 replies; 2+ messages in thread
From: Bjorn Helgaas @ 2021-04-01 18:57 UTC (permalink / raw)
  To: Heiner Kallweit; +Cc: Bjorn Helgaas, linux-pci

On Thu, Apr 01, 2021 at 02:03:49PM +0200, Heiner Kallweit wrote:
> Realtek RTL8169/8168/8125 NIC families indicate VPD capability and an
> optional VPD EEPROM can be connected via I2C/SPI. However I haven't
> seen any card or system with such a VPD EEPROM yet. The missing EEPROM
> causes the following warning whenever e.g. lscpi -vv is executed.
> 
> invalid short VPD tag 00 at offset 01
> 
> The warning confuses users, I think we should handle the situation more
> gentle. Therefore, if first VPD byte is read as 0x00, assume a missing
> optional VPD PROM and replace the warning with a more descriptive
> message at info level.
> 
> Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>

Looks perfect, applied to pci/vpd for v5.13, thanks!

> ---
> v2: - don't remove user info completely, replace the warning with a more
>       message at info level
> ---
>  drivers/pci/vpd.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/pci/vpd.c b/drivers/pci/vpd.c
> index d1cbc5e64..48f4a9ae8 100644
> --- a/drivers/pci/vpd.c
> +++ b/drivers/pci/vpd.c
> @@ -74,6 +74,11 @@ static size_t pci_vpd_size(struct pci_dev *dev, size_t old_size)
>  	       pci_read_vpd(dev, off, 1, header) == 1) {
>  		unsigned char tag;
>  
> +		if (!header[0] && !off) {
> +			pci_info(dev, "Invalid VPD tag 00, assume missing optional VPD EPROM\n");
> +			return 0;
> +		}
> +
>  		if (header[0] & PCI_VPD_LRDT) {
>  			/* Large Resource Data Type Tag */
>  			tag = pci_vpd_lrdt_tag(header);
> -- 
> 2.31.1
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-04-01 19:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-01 12:03 [PATCH v2] PCI/VPD: Silence warning if optional VPD PROM is missing Heiner Kallweit
2021-04-01 18:57 ` Bjorn Helgaas

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.