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 X-Spam-Level: X-Spam-Status: No, score=-17.6 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D6344C49EA5 for ; Thu, 24 Jun 2021 14:37:20 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BACFB613EB for ; Thu, 24 Jun 2021 14:37:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232203AbhFXOji (ORCPT ); Thu, 24 Jun 2021 10:39:38 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:55502 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230249AbhFXOjh (ORCPT ); Thu, 24 Jun 2021 10:39:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1624545438; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9h8u0xPq+lyz4kG2IM71OZjooGkjqLutHSguaAe0NLE=; b=L/EnulhFts90OqL3t75ZoF/oByYLU7TJVLJIA6Amny2EhIQt105gheCFMCNDB+L43H9v7A lwNR4b9yygOrUbwaMuajG19U5OScBYQAJug3eTb4qeDOVEA9UW7DvbRWdubXjVf7iJVyvN wsOge5XlCjEmhcZOD9j/D1eZq9ayk44= Received: from mail-oi1-f197.google.com (mail-oi1-f197.google.com [209.85.167.197]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-372-cZjemzorMzWbcdm2eYo7Cg-1; Thu, 24 Jun 2021 10:37:16 -0400 X-MC-Unique: cZjemzorMzWbcdm2eYo7Cg-1 Received: by mail-oi1-f197.google.com with SMTP id k11-20020a54440b0000b02901f3e6a011b4so3857768oiw.23 for ; Thu, 24 Jun 2021 07:37:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=9h8u0xPq+lyz4kG2IM71OZjooGkjqLutHSguaAe0NLE=; b=tkqiUeE28nyzd0bybcFbWlZym8fWjnS6fNPoB1PEEiaX15OMrDTrX/mjqWHYuX8p89 SxViUAtYVHQ4zljkJGBXUeNGMyV1xsj9XPt11Lkv48WBsvYRENA+VXdaSg9omO+BU9nO KgARL7AfZVII8tQDguNWW0/5OzoZCGcquteuB7auB8aRV/trd/GzcaA7mcK7RgHgR+f0 K9iqSHWufIW0Tm7HyB034QkoOI0+9Q+QFUVhitsBSRJpQHG0KVJ0e4Eq8coOuwreyJpH IlXgFejDH25KLNBhkkm3CKavWz/wM8ASqYsskAHToHYDq0+TnJ2XJui45WSSsqZrzO48 8jrg== X-Gm-Message-State: AOAM531Sj5hY3k25PJ5fd0qFagEofkQ5OrusuPyc+4hquEdzVGiU72o1 QgSz4pfXZBGQAQZQrGdAEDme/gd8OhBhc4zq4OBVXowX8JruhVu5E9MwP+Rl/IjspL99zC/Gnve iHSgkHq+WsDbCcxkyLk1DTdRa X-Received: by 2002:a05:6808:60e:: with SMTP id y14mr7361127oih.105.1624545436103; Thu, 24 Jun 2021 07:37:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzw2Crh/+XLQyWazz2/WmdZ58gp6OxY8shHXD3gklt/l5Xl579uOibcqZlSSEOhwX2KHZdxAg== X-Received: by 2002:a05:6808:60e:: with SMTP id y14mr7361113oih.105.1624545435916; Thu, 24 Jun 2021 07:37:15 -0700 (PDT) Received: from localhost.localdomain (075-142-250-213.res.spectrum.com. [75.142.250.213]) by smtp.gmail.com with ESMTPSA id 2sm692895ota.58.2021.06.24.07.37.14 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 24 Jun 2021 07:37:15 -0700 (PDT) Subject: Re: [PATCH v3 1/7] fpga-mgr: wrap the write_init() op To: Xu Yilun , Russ Weight , Greg KH Cc: hao.wu@intel.com, mdf@kernel.org, michal.simek@xilinx.com, linux-fpga@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org References: <20210623182410.3787784-1-trix@redhat.com> <20210623182410.3787784-3-trix@redhat.com> <20210624075414.GA44700@yilunxu-OptiPlex-7050> From: Tom Rix Message-ID: <02bd1acf-6b8d-7ca1-6a9c-c3f6d3a2071c@redhat.com> Date: Thu, 24 Jun 2021 07:37:13 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: <20210624075414.GA44700@yilunxu-OptiPlex-7050> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 6/24/21 12:54 AM, Xu Yilun wrote: > On Wed, Jun 23, 2021 at 11:24:04AM -0700, trix@redhat.com wrote: >> From: Tom Rix >> >> An FPGA manager should not be required to provide a >> write_init() op if there is nothing for it do. >> So add a wrapper and move the op checking. >> Default to success. >> >> Signed-off-by: Tom Rix >> --- >> drivers/fpga/fpga-mgr.c | 14 +++++++++++--- >> 1 file changed, 11 insertions(+), 3 deletions(-) >> >> diff --git a/drivers/fpga/fpga-mgr.c b/drivers/fpga/fpga-mgr.c >> index ecb4c3c795fa5..87bbb940c9504 100644 >> --- a/drivers/fpga/fpga-mgr.c >> +++ b/drivers/fpga/fpga-mgr.c >> @@ -69,6 +69,14 @@ void fpga_image_info_free(struct fpga_image_info *info) >> } >> EXPORT_SYMBOL_GPL(fpga_image_info_free); >> >> +static int fpga_mgr_write_init(struct fpga_manager *mgr, >> + struct fpga_image_info *info, >> + const char *buf, size_t count) >> +{ >> + if (mgr->mops && mgr->mops->write_init) > Maybe we don't have to check mgr->mops, it is already checked on > creation. The check was on purpose because my earlier patchset responding to problems with sec-mgr. Focusing on Greg's comment that why can't sec-mgr be done with existing code, I think the sec-mgr can be folded into the exiting fpga-mgr via a new set of ops. the 'generalize fpga_mgr_load' patchset set has two sets of ops, one for existing partial reconfiguration and one for reimaging the whole board, what the sec-mgr is doing. Since dfl has the only instance of need, it would have the only reimage ops. The check at creation has been deferred to at use. other targets could have null ops. Having maybe null ops means the wrappers need to check. Here is a ref to the earlier patchset https://lore.kernel.org/linux-fpga/20210524162721.2220782-1-trix@redhat.com/ I'll respin 'generalize fpga_mgr_load' within the context this patchset to give you some more context. It will test is the check is needed and give folks a chance to comment if this a way sec-mgr should go. Tom > > The same concern to all the following patches. > > Thanks, > Yilun > >> + return mgr->mops->write_init(mgr, info, buf, count); >> + return 0; >> +} >> /* >> * Call the low level driver's write_init function. This will do the >> * device-specific things to get the FPGA into the state where it is ready to >> @@ -83,9 +91,9 @@ static int fpga_mgr_write_init_buf(struct fpga_manager *mgr, >> >> mgr->state = FPGA_MGR_STATE_WRITE_INIT; >> if (!mgr->mops->initial_header_size) >> - ret = mgr->mops->write_init(mgr, info, NULL, 0); >> + ret = fpga_mgr_write_init(mgr, info, NULL, 0); >> else >> - ret = mgr->mops->write_init( >> + ret = fpga_mgr_write_init( >> mgr, info, buf, min(mgr->mops->initial_header_size, count)); >> >> if (ret) { >> @@ -569,7 +577,7 @@ struct fpga_manager *fpga_mgr_create(struct device *parent, const char *name, >> int id, ret; >> >> if (!mops || !mops->write_complete || !mops->state || >> - !mops->write_init || (!mops->write && !mops->write_sg) || >> + (!mops->write && !mops->write_sg) || >> (mops->write && mops->write_sg)) { >> dev_err(parent, "Attempt to register without fpga_manager_ops\n"); >> return NULL; >> -- >> 2.26.3 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 X-Spam-Level: X-Spam-Status: No, score=-15.6 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B5FBFC49EA5 for ; Thu, 24 Jun 2021 14:38:44 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 79A6F611CB for ; Thu, 24 Jun 2021 14:38:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 79A6F611CB Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date:Message-ID:From: References:Cc:To:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=sRoybWwPiI1Gyf+oNzYUX2xrBnP1r5VQmyJ7LKKKxYQ=; b=noHMZeM96kgt9PPX1lJEH4akn3 5SLNqC1zAFEUiYg5Wx7e9p46JGJN7efWUJ+kXHc7dOvGj76lGBXutCXUYzluHpkLPTLAIc8ndGKql HWgbWV+oNCHrolef1cEFYVJyEFOx4asOn8cVauG8PqIavgioIG7rK8L9gI3qd0mxISR5H2SY6zbv0 VI2qGaFv5aTwYUxl6sVdKuaOi38WmwKWikIvLj/xNJdjmRJO3Vgovu/z/bduscl8mcSmH8Q/5FhFv JHLyrcfJaAmtyZuTv1rwP6fiaq0T7DOU9pR7NiG6dHo7y13ynBvkIxTwmdhMKJvsvwJy9SBe0qkWG QGghllbQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lwQTt-00F4PH-KH; Thu, 24 Jun 2021 14:37:25 +0000 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lwQTp-00F4Ni-44 for linux-arm-kernel@lists.infradead.org; Thu, 24 Jun 2021 14:37:22 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1624545438; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9h8u0xPq+lyz4kG2IM71OZjooGkjqLutHSguaAe0NLE=; b=L/EnulhFts90OqL3t75ZoF/oByYLU7TJVLJIA6Amny2EhIQt105gheCFMCNDB+L43H9v7A lwNR4b9yygOrUbwaMuajG19U5OScBYQAJug3eTb4qeDOVEA9UW7DvbRWdubXjVf7iJVyvN wsOge5XlCjEmhcZOD9j/D1eZq9ayk44= Received: from mail-oi1-f200.google.com (mail-oi1-f200.google.com [209.85.167.200]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-571-PCJq00wiPESIuV_oAc17ew-1; Thu, 24 Jun 2021 10:37:17 -0400 X-MC-Unique: PCJq00wiPESIuV_oAc17ew-1 Received: by mail-oi1-f200.google.com with SMTP id t185-20020acac3c20000b0290239f91b62c6so2684801oif.0 for ; Thu, 24 Jun 2021 07:37:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=9h8u0xPq+lyz4kG2IM71OZjooGkjqLutHSguaAe0NLE=; b=L7ZuMRkbgH39MCVkd9FIdO7vVmOLQgFfhFB+1dWyCPKPdDBHQVeIx4Cja+lCOMFNtD MY2Ssxfmh9XR2A0oGl0cyh6vZhBLkZ/iUhq6Qx7pug1VZ15aO+sWzt8KPua9V0GX2MJo ZxJQhkgzP7XQOexU9q5JOi8hWPWZLf3bgNgRWfpIFWigJehi9d9MovhDm0wSNo2jURfi /yHtuEUWPAvyZhKHpFozNLXVMwgQLzoxYS50jp/wtV8tVRzseW2TMBX2zjnZNpA2ysN9 MBgVukChxNf7Caix7FckqTxKhRVpTmbo4D7/vTGQ+omNasnyTdkOZuNW5bijQtIZyOf7 HZrQ== X-Gm-Message-State: AOAM532KM7oJWQ0ghXJTKZkAaGA7OGBdMObplca3lWH3EVb1gDlhmM6N gjj7X3h3K7Ki7ra9z1xVg0zmnDTLsHu36ow+WFeMrK95zRg6T6BkHZu1L5ZEn+SVmZY+0PLeRpj yquCYFb96TxqMjLpN3PuYYVb6FUAAMQ78ev9SwviyylDV7FuAS7xBPaZR9EkGVsvVyIUOt48a2t D4rI3jpA== X-Received: by 2002:a05:6808:60e:: with SMTP id y14mr7361131oih.105.1624545436135; Thu, 24 Jun 2021 07:37:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzw2Crh/+XLQyWazz2/WmdZ58gp6OxY8shHXD3gklt/l5Xl579uOibcqZlSSEOhwX2KHZdxAg== X-Received: by 2002:a05:6808:60e:: with SMTP id y14mr7361113oih.105.1624545435916; Thu, 24 Jun 2021 07:37:15 -0700 (PDT) Received: from localhost.localdomain (075-142-250-213.res.spectrum.com. [75.142.250.213]) by smtp.gmail.com with ESMTPSA id 2sm692895ota.58.2021.06.24.07.37.14 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 24 Jun 2021 07:37:15 -0700 (PDT) Subject: Re: [PATCH v3 1/7] fpga-mgr: wrap the write_init() op To: Xu Yilun , Russ Weight , Greg KH Cc: hao.wu@intel.com, mdf@kernel.org, michal.simek@xilinx.com, linux-fpga@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org References: <20210623182410.3787784-1-trix@redhat.com> <20210623182410.3787784-3-trix@redhat.com> <20210624075414.GA44700@yilunxu-OptiPlex-7050> From: Tom Rix Message-ID: <02bd1acf-6b8d-7ca1-6a9c-c3f6d3a2071c@redhat.com> Date: Thu, 24 Jun 2021 07:37:13 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.8.1 MIME-Version: 1.0 In-Reply-To: <20210624075414.GA44700@yilunxu-OptiPlex-7050> Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=trix@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210624_073721_314262_B0A77C32 X-CRM114-Status: GOOD ( 27.91 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 6/24/21 12:54 AM, Xu Yilun wrote: > On Wed, Jun 23, 2021 at 11:24:04AM -0700, trix@redhat.com wrote: >> From: Tom Rix >> >> An FPGA manager should not be required to provide a >> write_init() op if there is nothing for it do. >> So add a wrapper and move the op checking. >> Default to success. >> >> Signed-off-by: Tom Rix >> --- >> drivers/fpga/fpga-mgr.c | 14 +++++++++++--- >> 1 file changed, 11 insertions(+), 3 deletions(-) >> >> diff --git a/drivers/fpga/fpga-mgr.c b/drivers/fpga/fpga-mgr.c >> index ecb4c3c795fa5..87bbb940c9504 100644 >> --- a/drivers/fpga/fpga-mgr.c >> +++ b/drivers/fpga/fpga-mgr.c >> @@ -69,6 +69,14 @@ void fpga_image_info_free(struct fpga_image_info *info) >> } >> EXPORT_SYMBOL_GPL(fpga_image_info_free); >> >> +static int fpga_mgr_write_init(struct fpga_manager *mgr, >> + struct fpga_image_info *info, >> + const char *buf, size_t count) >> +{ >> + if (mgr->mops && mgr->mops->write_init) > Maybe we don't have to check mgr->mops, it is already checked on > creation. The check was on purpose because my earlier patchset responding to problems with sec-mgr. Focusing on Greg's comment that why can't sec-mgr be done with existing code, I think the sec-mgr can be folded into the exiting fpga-mgr via a new set of ops. the 'generalize fpga_mgr_load' patchset set has two sets of ops, one for existing partial reconfiguration and one for reimaging the whole board, what the sec-mgr is doing. Since dfl has the only instance of need, it would have the only reimage ops. The check at creation has been deferred to at use. other targets could have null ops. Having maybe null ops means the wrappers need to check. Here is a ref to the earlier patchset https://lore.kernel.org/linux-fpga/20210524162721.2220782-1-trix@redhat.com/ I'll respin 'generalize fpga_mgr_load' within the context this patchset to give you some more context. It will test is the check is needed and give folks a chance to comment if this a way sec-mgr should go. Tom > > The same concern to all the following patches. > > Thanks, > Yilun > >> + return mgr->mops->write_init(mgr, info, buf, count); >> + return 0; >> +} >> /* >> * Call the low level driver's write_init function. This will do the >> * device-specific things to get the FPGA into the state where it is ready to >> @@ -83,9 +91,9 @@ static int fpga_mgr_write_init_buf(struct fpga_manager *mgr, >> >> mgr->state = FPGA_MGR_STATE_WRITE_INIT; >> if (!mgr->mops->initial_header_size) >> - ret = mgr->mops->write_init(mgr, info, NULL, 0); >> + ret = fpga_mgr_write_init(mgr, info, NULL, 0); >> else >> - ret = mgr->mops->write_init( >> + ret = fpga_mgr_write_init( >> mgr, info, buf, min(mgr->mops->initial_header_size, count)); >> >> if (ret) { >> @@ -569,7 +577,7 @@ struct fpga_manager *fpga_mgr_create(struct device *parent, const char *name, >> int id, ret; >> >> if (!mops || !mops->write_complete || !mops->state || >> - !mops->write_init || (!mops->write && !mops->write_sg) || >> + (!mops->write && !mops->write_sg) || >> (mops->write && mops->write_sg)) { >> dev_err(parent, "Attempt to register without fpga_manager_ops\n"); >> return NULL; >> -- >> 2.26.3 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel