[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20210107190500.qvsb2qkqcvgclanu@intel.com>
Date: Thu, 7 Jan 2021 11:05:00 -0800
From: Ben Widawsky <ben.widawsky@...el.com>
To: linux-cxl@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, linux-pci@...r.kernel.org,
linux-acpi@...r.kernel.org, Ira Weiny <ira.weiny@...el.com>,
Dan Williams <dan.j.williams@...el.com>,
Vishal Verma <vishal.l.verma@...el.com>,
"Kelley, Sean V" <sean.v.kelley@...el.com>,
Rafael Wysocki <rafael.j.wysocki@...el.com>,
Bjorn Helgaas <helgaas@...nel.org>,
Jonathan Cameron <Jonathan.Cameron@...wei.com>,
Jon Masters <jcm@...masters.org>,
Chris Browy <cbrowy@...ry-design.com>,
Randy Dunlap <rdunlap@...radead.org>,
Christoph Hellwig <hch@...radead.org>
Subject: Re: [RFC PATCH v2 07/14] cxl/mem: Implement polled mode mailbox
On 20-12-08 16:24:11, Ben Widawsky wrote:
[snip]
> +static int cxl_mem_mbox_send_cmd(struct cxl_mem *cxlm,
> + struct mbox_cmd *mbox_cmd)
> +{
> + u64 cmd, status;
> + size_t out_len;
> + int rc;
> +
> + lockdep_assert_held(&cxlm->mbox_lock);
> +
> + /*
> + * Here are the steps from 8.2.8.4 of the CXL 2.0 spec.
> + * 1. Caller reads MB Control Register to verify doorbell is clear
> + * 2. Caller writes Command Register
> + * 3. Caller writes Command Payload Registers if input payload is non-empty
> + * 4. Caller writes MB Control Register to set doorbell
> + * 5. Caller either polls for doorbell to be clear or waits for interrupt if configured
> + * 6. Caller reads MB Status Register to fetch Return code
> + * 7. If command successful, Caller reads Command Register to get Payload Length
> + * 8. If output payload is non-empty, host reads Command Payload Registers
> + */
> +
> + /* #1 */
> + WARN_ON(cxl_doorbell_busy(cxlm));
> +
> + /* #2 */
> + cxl_write_mbox_reg64(cxlm, CXLDEV_MB_CMD_OFFSET, mbox_cmd->opcode);
> +
> + if (mbox_cmd->size_in) {
> + /* #3 */
> + CXL_SET_FIELD(mbox_cmd->size_in, CXLDEV_MB_CMD_PAYLOAD_LENGTH);
> + cxl_mbox_payload_fill(cxlm, mbox_cmd->payload,
> + mbox_cmd->size_in);
> + }
There is a bug here where the payload length isn't written on input. It was
working in v1. It will be fixed in v3.
[snip]
Powered by blists - more mailing lists