diff mbox series

[06/23] cxl/pci: Don't check media status for mbox access

Message ID 20211120000250.1663391-7-ben.widawsky@intel.com
State Superseded
Headers show
Series Add drivers for CXL ports and mem devices | expand

Commit Message

Ben Widawsky Nov. 20, 2021, 12:02 a.m. UTC
Media status is necessary for using HDM contained in a CXL device but is
not needed for mailbox accesses. Therefore remove this check. It will be
necessary to have this check (in a different place) when enabling HDM.

Signed-off-by: Ben Widawsky <ben.widawsky@intel.com>
---
This patch did not exist in RFCv2
---
 drivers/cxl/pci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Jonathan Cameron Nov. 22, 2021, 3:19 p.m. UTC | #1
On Fri, 19 Nov 2021 16:02:33 -0800
Ben Widawsky <ben.widawsky@intel.com> wrote:

> Media status is necessary for using HDM contained in a CXL device but is
> not needed for mailbox accesses. Therefore remove this check. It will be
> necessary to have this check (in a different place) when enabling HDM.
> 
> Signed-off-by: Ben Widawsky <ben.widawsky@intel.com>

One could perhaps argue this was a bug, but it was hopefully harmless on real devices.
Out of curiosity, did you find a clear definition of what 'User data' includes?
Obviously includes any data in the HDM region, but what about region meta data?

Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

> ---
> This patch did not exist in RFCv2
> ---
>  drivers/cxl/pci.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/cxl/pci.c b/drivers/cxl/pci.c
> index 869b4fc18e27..711bf4514480 100644
> --- a/drivers/cxl/pci.c
> +++ b/drivers/cxl/pci.c
> @@ -230,7 +230,7 @@ static int cxl_pci_mbox_get(struct cxl_dev_state *cxlds)
>  	 * but it's possible early devices implemented this before the ECN.
>  	 */
>  	md_status = readq(cxlds->regs.memdev + CXLMDEV_STATUS_OFFSET);
> -	if (!(md_status & CXLMDEV_MBOX_IF_READY && CXLMDEV_READY(md_status))) {
> +	if (!(md_status & CXLMDEV_MBOX_IF_READY)) {
>  		dev_err(dev, "mbox: reported doorbell ready, but not mbox ready\n");
>  		rc = -EBUSY;
>  		goto out;
Dan Williams Nov. 24, 2021, 9:58 p.m. UTC | #2
On Fri, Nov 19, 2021 at 4:03 PM Ben Widawsky <ben.widawsky@intel.com> wrote:
>
> Media status is necessary for using HDM contained in a CXL device but is
> not needed for mailbox accesses. Therefore remove this check. It will be
> necessary to have this check (in a different place) when enabling HDM.
>
> Signed-off-by: Ben Widawsky <ben.widawsky@intel.com>
> ---
> This patch did not exist in RFCv2
> ---
>  drivers/cxl/pci.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/cxl/pci.c b/drivers/cxl/pci.c
> index 869b4fc18e27..711bf4514480 100644
> --- a/drivers/cxl/pci.c
> +++ b/drivers/cxl/pci.c
> @@ -230,7 +230,7 @@ static int cxl_pci_mbox_get(struct cxl_dev_state *cxlds)
>          * but it's possible early devices implemented this before the ECN.
>          */
>         md_status = readq(cxlds->regs.memdev + CXLMDEV_STATUS_OFFSET);
> -       if (!(md_status & CXLMDEV_MBOX_IF_READY && CXLMDEV_READY(md_status))) {
> +       if (!(md_status & CXLMDEV_MBOX_IF_READY)) {
>                 dev_err(dev, "mbox: reported doorbell ready, but not mbox ready\n");
>                 rc = -EBUSY;
>                 goto out;

Per comment on last patch I think this whole 'if' block can go.
"Ready" need only be checked once at the beginning of time and then
only as a forensic step after a future failure.
diff mbox series

Patch

diff --git a/drivers/cxl/pci.c b/drivers/cxl/pci.c
index 869b4fc18e27..711bf4514480 100644
--- a/drivers/cxl/pci.c
+++ b/drivers/cxl/pci.c
@@ -230,7 +230,7 @@  static int cxl_pci_mbox_get(struct cxl_dev_state *cxlds)
 	 * but it's possible early devices implemented this before the ECN.
 	 */
 	md_status = readq(cxlds->regs.memdev + CXLMDEV_STATUS_OFFSET);
-	if (!(md_status & CXLMDEV_MBOX_IF_READY && CXLMDEV_READY(md_status))) {
+	if (!(md_status & CXLMDEV_MBOX_IF_READY)) {
 		dev_err(dev, "mbox: reported doorbell ready, but not mbox ready\n");
 		rc = -EBUSY;
 		goto out;