Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp1555087iof; Tue, 7 Jun 2022 07:41:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxqY3uRTdQk5Bsm2cOWZg8zsy2T6WF8vpB/C2YAGwow4J5GhYZ+OZUxEBu1dSiCXnjXO29Z X-Received: by 2002:a05:6402:3224:b0:42d:e68c:2fd with SMTP id g36-20020a056402322400b0042de68c02fdmr33199605eda.282.1654612913351; Tue, 07 Jun 2022 07:41:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654612913; cv=none; d=google.com; s=arc-20160816; b=QOClJflF1Z33M0IdE+ptu5PqPBd9VZ+tWWNfP5xaH/WX5D1bueMNHdQv8E+JFhOTJW fzGp+8cHN0AhK1/j8dDxsyOTOHfYjgyt6yQufZKWGUbczipqofK9VLk6ZJCnJBjcPnPu 2RqTuCR7pOp6ft+0Sx/ikXb9Gl8beXVPVju9mXyWZ09szWXDkK1/5zIPbZxlojJfiM4s rt+JdlLjfcSfJCKq8nfuq1IaEAbXarAFoNHjh1+50jRGKgJrF3GkD0IsaQKpkVQblOHD 54pJt4iH16eeqqS9+6TIsQyXSCCPt/MeGkIsaarwOgXJvNSpaoGcR+/sLzruDKbRgOTT 7SXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=y60iesrVr7cRQx5q8wj/PvWlhH6ahc6O4HFpL8LZAUk=; b=QtGTSIBf/U0CWNzuoWYyRASExjcxgYG67PM40TKzmjw7Ox8q1pSyyAYmwG7Hr5OaeV bgSUAh4ZrgAQfOF1ln94TmhZklcqL1G+4rLGew6s15ieerd9QGg8TYiQ7n/esjS41yZv ne6CKW7f8ClBkc5uFSP0KsILDiO8a3KKSmpiNtHRkE2EDeI4vxAP357fpxKsfHUGhWmR Hj/u5aOc4e3KzIdzXj8QMJbt6Q6YwnkD0s2s3/iQmrt7qUuJu7D+x0FCfDsJYgM8OVMU l8Rt8xe1Wjdh8SyzHMhYIz3crJSZMo2889hsOYJ5FrIK3F8sRZGv02MSWEj4CZz/oMla /NAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=GEQimPX2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w8-20020a50d788000000b0042d7b4c997bsi11725947edi.279.2022.06.07.07.41.24; Tue, 07 Jun 2022 07:41:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=GEQimPX2; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236839AbiFGFzv (ORCPT + 99 others); Tue, 7 Jun 2022 01:55:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38218 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229930AbiFGFzt (ORCPT ); Tue, 7 Jun 2022 01:55:49 -0400 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D5086D4122; Mon, 6 Jun 2022 22:55:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1654581348; x=1686117348; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=blRvZhyRA1ZaOOrg6D578DFOBpuu1YgJkE3AGHxofgI=; b=GEQimPX2ZKgibeVK6rWacpAdw/G0k0PDrdnfUc3osLI/PSJ8smyxZNXf aWH0YXcjcKXN85W/BUztX5Rv2hAReWEna8YRl9CSl2ym3OL3MZUxuqJU8 g1tIudQHpCn0DV+zA5NV5eMTFcfx6DVOQMgbjNbCH6RytpTKsZkik+wuE UtF2PdluXBWLoslNHkG5bEuFKpbxFy7qXSmY29A7s/2f0yoxNilNyxYEY gzZb+yuVxNI6zjcDrA1y2j1V3DgwBzxIEZM+txhRrK7osHiYK8TTx8xvW JLxzSdQvhoWz3WL/ghXVS0eahCnDUY2ebEb8frMVBE+NKmtGDqrRf7CMU Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10370"; a="274244630" X-IronPort-AV: E=Sophos;i="5.91,282,1647327600"; d="scan'208";a="274244630" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Jun 2022 22:55:48 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,282,1647327600"; d="scan'208";a="723182065" Received: from unknown (HELO localhost.localdomain) ([10.226.216.90]) by fmsmga001.fm.intel.com with ESMTP; 06 Jun 2022 22:55:46 -0700 From: tien.sung.ang@intel.com To: yilun.xu@intel.com Cc: christophe.jaillet@wanadoo.fr, hao.wu@intel.com, linux-fpga@vger.kernel.org, linux-kernel@vger.kernel.org, mdf@kernel.org, tien.sung.ang@intel.com, trix@redhat.com Subject: Re: [PATCH v2] fpga: altera-cvp: Truncated bitstream error support Date: Tue, 7 Jun 2022 13:55:30 +0800 Message-Id: <20220607055530.3755617-1-tien.sung.ang@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220603094911.GA238410@yilunxu-OptiPlex-7050> References: <20220603094911.GA238410@yilunxu-OptiPlex-7050> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-8.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham 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 > But you are adding the logic in altera_cvp_write() to keep the > correctness. What's the difference adding it somewhere else? And as I > can see, preventing the writing at the very beginning is a much cleaner > way. Though without doubt, your solution is doable, I have a discussion with the Intel architect and they insisted that the device driver must not make such a decision. The decision to drop or accept a transfer is up to the firmware. The firmware insisted that the buffer be padded with whatever value. They desire the transfer protocol to be obeyed to ensure, that there is no hard dependencies on the device driver if they do one day change the 4kbytes to some other smaller value. > > > If the image size is larger than 1 Page but is not aligned to 1 Page, > > > will the reprogramming still fail? > > Yes, the reconfiguration will fail. The above tear-down is to prevent > > that CvP Hardware/firmware in the FPGA from entering into a dead-lock. > So if the image size is not aligned to 1 Page, the reprogram should fail > anyway, is it? Then I really recommend you fail the reprogramming at the > very beginning. Same reasoning as above. We don't want the driver to make this decision. > > >> + altera_cvp_send_block(conf, (const u32 *)conf->send_buf, > > >> + conf->priv->block_size); > > > > >If the len equals block_size, is the copy still needed? > > Actually, not required. But to maintain a simple design, we use > > a common flow for all so you can skip the check. > I don't think so. We should make the code reasonable. Blindly copy the > whole buffer impacts all normal cases, and makes people confused. The > code seems shorter now, but not simpler, it takes people more time to > figure out why. Yes, it could look confusing to other programmers. And, yes, the padding doesn't matter. Let me relook into this. As the driver is already re-tested by the silicon validatioin. I want to avoid making any change as it would meant another couple of weeks of re-testing. Can this be accepted as it is?