public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Mike Ximing Chen <mike.ximing.chen@intel.com>
Cc: linux-kernel@vger.kernel.org, arnd@arndb.de,
	dan.j.williams@intel.com, pierre-louis.bossart@linux.intel.com,
	Gage Eads <gage.eads@intel.com>
Subject: Re: [PATCH v8 04/20] dlb: add device ioctl layer and first three ioctls
Date: Thu, 7 Jan 2021 20:41:48 +0100	[thread overview]
Message-ID: <X/dj/NNdF0cy632k@kroah.com> (raw)
In-Reply-To: <20210105025839.23169-5-mike.ximing.chen@intel.com>

On Mon, Jan 04, 2021 at 08:58:23PM -0600, Mike Ximing Chen wrote:
> Introduce the dlb device ioctl layer and the first three ioctls: query
> device version, query available resources, and create a scheduling domain.
> Also introduce the user-space interface file dlb_user.h.
> 
> The device version query is designed to allow each DLB device version/type
> to have its own unique ioctl API through the /dev/dlb%d node. Each such API
> would share in common the device version command as its first command, and
> all subsequent commands can be unique to the particular device.
> 
> The hardware operation for scheduling domain creation will be added in a
> subsequent commit.
> 
> Signed-off-by: Gage Eads <gage.eads@intel.com>
> Signed-off-by: Mike Ximing Chen <mike.ximing.chen@intel.com>
> Reviewed-by: Magnus Karlsson <magnus.karlsson@intel.com>
> Reviewed-by: Dan Williams <dan.j.williams@intel.com>
> ---
>  .../userspace-api/ioctl/ioctl-number.rst      |   1 +
>  drivers/misc/dlb/Makefile                     |   2 +-
>  drivers/misc/dlb/dlb_bitmap.h                 |  32 ++++
>  drivers/misc/dlb/dlb_ioctl.c                  | 119 +++++++++++++
>  drivers/misc/dlb/dlb_ioctl.h                  |  11 ++
>  drivers/misc/dlb/dlb_main.c                   |   3 +
>  drivers/misc/dlb/dlb_main.h                   |   7 +
>  drivers/misc/dlb/dlb_pf_ops.c                 |  21 +++
>  drivers/misc/dlb/dlb_resource.c               |  63 +++++++
>  drivers/misc/dlb/dlb_resource.h               |   5 +
>  include/uapi/linux/dlb.h                      | 166 ++++++++++++++++++
>  11 files changed, 429 insertions(+), 1 deletion(-)
>  create mode 100644 drivers/misc/dlb/dlb_ioctl.c
>  create mode 100644 drivers/misc/dlb/dlb_ioctl.h
>  create mode 100644 include/uapi/linux/dlb.h
> 
> diff --git a/Documentation/userspace-api/ioctl/ioctl-number.rst b/Documentation/userspace-api/ioctl/ioctl-number.rst
> index 55a2d9b2ce33..afca043d59f8 100644
> --- a/Documentation/userspace-api/ioctl/ioctl-number.rst
> +++ b/Documentation/userspace-api/ioctl/ioctl-number.rst
> @@ -241,6 +241,7 @@ Code  Seq#    Include File                                           Comments
>  'h'   00-7F                                                          conflict! Charon filesystem
>                                                                       <mailto:zapman@interlan.net>
>  'h'   00-1F  linux/hpet.h                                            conflict!
> +'h'   00-1F  uapi/linux/dlb.h                                        conflict!
>  'h'   80-8F  fs/hfsplus/ioctl.c
>  'i'   00-3F  linux/i2o-dev.h                                         conflict!
>  'i'   0B-1F  linux/ipmi.h                                            conflict!
> diff --git a/drivers/misc/dlb/Makefile b/drivers/misc/dlb/Makefile
> index 8a49ea5fd752..aaafb3086d8d 100644
> --- a/drivers/misc/dlb/Makefile
> +++ b/drivers/misc/dlb/Makefile
> @@ -7,4 +7,4 @@
>  obj-$(CONFIG_INTEL_DLB) := dlb.o
>  
>  dlb-objs := dlb_main.o
> -dlb-objs += dlb_pf_ops.o dlb_resource.o
> +dlb-objs += dlb_pf_ops.o dlb_resource.o dlb_ioctl.o
> diff --git a/drivers/misc/dlb/dlb_bitmap.h b/drivers/misc/dlb/dlb_bitmap.h
> index fb3ef52a306d..3ea78b42c79f 100644
> --- a/drivers/misc/dlb/dlb_bitmap.h
> +++ b/drivers/misc/dlb/dlb_bitmap.h
> @@ -73,4 +73,36 @@ static inline void dlb_bitmap_free(struct dlb_bitmap *bitmap)
>  	kfree(bitmap);
>  }
>  
> +/**
> + * dlb_bitmap_longest_set_range() - returns longest contiguous range of set
> + *				     bits
> + * @bitmap: pointer to dlb_bitmap structure.
> + *
> + * Return:
> + * Returns the bitmap's longest contiguous range of set bits upon success,
> + * <0 otherwise.
> + *
> + * Errors:
> + * EINVAL - bitmap is NULL or is uninitialized.
> + */
> +static inline int dlb_bitmap_longest_set_range(struct dlb_bitmap *bitmap)
> +{
> +	int max_len, len;
> +	int start, end;
> +
> +	if (!bitmap || !bitmap->map)
> +		return -EINVAL;
> +
> +	if (bitmap_weight(bitmap->map, bitmap->len) == 0)
> +		return 0;
> +
> +	max_len = 0;
> +	bitmap_for_each_set_region(bitmap->map, start, end, 0, bitmap->len) {
> +		len = end - start;
> +		if (max_len < len)
> +			max_len = len;
> +	}
> +	return max_len;
> +}
> +
>  #endif /*  __DLB_OSDEP_BITMAP_H */
> diff --git a/drivers/misc/dlb/dlb_ioctl.c b/drivers/misc/dlb/dlb_ioctl.c
> new file mode 100644
> index 000000000000..c072ed9b921c
> --- /dev/null
> +++ b/drivers/misc/dlb/dlb_ioctl.c
> @@ -0,0 +1,119 @@
> +// SPDX-License-Identifier: GPL-2.0-only
> +/* Copyright(C) 2016-2020 Intel Corporation. All rights reserved. */
> +
> +#include <linux/uaccess.h>
> +#include <linux/nospec.h>
> +
> +#include <uapi/linux/dlb.h>
> +
> +#include "dlb_ioctl.h"
> +#include "dlb_main.h"
> +
> +/* [7:0]: device revision, [15:8]: device version */
> +#define DLB_SET_DEVICE_VERSION(ver, rev) (((ver) << 8) | (rev))
> +
> +static int
> +dlb_ioctl_get_device_version(struct dlb *dlb __attribute__((unused)),

We don't use __attribute__((unused)) for function variables in Linux.
Please remove and tell whatever operating system you ported this from to
get with the times :)

thanks,

greg k-h

  parent reply	other threads:[~2021-01-07 19:41 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-05  2:58 [PATCH v8 00/20] dlb: introduce DLB device driver Mike Ximing Chen
2021-01-05  2:58 ` [PATCH v8 01/20] dlb: add skeleton for DLB driver Mike Ximing Chen
2021-01-07 19:35   ` Greg KH
2021-01-09  6:09     ` Chen, Mike Ximing
2021-01-05  2:58 ` [PATCH v8 02/20] dlb: initialize device Mike Ximing Chen
2021-01-05  2:58 ` [PATCH v8 03/20] dlb: add resource and device initialization Mike Ximing Chen
2021-01-07 19:40   ` Greg KH
2021-01-10 17:22     ` Chen, Mike Ximing
2021-01-05  2:58 ` [PATCH v8 04/20] dlb: add device ioctl layer and first three ioctls Mike Ximing Chen
2021-01-07 19:41   ` Greg KH
2021-01-09  6:17     ` Chen, Mike Ximing
2021-01-07 19:41   ` Greg KH [this message]
2021-01-09  7:55     ` Chen, Mike Ximing
2021-01-07 19:50   ` Greg KH
2021-01-09  7:49     ` Chen, Mike Ximing
2021-01-09  8:33       ` Greg KH
2021-01-09 21:49         ` Dan Williams
2021-01-10 15:07           ` Greg KH
2021-01-12 21:03             ` Dan Williams
2021-01-13  9:57               ` Greg KH
2021-01-21 23:14                 ` Dan Williams
2021-01-10  4:30         ` Chen, Mike Ximing
2021-01-05  2:58 ` [PATCH v8 05/20] dlb: add scheduling domain configuration Mike Ximing Chen
2021-01-05  2:58 ` [PATCH v8 06/20] dlb: add domain software reset Mike Ximing Chen
2021-01-05  2:58 ` [PATCH v8 07/20] dlb: add low-level register reset operations Mike Ximing Chen
2021-01-05  2:58 ` [PATCH v8 08/20] dlb: add runtime power-management support Mike Ximing Chen
2021-01-05  2:58 ` [PATCH v8 09/20] dlb: add queue create, reset, get-depth ioctls Mike Ximing Chen
2021-01-05  2:58 ` [PATCH v8 10/20] dlb: add register operations for queue management Mike Ximing Chen
2021-01-05  2:58 ` [PATCH v8 11/20] dlb: add ioctl to configure ports and query poll mode Mike Ximing Chen
2021-01-05  2:58 ` [PATCH v8 12/20] dlb: add register operations for port management Mike Ximing Chen
2021-01-05  2:58 ` [PATCH v8 13/20] dlb: add port mmap support Mike Ximing Chen
2021-01-05  2:58 ` [PATCH v8 14/20] dlb: add start domain ioctl Mike Ximing Chen
2021-01-05  2:58 ` [PATCH v8 15/20] dlb: add queue map, unmap, and pending unmap operations Mike Ximing Chen
2021-01-05  2:58 ` [PATCH v8 16/20] dlb: add port map/unmap state machine Mike Ximing Chen
2021-01-05  2:58 ` [PATCH v8 17/20] dlb: add static queue map register operations Mike Ximing Chen
2021-01-05  2:58 ` [PATCH v8 18/20] dlb: add dynamic " Mike Ximing Chen
2021-01-05  2:58 ` [PATCH v8 19/20] dlb: add queue unmap " Mike Ximing Chen
2021-01-05  2:58 ` [PATCH v8 20/20] dlb: queue map/unmap workqueue Mike Ximing Chen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=X/dj/NNdF0cy632k@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=arnd@arndb.de \
    --cc=dan.j.williams@intel.com \
    --cc=gage.eads@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mike.ximing.chen@intel.com \
    --cc=pierre-louis.bossart@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox