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 phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7960CEB64DC for ; Mon, 17 Jul 2023 10:36:51 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 6D8F1865E5; Mon, 17 Jul 2023 12:36:49 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=monstr.eu Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=monstr-eu.20221208.gappssmtp.com header.i=@monstr-eu.20221208.gappssmtp.com header.b="q0ziceSL"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 3257D865EB; Mon, 17 Jul 2023 12:36:47 +0200 (CEST) Received: from mail-ej1-x634.google.com (mail-ej1-x634.google.com [IPv6:2a00:1450:4864:20::634]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 9D7E9856C4 for ; Mon, 17 Jul 2023 12:36:44 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=monstr.eu Authentication-Results: phobos.denx.de; spf=none smtp.mailfrom=monstr@monstr.eu Received: by mail-ej1-x634.google.com with SMTP id a640c23a62f3a-997c4107d62so106642366b.0 for ; Mon, 17 Jul 2023 03:36:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monstr-eu.20221208.gappssmtp.com; s=20221208; t=1689590204; x=1692182204; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=PE7kLtlqRkKxgapn+vefM4dCDGANL/VWIFYjIkjtVWg=; b=q0ziceSLtiChfz5qQx8Ubw1PUHzynHCPxjOxGJYhV123/PrHOkxKFsrtmL4Rq9Wqhe C+NKT5V1xvuxeU8xAE8ISEvYIu9w78B4ijNVBrApHuw9IwtV/ZEqJCzUuVdsJRHK/ZuE ApBpOg31NZnLBSls5WNNzmb+vT29Gbo88vnbP6x7fLyjPM7OP3MQNB6bwLpT5514yydp FLz25mdyTySrOEOdmc5NzRvtl/M//mzjlp4uOEhNOmr3KCC4arc5Yn2SKWJaabkaIKct fOaG9O20XXYJWs6J/PqVwsafxiejdhIZrIce03hSEduwEiICYiZx5kJUgggR6ECOugxv KLgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689590204; x=1692182204; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=PE7kLtlqRkKxgapn+vefM4dCDGANL/VWIFYjIkjtVWg=; b=d0ptlx6msAQQHk2ffCgXXZFiXhmmETtO80MQNFcNflDHGoOknqkCrKDy1YYOzzENe2 fdbeGJjExYUS4kpRLYLit1rCQw4y4fTtxEMN0ZROjHDV/FEo8X6dp6VipL76t6kq5nY5 4Zu2kkZv937DHi4iMYxvwwVBxnqNNDF93ptgt7k1L4sl46ACo2caFs8CstOG/0GiUUtP QBdHTlchlOYYp04CISlAqe6ia0WmxHai6nbyIDFY2BVlThJLVQwceS7Zhg31jA+1ZxXJ Q1IftpRZ8cZ97jb460dKBAmvkexiT5fJnGMZtm4WyR7PutOCsv8M2ZA3OE7g/ADaLQRL osgw== X-Gm-Message-State: ABy/qLaR+AfUiXo3OTu1lMF0O1eAoCm1Mp8/S/rRL7GHW1b0tQH7vDs+ lSbqkkaZI6q1SKqWWtg4014htQ== X-Google-Smtp-Source: APBJJlGy3AqegAQ+sv7LCcaacl1FGakB6Z5aKKYJ7nHCLQGomY2ccxi/UYFcv2rEV9Kdn/KT/pWajQ== X-Received: by 2002:a17:907:3f07:b0:993:336d:bc0c with SMTP id hq7-20020a1709073f0700b00993336dbc0cmr14562300ejc.34.1689590204040; Mon, 17 Jul 2023 03:36:44 -0700 (PDT) Received: from [192.168.0.105] (nat-35.starnet.cz. [178.255.168.35]) by smtp.gmail.com with ESMTPSA id hk14-20020a170906c9ce00b0099316c56db9sm8923741ejb.127.2023.07.17.03.36.42 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 17 Jul 2023 03:36:43 -0700 (PDT) Message-ID: <48d31c19-48ca-d913-bbf1-e62cde4166af@monstr.eu> Date: Mon, 17 Jul 2023 12:36:42 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: [PATCH v3] event: Add fpga load event Content-Language: en-US To: christian.taedcke-oss@weidmueller.com, u-boot@lists.denx.de Cc: Christian Taedcke , Michal Simek , Simon Glass References: <20230712113909.140508-1-christian.taedcke-oss@weidmueller.com> From: Michal Simek In-Reply-To: <20230712113909.140508-1-christian.taedcke-oss@weidmueller.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean On 7/12/23 13:39, christian.taedcke-oss@weidmueller.com wrote: > From: Christian Taedcke > > This enables implementing custom logic after a bitstream was loaded > into the fpga. > > Signed-off-by: Christian Taedcke > --- > > Changes in v3: > - replace #if with if > - remove previously added printf > - return notification error from fpga_load() > - fix static_assert checking event name list > > Changes in v2: > - replace __weak function with a new event > > common/event.c | 3 +++ > drivers/fpga/fpga.c | 20 ++++++++++++++++++++ > include/event.h | 16 ++++++++++++++++ > 3 files changed, 39 insertions(+) > > diff --git a/common/event.c b/common/event.c > index 164c95f8f5..20720c5283 100644 > --- a/common/event.c > +++ b/common/event.c > @@ -36,6 +36,9 @@ const char *const type_name[] = { > /* init hooks */ > "misc_init_f", > > + /* Fpga load hook */ > + "fpga_load", > + > /* fdt hooks */ > "ft_fixup", > > diff --git a/drivers/fpga/fpga.c b/drivers/fpga/fpga.c > index 7f6b6bc73a..81e6d8ffc0 100644 > --- a/drivers/fpga/fpga.c > +++ b/drivers/fpga/fpga.c > @@ -244,6 +244,21 @@ int fpga_loads(int devnum, const void *buf, size_t size, > } > #endif > > +static int fpga_load_event_notify(const void *buf, size_t bsize, int result) > +{ > + if (CONFIG_IS_ENABLED(EVENT)) { > + struct event_fpga_load load = { > + .buf = buf, > + .bsize = bsize, > + .result = result > + }; > + > + return event_notify(EVT_FPGA_LOAD, &load, sizeof(load)); > + } > + > + return 0; > +} > + > /* > * Generic multiplexing code > */ > @@ -251,6 +266,7 @@ int fpga_load(int devnum, const void *buf, size_t bsize, bitstream_type bstype, > int flags) > { > int ret_val = FPGA_FAIL; /* assume failure */ > + int ret_notify; > const fpga_desc *desc = fpga_validate(devnum, buf, bsize, > (char *)__func__); > > @@ -284,6 +300,10 @@ int fpga_load(int devnum, const void *buf, size_t bsize, bitstream_type bstype, > } > } > > + ret_notify = fpga_load_event_notify(buf, bsize, ret_val); > + if (ret_notify) > + return ret_notify; > + > return ret_val; > } > > diff --git a/include/event.h b/include/event.h > index fe41080fa6..77124c2e73 100644 > --- a/include/event.h > +++ b/include/event.h > @@ -31,6 +31,9 @@ enum event_t { > /* Init hooks */ > EVT_MISC_INIT_F, > > + /* Fpga load hook */ > + EVT_FPGA_LOAD, > + > /* Device tree fixups before booting */ > EVT_FT_FIXUP, > > @@ -59,6 +62,19 @@ union event_data { > struct udevice *dev; > } dm; > > + /** > + * struct event_fpga_load - fpga load event > + * > + * @buf: The buffer that was loaded into the fpga > + * @bsize: The size of the buffer that was loaded into the fpga > + * @result: Result of the load operation > + */ > + struct event_fpga_load { > + const void *buf; > + size_t bsize; > + int result; > + } fpga_load; > + > /** > * struct event_ft_fixup - FDT fixup before booting > * There is the error generated for kmcent2_defconfig. Please fix. For more information please take a look at https://source.denx.de/u-boot/custodians/u-boot-microblaze/-/jobs/657127 +In file included from board/keymile/kmcent2/kmcent2.c:9: +include/event.h:74:17: error: unknown type name 'size_t' + 74 | size_t bsize; + | ^~~~~~ +make[2]: *** [scripts/Makefile.build:257: board/keymile/kmcent2/kmcent2.o] Error 1 Thanks, Michal -- Michal Simek, Ing. (M.Eng), OpenPGP -> KeyID: FE3D1F91 w: www.monstr.eu p: +42-0-721842854 Maintainer of Linux kernel - Xilinx Microblaze Maintainer of Linux kernel - Xilinx Zynq ARM and ZynqMP/Versal ARM64 SoCs U-Boot custodian - Xilinx Microblaze/Zynq/ZynqMP/Versal/Versal NET SoCs TF-A maintainer - Xilinx ZynqMP/Versal/Versal NET SoCs