From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4218DC61DA4 for ; Fri, 3 Feb 2023 09:54:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230180AbjBCJy0 (ORCPT ); Fri, 3 Feb 2023 04:54:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46490 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229790AbjBCJyZ (ORCPT ); Fri, 3 Feb 2023 04:54:25 -0500 Received: from bmailout1.hostsharing.net (bmailout1.hostsharing.net [IPv6:2a01:37:1000::53df:5f64:0]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DF12E70D56; Fri, 3 Feb 2023 01:54:22 -0800 (PST) Received: from h08.hostsharing.net (h08.hostsharing.net [83.223.95.28]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "*.hostsharing.net", Issuer "RapidSSL Global TLS RSA4096 SHA256 2022 CA1" (verified OK)) by bmailout1.hostsharing.net (Postfix) with ESMTPS id DF6DC300034F1; Fri, 3 Feb 2023 10:54:18 +0100 (CET) Received: by h08.hostsharing.net (Postfix, from userid 100393) id C60BF2EE13E; Fri, 3 Feb 2023 10:54:18 +0100 (CET) Date: Fri, 3 Feb 2023 10:54:18 +0100 From: Lukas Wunner To: "Li, Ming" Cc: Ira Weiny , Bjorn Helgaas , linux-pci@vger.kernel.org, Gregory Price , Jonathan Cameron , Dan Williams , Alison Schofield , Vishal Verma , Dave Jiang , Hillf Danton , Ben Widawsky , linuxarm@huawei.com, linux-cxl@vger.kernel.org Subject: Re: [PATCH v2 04/10] cxl/pci: Use synchronous API for DOE Message-ID: <20230203095418.GA18459@wunner.de> References: <63cf2bc3cf76_521a294a1@iweiny-mobl.notmuch> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-cxl@vger.kernel.org On Fri, Feb 03, 2023 at 04:53:34PM +0800, Li, Ming wrote: > On 1/24/2023 8:52 AM, Ira Weiny wrote: > > Lukas Wunner wrote: > > > static int cxl_cdat_get_length(struct device *dev, > > > struct pci_doe_mb *cdat_doe, > > > size_t *length) > > > { > > > - DECLARE_CDAT_DOE_TASK(CDAT_DOE_REQ(0), t); > > > + u32 request = CDAT_DOE_REQ(0); > > > + u32 response[32]; > > > int rc; > > > > > > - rc = pci_doe_submit_task(cdat_doe, &t.task); > > > + rc = pci_doe(cdat_doe, PCI_DVSEC_VENDOR_ID_CXL, > > > + CXL_DOE_PROTOCOL_TABLE_ACCESS, > > > + &request, sizeof(request), > > > + &response, sizeof(response)); > > > if (rc < 0) { > > > - dev_err(dev, "DOE submit failed: %d", rc); > > > + dev_err(dev, "DOE failed: %d", rc); > > > return rc; > > > } > > > - wait_for_completion(&t.c); > > > - if (t.task.rv < sizeof(u32)) > > > + if (rc < sizeof(u32)) > > > return -EIO; > > > > > Sorry, I didn't find the original patchset email, only can reply here. > Should this "if (rc < sizeof(u32))" be "if (rc < 2 * sizeof(u32))"? > Because below code used response[1] directly, that means we need unless > two u32 in response payload. Yes I spotted that as well, there's already a fixup on my development branch: https://github.com/l1k/linux/commits/doe It's in commit "cxl/pci: Handle truncated CDAT header" which is: https://github.com/l1k/linux/commit/208f256b319b ...but that URL may stop working as soon as I rebase the next time. Actually there's a lot more broken here, there are 3 other new fixup patches at the beginning of that development branch. Thanks, Lukas