lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <DM6PR12MB3993C315D875CE44CA1A0B29CD5DA@DM6PR12MB3993.namprd12.prod.outlook.com>
Date:   Wed, 21 Jun 2023 04:00:53 +0000
From:   "Manne, Nava kishore" <nava.kishore.manne@....com>
To:     "mdf@...nel.org" <mdf@...nel.org>,
        "hao.wu@...el.com" <hao.wu@...el.com>,
        "yilun.xu@...el.com" <yilun.xu@...el.com>,
        "trix@...hat.com" <trix@...hat.com>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "linux-fpga@...r.kernel.org" <linux-fpga@...r.kernel.org>
Subject: RE: [RFC PATCH] fpga: fpga-bridge: Add manual set option via sysfs

Ping!

> -----Original Message-----
> From: Manne, Nava kishore <nava.kishore.manne@....com>
> Sent: Thursday, May 25, 2023 3:25 PM
> To: mdf@...nel.org; hao.wu@...el.com; yilun.xu@...el.com;
> trix@...hat.com; Manne, Nava kishore <nava.kishore.manne@....com>;
> linux-kernel@...r.kernel.org; linux-fpga@...r.kernel.org
> Subject: [RFC PATCH] fpga: fpga-bridge: Add manual set option via sysfs
> 
> This patch is intended for manual testing only.
> It is provide an option to manually test bridges.
> 
> Enabling bridge (!0 values are handled)
> br1# echo 1 > /sys/class/fpga_bridge/<bridge>/set
> 
> Disable bridge
> br1# echo 0 > /sys/class/fpga_bridge/<bridge>/set
> 
> Signed-off-by: Nava kishore Manne <nava.kishore.manne@....com>
> ---
>  .../ABI/testing/sysfs-class-fpga-bridge       |  9 ++++++
>  drivers/fpga/fpga-bridge.c                    | 30 +++++++++++++++++++
>  2 files changed, 39 insertions(+)
> 
> diff --git a/Documentation/ABI/testing/sysfs-class-fpga-bridge
> b/Documentation/ABI/testing/sysfs-class-fpga-bridge
> index 312ae2c579d8..e157eb737bfb 100644
> --- a/Documentation/ABI/testing/sysfs-class-fpga-bridge
> +++ b/Documentation/ABI/testing/sysfs-class-fpga-bridge
> @@ -9,3 +9,12 @@ Date:		January 2016
>  KernelVersion:	4.5
>  Contact:	Alan Tull <atull@...nsource.altera.com>
>  Description:	Show bridge state as "enabled" or "disabled"
> +
> +What:		/sys/class/fpga_bridge/<bridge>/set
> +Date:		May 2023
> +KernelVersion:	6.4
> +Contact:	Nava kishore Manne <nava.kishore.manne@....com>
> +Description:	Manual set bridge state (0-disable, !0 enable).
> +		Enabling this option requires that the module is
> +		compiled with #define DEBUG which is enabled by default
> +		when CONFIG_DEBUG_KERNEL is setup.
> diff --git a/drivers/fpga/fpga-bridge.c b/drivers/fpga/fpga-bridge.c index
> a6c25dee9cc1..54d15b709b10 100644
> --- a/drivers/fpga/fpga-bridge.c
> +++ b/drivers/fpga/fpga-bridge.c
> @@ -13,6 +13,12 @@
>  #include <linux/slab.h>
>  #include <linux/spinlock.h>
> 
> +/* For enabling manual bridge set(enable/disable) function */ #ifdef
> +CONFIG_DEBUG_KERNEL #undef DEBUG #define DEBUG #endif
> +
>  static DEFINE_IDA(fpga_bridge_ida);
>  static struct class *fpga_bridge_class;
> 
> @@ -307,9 +313,33 @@ static ssize_t state_show(struct device *dev,  static
> DEVICE_ATTR_RO(name);  static DEVICE_ATTR_RO(state);
> 
> +#ifdef DEBUG
> +static ssize_t set_store(struct device *dev,
> +			 struct device_attribute *attr,
> +			 const char *buf, size_t count)
> +{
> +	struct fpga_bridge *bridge = to_fpga_bridge(dev);
> +	long enable;
> +	int ret;
> +
> +	ret = kstrtol(buf, 16, &enable);
> +	if (ret)
> +		return ret;
> +
> +	if (bridge->br_ops && bridge->br_ops->enable_set)
> +		enable = bridge->br_ops->enable_set(bridge, !!enable);
> +
> +	return count;
> +}
> +static DEVICE_ATTR_WO(set);
> +#endif
> +
>  static struct attribute *fpga_bridge_attrs[] = {
>  	&dev_attr_name.attr,
>  	&dev_attr_state.attr,
> +#ifdef DEBUG
> +	&dev_attr_set.attr,
> +#endif
>  	NULL,
>  };
>  ATTRIBUTE_GROUPS(fpga_bridge);
> --
> 2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ