* Re: [PATCH] cxl/pci: Remove incorrect mbox.valid check in cxl_pci_type3_init_mailbox()
[not found] <20260618170356.25382-1-wei.hou@scaleflux.com>
@ 2026-06-25 8:10 ` Richard Cheng
2026-06-28 15:58 ` [PATCH v2] " Wei Hou
1 sibling, 0 replies; 4+ messages in thread
From: Richard Cheng @ 2026-06-25 8:10 UTC (permalink / raw)
To: Wei Hou
Cc: Dave Jiang, linux-cxl, Davidlohr Bueso, Jonathan Cameron,
Dan Williams, alison.schofield, vishal.l.verma, iweiny, ming.li,
linux-kernel, kobak, kaihengf, newtonl, kristinc, mochs,
danwilliams
On Fri, Jun 19, 2026 at 01:03:56AM +0800, Wei Hou wrote:
> The driver's design intent is that missing or malformed component
> registers should not prevent mailbox initialization. cxl_pci_probe()
> already reflects this: the CXL_REGLOC_RBI_COMPONENT setup path only
> emits a dev_warn() and continues when component registers are absent,
> rather than returning an error.
>
> The check 'if (!cxlds->reg_map.device_map.mbox.valid)' violates this
> intent and is also technically incorrect for two reasons:
>
> 1. Wrong struct: the MEMDEV register block is enumerated into a local
> variable 'map', not into 'cxlds->reg_map'. The device_map.mbox.valid
> field inside cxlds->reg_map is never written by the MEMDEV probe and
> will always read as zero regardless of actual hardware capability.
>
> 2. Already validated: cxl_pci_setup_regs(CXL_REGLOC_RBI_MEMDEV) calls
> cxl_probe_regs() which explicitly checks mbox.valid and returns
> -ENXIO if the mailbox is absent. If that check passes, the mailbox is
> guaranteed to be present by the time cxl_pci_type3_init_mailbox() is
> called.
>
> The value that the check actually reads is component_map.ras.valid,
> which aliases device_map.mbox.valid in the union. This is populated by
> the COMPONENT probe, not the MEMDEV probe. On devices where the
> component register BAR does not implement a CXL Component Capability
> Array (e.g. certain DCD devices), cxl_probe_component_regs() returns
> early leaving ras.valid=false. Through the union, this makes mbox.valid
> read as false, causing cxl_pci_type3_init_mailbox() to return -ENODEV
> (-19) even though the mailbox hardware is fully functional.
>
> Remove the check. Mailbox presence has already been validated by
> cxl_pci_setup_regs(CXL_REGLOC_RBI_MEMDEV). The presence or absence of
> component registers is irrelevant to mailbox initialization.
>
> Signed-off-by: Wei Hou <wei.hou@scaleflux.com>
> ---
> drivers/cxl/pci.c | 6 ------
> 1 file changed, 6 deletions(-)
>
> diff --git a/drivers/cxl/pci.c b/drivers/cxl/pci.c
> index bace662dc988..e44e5d209900 100644
> --- a/drivers/cxl/pci.c
> +++ b/drivers/cxl/pci.c
> @@ -691,12 +691,6 @@ static int cxl_pci_type3_init_mailbox(struct cxl_dev_state *cxlds)
> {
> int rc;
>
> - /*
> - * Fail the init if there's no mailbox. For a type3 this is out of spec.
> - */
> - if (!cxlds->reg_map.device_map.mbox.valid)
> - return -ENODEV;
> -
> rc = cxl_mailbox_init(&cxlds->cxl_mbox, cxlds->dev);
> if (rc)
> return rc;
> --
> 2.24.1
>
>
Btw,
You missed to sent this one to many people, I'll add them this time for you
--Richard
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v2] cxl/pci: Remove incorrect mbox.valid check in cxl_pci_type3_init_mailbox()
[not found] <20260618170356.25382-1-wei.hou@scaleflux.com>
2026-06-25 8:10 ` [PATCH] cxl/pci: Remove incorrect mbox.valid check in cxl_pci_type3_init_mailbox() Richard Cheng
@ 2026-06-28 15:58 ` Wei Hou
2026-06-29 5:10 ` Li Ming
2026-06-29 16:32 ` Dave Jiang
1 sibling, 2 replies; 4+ messages in thread
From: Wei Hou @ 2026-06-28 15:58 UTC (permalink / raw)
To: Dave Jiang, Dan Williams
Cc: linux-cxl, Davidlohr Bueso, Jonathan Cameron, Alison Schofield,
Vishal Verma, Ira Weiny, Ming Li, linux-kernel, Kobayashi,
Kaiheng Feng, Newton Liu, Kristin Chen, Mochs, Dan Williams,
Richard Cheng, Wei Hou
The driver's design intent is that missing or malformed component
registers should not prevent mailbox initialization. cxl_pci_probe()
already reflects this: the CXL_REGLOC_RBI_COMPONENT setup path only
emits a dev_warn() and continues when component registers are absent,
rather than returning an error.
The check 'if (!cxlds->reg_map.device_map.mbox.valid)' violates this
intent and is also technically incorrect for two reasons:
1. Wrong struct: the MEMDEV register block is enumerated into a local
variable 'map', not into 'cxlds->reg_map'. The device_map.mbox.valid
field inside cxlds->reg_map is never written by the MEMDEV probe and
will always read as zero regardless of actual hardware capability.
2. Already validated: cxl_pci_setup_regs(CXL_REGLOC_RBI_MEMDEV) calls
cxl_probe_regs() which explicitly checks mbox.valid and returns
-ENXIO if the mailbox is absent. If that check passes, the mailbox is
guaranteed to be present by the time cxl_pci_type3_init_mailbox() is
called.
The value that the check actually reads is component_map.ras.valid,
which aliases device_map.mbox.valid in the union. This is populated by
the COMPONENT probe, not the MEMDEV probe. On devices where the
component register BAR does not implement a CXL Component Capability
Array (e.g. certain DCD devices), cxl_probe_component_regs() returns
early leaving ras.valid=false. Through the union, this makes mbox.valid
read as false, causing cxl_pci_type3_init_mailbox() to return -ENODEV
(-19) even though the mailbox hardware is fully functional.
Remove the check. Mailbox presence has already been validated by
cxl_pci_setup_regs(CXL_REGLOC_RBI_MEMDEV). The presence or absence of
component registers is irrelevant to mailbox initialization.
Fixes: 8d8081cecfb9 ("cxl: Move mailbox related bits to the same context")
Reviewed-by: Richard Cheng <icheng@nvidia.com>
Signed-off-by: Wei Hou <wei.hou@scaleflux.com>
---
drivers/cxl/pci.c | 6 ------
1 file changed, 6 deletions(-)
diff --git a/drivers/cxl/pci.c b/drivers/cxl/pci.c
index bace662dc988..e44e5d209900 100644
--- a/drivers/cxl/pci.c
+++ b/drivers/cxl/pci.c
@@ -691,12 +691,6 @@ static int cxl_pci_type3_init_mailbox(struct cxl_dev_state *cxlds)
{
int rc;
- /*
- * Fail the init if there's no mailbox. For a type3 this is out of spec.
- */
- if (!cxlds->reg_map.device_map.mbox.valid)
- return -ENODEV;
-
rc = cxl_mailbox_init(&cxlds->cxl_mbox, cxlds->dev);
if (rc)
return rc;
--
2.43.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] cxl/pci: Remove incorrect mbox.valid check in cxl_pci_type3_init_mailbox()
2026-06-28 15:58 ` [PATCH v2] " Wei Hou
@ 2026-06-29 5:10 ` Li Ming
2026-06-29 16:32 ` Dave Jiang
1 sibling, 0 replies; 4+ messages in thread
From: Li Ming @ 2026-06-29 5:10 UTC (permalink / raw)
To: Wei Hou
Cc: linux-cxl, Davidlohr Bueso, Jonathan Cameron, Alison Schofield,
Vishal Verma, Ira Weiny, linux-kernel, Kobayashi, Kaiheng Feng,
Newton Liu, Kristin Chen, Mochs, Dan Williams, Richard Cheng,
Dave Jiang, Dan Williams
On 6/28/2026 11:58 PM, Wei Hou wrote:
> The driver's design intent is that missing or malformed component
> registers should not prevent mailbox initialization. cxl_pci_probe()
> already reflects this: the CXL_REGLOC_RBI_COMPONENT setup path only
> emits a dev_warn() and continues when component registers are absent,
> rather than returning an error.
>
> The check 'if (!cxlds->reg_map.device_map.mbox.valid)' violates this
> intent and is also technically incorrect for two reasons:
>
> 1. Wrong struct: the MEMDEV register block is enumerated into a local
> variable 'map', not into 'cxlds->reg_map'. The device_map.mbox.valid
> field inside cxlds->reg_map is never written by the MEMDEV probe and
> will always read as zero regardless of actual hardware capability.
>
> 2. Already validated: cxl_pci_setup_regs(CXL_REGLOC_RBI_MEMDEV) calls
> cxl_probe_regs() which explicitly checks mbox.valid and returns
> -ENXIO if the mailbox is absent. If that check passes, the mailbox is
> guaranteed to be present by the time cxl_pci_type3_init_mailbox() is
> called.
>
> The value that the check actually reads is component_map.ras.valid,
> which aliases device_map.mbox.valid in the union. This is populated by
> the COMPONENT probe, not the MEMDEV probe. On devices where the
> component register BAR does not implement a CXL Component Capability
> Array (e.g. certain DCD devices), cxl_probe_component_regs() returns
> early leaving ras.valid=false. Through the union, this makes mbox.valid
> read as false, causing cxl_pci_type3_init_mailbox() to return -ENODEV
> (-19) even though the mailbox hardware is fully functional.
>
> Remove the check. Mailbox presence has already been validated by
> cxl_pci_setup_regs(CXL_REGLOC_RBI_MEMDEV). The presence or absence of
> component registers is irrelevant to mailbox initialization.
>
> Fixes: 8d8081cecfb9 ("cxl: Move mailbox related bits to the same context")
> Reviewed-by: Richard Cheng <icheng@nvidia.com>
> Signed-off-by: Wei Hou <wei.hou@scaleflux.com>
Good catch!
Reviewed-by: Li Ming <ming.li@zohomail.com>
> ---
> drivers/cxl/pci.c | 6 ------
> 1 file changed, 6 deletions(-)
>
> diff --git a/drivers/cxl/pci.c b/drivers/cxl/pci.c
> index bace662dc988..e44e5d209900 100644
> --- a/drivers/cxl/pci.c
> +++ b/drivers/cxl/pci.c
> @@ -691,12 +691,6 @@ static int cxl_pci_type3_init_mailbox(struct cxl_dev_state *cxlds)
> {
> int rc;
>
> - /*
> - * Fail the init if there's no mailbox. For a type3 this is out of spec.
> - */
> - if (!cxlds->reg_map.device_map.mbox.valid)
> - return -ENODEV;
> -
> rc = cxl_mailbox_init(&cxlds->cxl_mbox, cxlds->dev);
> if (rc)
> return rc;
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] cxl/pci: Remove incorrect mbox.valid check in cxl_pci_type3_init_mailbox()
2026-06-28 15:58 ` [PATCH v2] " Wei Hou
2026-06-29 5:10 ` Li Ming
@ 2026-06-29 16:32 ` Dave Jiang
1 sibling, 0 replies; 4+ messages in thread
From: Dave Jiang @ 2026-06-29 16:32 UTC (permalink / raw)
To: Wei Hou, Dan Williams
Cc: linux-cxl, Davidlohr Bueso, Jonathan Cameron, Alison Schofield,
Vishal Verma, Ira Weiny, Ming Li, linux-kernel, Kobayashi,
Kaiheng Feng, Newton Liu, Kristin Chen, Mochs, Dan Williams,
Richard Cheng
On 6/28/26 8:58 AM, Wei Hou wrote:
> The driver's design intent is that missing or malformed component
> registers should not prevent mailbox initialization. cxl_pci_probe()
> already reflects this: the CXL_REGLOC_RBI_COMPONENT setup path only
> emits a dev_warn() and continues when component registers are absent,
> rather than returning an error.
>
> The check 'if (!cxlds->reg_map.device_map.mbox.valid)' violates this
> intent and is also technically incorrect for two reasons:
>
> 1. Wrong struct: the MEMDEV register block is enumerated into a local
> variable 'map', not into 'cxlds->reg_map'. The device_map.mbox.valid
> field inside cxlds->reg_map is never written by the MEMDEV probe and
> will always read as zero regardless of actual hardware capability.
>
> 2. Already validated: cxl_pci_setup_regs(CXL_REGLOC_RBI_MEMDEV) calls
> cxl_probe_regs() which explicitly checks mbox.valid and returns
> -ENXIO if the mailbox is absent. If that check passes, the mailbox is
> guaranteed to be present by the time cxl_pci_type3_init_mailbox() is
> called.
>
> The value that the check actually reads is component_map.ras.valid,
> which aliases device_map.mbox.valid in the union. This is populated by
> the COMPONENT probe, not the MEMDEV probe. On devices where the
> component register BAR does not implement a CXL Component Capability
> Array (e.g. certain DCD devices), cxl_probe_component_regs() returns
> early leaving ras.valid=false. Through the union, this makes mbox.valid
> read as false, causing cxl_pci_type3_init_mailbox() to return -ENODEV
> (-19) even though the mailbox hardware is fully functional.
>
> Remove the check. Mailbox presence has already been validated by
> cxl_pci_setup_regs(CXL_REGLOC_RBI_MEMDEV). The presence or absence of
> component registers is irrelevant to mailbox initialization.
>
> Fixes: 8d8081cecfb9 ("cxl: Move mailbox related bits to the same context")
> Reviewed-by: Richard Cheng <icheng@nvidia.com>
> Signed-off-by: Wei Hou <wei.hou@scaleflux.com>
Applied to cxl/next
d79b81893d0c
Next time please post v2 as a separate post instead of having it reply to v1. Thanks.
> ---
> drivers/cxl/pci.c | 6 ------
> 1 file changed, 6 deletions(-)
>
> diff --git a/drivers/cxl/pci.c b/drivers/cxl/pci.c
> index bace662dc988..e44e5d209900 100644
> --- a/drivers/cxl/pci.c
> +++ b/drivers/cxl/pci.c
> @@ -691,12 +691,6 @@ static int cxl_pci_type3_init_mailbox(struct cxl_dev_state *cxlds)
> {
> int rc;
>
> - /*
> - * Fail the init if there's no mailbox. For a type3 this is out of spec.
> - */
> - if (!cxlds->reg_map.device_map.mbox.valid)
> - return -ENODEV;
> -
> rc = cxl_mailbox_init(&cxlds->cxl_mbox, cxlds->dev);
> if (rc)
> return rc;
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-06-29 16:32 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <20260618170356.25382-1-wei.hou@scaleflux.com>
2026-06-25 8:10 ` [PATCH] cxl/pci: Remove incorrect mbox.valid check in cxl_pci_type3_init_mailbox() Richard Cheng
2026-06-28 15:58 ` [PATCH v2] " Wei Hou
2026-06-29 5:10 ` Li Ming
2026-06-29 16:32 ` Dave Jiang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®