Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp823885iob; Wed, 18 May 2022 13:55:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzRx/DypOgYa0/HtNhCPi5I/H8ZcnONT5BNdu1ZxI0rNm+SZPNHFC+l0n9P4L7oIY+72Ocn X-Received: by 2002:a17:90b:3a8b:b0:1dc:4eb4:1f2a with SMTP id om11-20020a17090b3a8b00b001dc4eb41f2amr1995129pjb.50.1652907336495; Wed, 18 May 2022 13:55:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652907336; cv=none; d=google.com; s=arc-20160816; b=BsgpLgkA5O34h9XDEVHBIGQRKXJOuc54mkQx/92Gl91wc4wHSuODikdnhBrE2sTHUR xbfRbQ+oUdHGCgEHI61/5MkaUW6awoG19oTDY0BpBj8TXTwTUHQlvzI4SdlCloypHUDK IEhrYzfoo4DojA1EnyGS5xlLSg0JsGm/uLfQmfLhc/Ms/OXf7L+jPZ89LgIJPzSGQ+h8 6b5iySc2+xmFIWJeKoiWJ2efciT1PiTh3W/csKot2DwEdtXXNhTFoJt8PIoj7kOqjuhp C3eTvXHCs4xEnM+nHUpJdZeYpFQw8P7EQhGAufTsP81OHuIEAwIYn5FfAlQQYpvfp/zl UQmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=YUmtMmKv0MIPYQ2dUlkxldK8GenEeLz0p1jgQ0PFFdM=; b=cj5s710+PwAEQVHTZYQkwnLJ5F+HHB2DDDY6JYykLf9atw77oeNkoIDNbIlbtgjiwY zMRP+q9+1BsZGjr+BTUtI33gSkSwADiLoKHuM7rri4cU620/BSAx6aZn/BMpzf8E18c5 mMnkjuJdnph9h/Vif3pfkyNu3SeIHOcEXdilRiF5qfBrtDjb/z2OJHNrcdtHelO1cGnS 6ucgS1AFUA6MNC0koNOGRQBCsHS2ovSECVz9sCX8VG5tpbJ9QUswYD3a7IHwTmDZjnpD AzU1kocHAuvyj6OcUfuVZkq6Emdn4aItfTivLchIkeFx+RGAXpPQEeO/pkT0eFTp5Epe iF2Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id j12-20020a056a00234c00b005107cf64e1dsi5104080pfj.212.2022.05.18.13.55.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 May 2022 13:55:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E83822532F9; Wed, 18 May 2022 13:54:56 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242856AbiERUyu (ORCPT + 99 others); Wed, 18 May 2022 16:54:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60384 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242829AbiERUyr (ORCPT ); Wed, 18 May 2022 16:54:47 -0400 Received: from smtp.smtpout.orange.fr (smtp04.smtpout.orange.fr [80.12.242.126]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4A00F2532EA for ; Wed, 18 May 2022 13:54:45 -0700 (PDT) Received: from [192.168.1.18] ([86.243.180.246]) by smtp.orange.fr with ESMTPA id rQgqn20Y3QKuarQgqnmO5s; Wed, 18 May 2022 22:54:43 +0200 X-ME-Helo: [192.168.1.18] X-ME-Auth: YWZlNiIxYWMyZDliZWIzOTcwYTEyYzlhMmU3ZiQ1M2U2MzfzZDfyZTMxZTBkMTYyNDBjNDJlZmQ3ZQ== X-ME-Date: Wed, 18 May 2022 22:54:43 +0200 X-ME-IP: 86.243.180.246 Message-ID: <6939d35f-36a0-568e-bfec-4dd2e3a48604@wanadoo.fr> Date: Wed, 18 May 2022 22:54:40 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.1 Subject: Re: [PATCH] fpga: altera-cvp: Truncated bitstream error support Content-Language: en-GB To: tien.sung.ang@intel.com, mdf@kernel.org, hao.wu@intel.com, yilun.xu@intel.com, trix@redhat.com Cc: linux-fpga@vger.kernel.org, linux-kernel@vger.kernel.org References: <20220518064844.2694651-1-tien.sung.ang@intel.com> From: Christophe JAILLET In-Reply-To: <20220518064844.2694651-1-tien.sung.ang@intel.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.0 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Le 18/05/2022 à 08:48, tien.sung.ang@intel.com a écrit : > From: Ang Tien Sung > > To support the error handling of a truncated bitstream sent. > The current AIB CvP firmware is not capable of handling a > data stream smaller than 4096bytes. The firmware's limitation > causes a hung-up as it's DMA engine waits forever for the > completion of the instructed 4096bytes. > To resolve this design limitation, both firmware and CvP > driver made several changes. At the CvP driver, we just > have to ensure that anything lesser than 4096bytes are > padded with extra bytes. The CvP will then, initiate the > tear-down by clearing the START_XFER and CVP_CONFIG bits. > We should also check for CVP_ERROR during the CvP completion. > A send_buf which is always 4096bytes is used to copy the > data during every transaction. > > Signed-off-by: Ang Tien Sung > --- > drivers/fpga/altera-cvp.c | 24 +++++++++++++++++++----- > 1 file changed, 19 insertions(+), 5 deletions(-) > > diff --git a/drivers/fpga/altera-cvp.c b/drivers/fpga/altera-cvp.c > index 4ffb9da537d8..80edcfb5e5fc 100644 > --- a/drivers/fpga/altera-cvp.c > +++ b/drivers/fpga/altera-cvp.c > @@ -81,6 +81,7 @@ struct altera_cvp_conf { > u8 numclks; > u32 sent_packets; > u32 vsec_offset; > + u8 *send_buf; > const struct cvp_priv *priv; > }; > > @@ -453,7 +454,11 @@ static int altera_cvp_write(struct fpga_manager *mgr, const char *buf, > } > > len = min(conf->priv->block_size, remaining); > - altera_cvp_send_block(conf, data, len); > + /* Copy the requested host data into the transmit buffer */ > + > + memcpy(conf->send_buf, data, len); > + altera_cvp_send_block(conf, (const u32 *)conf->send_buf, > + conf->priv->block_size); Nitpicking: this should be aligned with 'conf'. CJ > data += len / sizeof(u32); > done += len; > remaining -= len; [...]