* [PATCH 1/2] EDAC/amd64: Convert PCIBIOS_* return codes to errnos
@ 2024-05-27 13:22 Ilpo Järvinen
2024-05-27 13:22 ` [PATCH 2/2] EDAC/igen6: " Ilpo Järvinen
2024-06-04 9:38 ` [PATCH 1/2] EDAC/amd64: " Borislav Petkov
0 siblings, 2 replies; 4+ messages in thread
From: Ilpo Järvinen @ 2024-05-27 13:22 UTC (permalink / raw)
To: Yazen Ghannam, Borislav Petkov, Tony Luck, James Morse,
Mauro Carvalho Chehab, Robert Richter, Muralidhara M K,
linux-edac, linux-kernel
Cc: Ilpo Järvinen, stable
gpu_get_node_map() uses pci_read_config_dword() that returns PCIBIOS_*
codes. The return code is then returned all the way into the module
init function amd64_edac_init() that returns it as is. The module init
functions, however, should return normal errnos.
Convert PCIBIOS_* returns code using pcibios_err_to_errno() into normal
errno before returning it from gpu_get_node_map().
For consistency, convert also the other similar cases which return
PCIBIOS_* codes even if they do not have any bugs at the moment.
Fixes: 4251566ebc1c ("EDAC/amd64: Cache and use GPU node map")
Cc: stable@vger.kernel.org
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
---
drivers/edac/amd64_edac.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/edac/amd64_edac.c b/drivers/edac/amd64_edac.c
index 1f3520d76861..a17f3c0cdfa6 100644
--- a/drivers/edac/amd64_edac.c
+++ b/drivers/edac/amd64_edac.c
@@ -81,7 +81,7 @@ int __amd64_read_pci_cfg_dword(struct pci_dev *pdev, int offset,
amd64_warn("%s: error reading F%dx%03x.\n",
func, PCI_FUNC(pdev->devfn), offset);
- return err;
+ return pcibios_err_to_errno(err);
}
int __amd64_write_pci_cfg_dword(struct pci_dev *pdev, int offset,
@@ -94,7 +94,7 @@ int __amd64_write_pci_cfg_dword(struct pci_dev *pdev, int offset,
amd64_warn("%s: error writing to F%dx%03x.\n",
func, PCI_FUNC(pdev->devfn), offset);
- return err;
+ return pcibios_err_to_errno(err);
}
/*
@@ -1025,8 +1025,10 @@ static int gpu_get_node_map(struct amd64_pvt *pvt)
}
ret = pci_read_config_dword(pdev, REG_LOCAL_NODE_TYPE_MAP, &tmp);
- if (ret)
+ if (ret) {
+ ret = pcibios_err_to_errno(ret);
goto out;
+ }
gpu_node_map.node_count = FIELD_GET(LNTM_NODE_COUNT, tmp);
gpu_node_map.base_node_id = FIELD_GET(LNTM_BASE_NODE_ID, tmp);
--
2.39.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] EDAC/igen6: Convert PCIBIOS_* return codes to errnos
2024-05-27 13:22 [PATCH 1/2] EDAC/amd64: Convert PCIBIOS_* return codes to errnos Ilpo Järvinen
@ 2024-05-27 13:22 ` Ilpo Järvinen
2024-06-04 2:39 ` Zhuo, Qiuxu
2024-06-04 9:38 ` [PATCH 1/2] EDAC/amd64: " Borislav Petkov
1 sibling, 1 reply; 4+ messages in thread
From: Ilpo Järvinen @ 2024-05-27 13:22 UTC (permalink / raw)
To: Tony Luck, Qiuxu Zhuo, Borislav Petkov, James Morse,
Mauro Carvalho Chehab, Robert Richter, linux-edac, linux-kernel
Cc: Ilpo Järvinen, stable
errcmd_enable_error_reporting() uses pci_{read,write}_config_word()
that return PCIBIOS_* codes. The return code is then returned all the
way into the probe function igen6_probe() that returns it as is. The
probe functions, however, should return normal errnos.
Convert PCIBIOS_* returns code using pcibios_err_to_errno() into normal
errno before returning it from errcmd_enable_error_reporting().
Fixes: 10590a9d4f23 ("EDAC/igen6: Add EDAC driver for Intel client SoCs using IBECC")
Cc: stable@vger.kernel.org
Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
---
drivers/edac/igen6_edac.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/edac/igen6_edac.c b/drivers/edac/igen6_edac.c
index cdd8480e7368..dbe9fe5f2ca6 100644
--- a/drivers/edac/igen6_edac.c
+++ b/drivers/edac/igen6_edac.c
@@ -800,7 +800,7 @@ static int errcmd_enable_error_reporting(bool enable)
rc = pci_read_config_word(imc->pdev, ERRCMD_OFFSET, &errcmd);
if (rc)
- return rc;
+ return pcibios_err_to_errno(rc);
if (enable)
errcmd |= ERRCMD_CE | ERRSTS_UE;
@@ -809,7 +809,7 @@ static int errcmd_enable_error_reporting(bool enable)
rc = pci_write_config_word(imc->pdev, ERRCMD_OFFSET, errcmd);
if (rc)
- return rc;
+ return pcibios_err_to_errno(rc);
return 0;
}
--
2.39.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* RE: [PATCH 2/2] EDAC/igen6: Convert PCIBIOS_* return codes to errnos
2024-05-27 13:22 ` [PATCH 2/2] EDAC/igen6: " Ilpo Järvinen
@ 2024-06-04 2:39 ` Zhuo, Qiuxu
0 siblings, 0 replies; 4+ messages in thread
From: Zhuo, Qiuxu @ 2024-06-04 2:39 UTC (permalink / raw)
To: Ilpo Järvinen, Luck, Tony, Borislav Petkov, James Morse,
Mauro Carvalho Chehab, Robert Richter, linux-edac@vger.kernel.org,
linux-kernel@vger.kernel.org
Cc: stable@vger.kernel.org
> From: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
> [...]
> Subject: [PATCH 2/2] EDAC/igen6: Convert PCIBIOS_* return codes to errnos
>
> errcmd_enable_error_reporting() uses pci_{read,write}_config_word() that
> return PCIBIOS_* codes. The return code is then returned all the way into the
> probe function igen6_probe() that returns it as is. The probe functions,
> however, should return normal errnos.
>
> Convert PCIBIOS_* returns code using pcibios_err_to_errno() into normal
> errno before returning it from errcmd_enable_error_reporting().
>
> Fixes: 10590a9d4f23 ("EDAC/igen6: Add EDAC driver for Intel client SoCs using
> IBECC")
> Cc: stable@vger.kernel.org
> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
> ---
> drivers/edac/igen6_edac.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/edac/igen6_edac.c b/drivers/edac/igen6_edac.c index
> cdd8480e7368..dbe9fe5f2ca6 100644
> --- a/drivers/edac/igen6_edac.c
> +++ b/drivers/edac/igen6_edac.c
> @@ -800,7 +800,7 @@ static int errcmd_enable_error_reporting(bool
> enable)
>
> rc = pci_read_config_word(imc->pdev, ERRCMD_OFFSET, &errcmd);
> if (rc)
> - return rc;
> + return pcibios_err_to_errno(rc);
>
> if (enable)
> errcmd |= ERRCMD_CE | ERRSTS_UE;
> @@ -809,7 +809,7 @@ static int errcmd_enable_error_reporting(bool
> enable)
>
> rc = pci_write_config_word(imc->pdev, ERRCMD_OFFSET, errcmd);
> if (rc)
> - return rc;
> + return pcibios_err_to_errno(rc);
>
> return 0;
> }
> --
> 2.39.2
Reviewed-by: Qiuxu Zhuo <qiuxu.zhuo@intel.com>
Thanks!
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] EDAC/amd64: Convert PCIBIOS_* return codes to errnos
2024-05-27 13:22 [PATCH 1/2] EDAC/amd64: Convert PCIBIOS_* return codes to errnos Ilpo Järvinen
2024-05-27 13:22 ` [PATCH 2/2] EDAC/igen6: " Ilpo Järvinen
@ 2024-06-04 9:38 ` Borislav Petkov
1 sibling, 0 replies; 4+ messages in thread
From: Borislav Petkov @ 2024-06-04 9:38 UTC (permalink / raw)
To: Ilpo Järvinen
Cc: Yazen Ghannam, Tony Luck, James Morse, Mauro Carvalho Chehab,
Robert Richter, Muralidhara M K, linux-edac, linux-kernel, stable
On Mon, May 27, 2024 at 04:22:34PM +0300, Ilpo Järvinen wrote:
> gpu_get_node_map() uses pci_read_config_dword() that returns PCIBIOS_*
> codes. The return code is then returned all the way into the module
> init function amd64_edac_init() that returns it as is. The module init
> functions, however, should return normal errnos.
...
Both queued.
Thx.
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-06-04 9:38 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-27 13:22 [PATCH 1/2] EDAC/amd64: Convert PCIBIOS_* return codes to errnos Ilpo Järvinen
2024-05-27 13:22 ` [PATCH 2/2] EDAC/igen6: " Ilpo Järvinen
2024-06-04 2:39 ` Zhuo, Qiuxu
2024-06-04 9:38 ` [PATCH 1/2] EDAC/amd64: " Borislav Petkov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox