[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <4567c582-490b-37d4-d95c-987b4a892fab@redhat.com>
Date: Fri, 9 Jun 2023 12:41:27 +0200
From: Marco Pagani <marpagan@...hat.com>
To: Xu Yilun <yilun.xu@...el.com>
Cc: Moritz Fischer <mdf@...nel.org>, Wu Hao <hao.wu@...el.com>,
Tom Rix <trix@...hat.com>, linux-kernel@...r.kernel.org,
linux-fpga@...r.kernel.org
Subject: Re: [RFC PATCH v6 3/4] fpga: add an initial KUnit suite for the FPGA
Region
On 2023-06-09 13:22, Xu Yilun wrote:
> On 2023-05-31 at 11:54:04 +0200, Marco Pagani wrote:
>> The suite tests the programming of an FPGA Region with a Bridge
>> and the function for finding a particular Region.
>>
>> Signed-off-by: Marco Pagani <marpagan@...hat.com>
>> ---
>> drivers/fpga/tests/fpga-region-test.c | 186 ++++++++++++++++++++++++++
>> 1 file changed, 186 insertions(+)
>> create mode 100644 drivers/fpga/tests/fpga-region-test.c
>>
>> diff --git a/drivers/fpga/tests/fpga-region-test.c b/drivers/fpga/tests/fpga-region-test.c
>> new file mode 100644
>> index 000000000000..81b271088240
>> --- /dev/null
>> +++ b/drivers/fpga/tests/fpga-region-test.c
>> @@ -0,0 +1,186 @@
>> +// SPDX-License-Identifier: GPL-2.0
>> +/*
>> + * KUnit test for the FPGA Region
>> + *
>> + * Copyright (C) 2023 Red Hat, Inc.
>> + *
>> + * Author: Marco Pagani <marpagan@...hat.com>
>> + */
>> +
>> +#include <linux/types.h>
>> +#include <linux/module.h>
>> +#include <kunit/test.h>
>> +#include <linux/platform_device.h>
>> +#include <linux/fpga/fpga-mgr.h>
>> +#include <linux/fpga/fpga-bridge.h>
>> +#include <linux/fpga/fpga-region.h>
>> +
>> +struct mgr_stats {
>> + u32 write_count;
>> +};
>> +
>> +struct bridge_stats {
>> + u32 enable_count;
>> +};
>> +
>> +struct test_ctx {
>> + struct fpga_manager *mgr;
>> + struct platform_device *mgr_pdev;
>> + struct fpga_bridge *bridge;
>> + struct platform_device *bridge_pdev;
>> + struct fpga_region *region;
>> + struct platform_device *region_pdev;
>> + struct bridge_stats bridge_stats;
>> + struct mgr_stats mgr_stats;
>> +};
>> +
>> +static int op_write(struct fpga_manager *mgr, const char *buf, size_t count)
>> +{
>> + struct mgr_stats *stats = mgr->priv;
>> +
>> + stats->write_count++;
>
> Could you add some comments to explain why only implement the write op
> to help region test? and why not choose write_complete or other callback?
Sure, I'll do that in the next version.
Thanks,
Marco
> Thanks,
> Yilun
>
[...]
Powered by blists - more mailing lists