From: Laurentiu Tudor <laurentiu.tudor@nxp.com>
To: Diana Craciun <diana.craciun@oss.nxp.com>,
linux-kernel@vger.kernel.org, gregkh@linuxfoundation.org,
Alex Williamson <alex.williamson@redhat.com>,
kvm@vger.kernel.org
Cc: Li Yang <leoyang.li@nxp.com>, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 1/2] bus/fsl-mc: Add generic implementation for open/reset/close commands
Date: Mon, 30 Aug 2021 12:29:23 +0300 [thread overview]
Message-ID: <b0ec47ea-d32b-04bb-aea4-1c8a74bc8f99@nxp.com> (raw)
In-Reply-To: <20210825090538.4860-1-diana.craciun@oss.nxp.com>
On 8/25/2021 12:05 PM, Diana Craciun wrote:
> The open/reset/close commands format is similar for all objects.
> Currently there are multiple implementations for these commands
> scattered through various drivers. The code is cavsi-identical.
> Create a generic implementation for the open/reset/close commands.
> One of the consumer will be the VFIO driver which needs to
> be able to reset a device.
>
> Signed-off-by: Diana Craciun <diana.craciun@oss.nxp.com>
> ---
> drivers/bus/fsl-mc/Makefile | 3 +-
> drivers/bus/fsl-mc/fsl-mc-private.h | 39 +++++++++--
> drivers/bus/fsl-mc/obj-api.c | 104 ++++++++++++++++++++++++++++
> include/linux/fsl/mc.h | 14 ++++
> 4 files changed, 155 insertions(+), 5 deletions(-)
> create mode 100644 drivers/bus/fsl-mc/obj-api.c
>
> diff --git a/drivers/bus/fsl-mc/Makefile b/drivers/bus/fsl-mc/Makefile
> index 4ae292a30e53..892946245527 100644
> --- a/drivers/bus/fsl-mc/Makefile
> +++ b/drivers/bus/fsl-mc/Makefile
> @@ -15,7 +15,8 @@ mc-bus-driver-objs := fsl-mc-bus.o \
> dprc-driver.o \
> fsl-mc-allocator.o \
> fsl-mc-msi.o \
> - dpmcp.o
> + dpmcp.o \
> + obj-api.o
>
> # MC userspace support
> obj-$(CONFIG_FSL_MC_UAPI_SUPPORT) += fsl-mc-uapi.o
> diff --git a/drivers/bus/fsl-mc/fsl-mc-private.h b/drivers/bus/fsl-mc/fsl-mc-private.h
> index 1958fa065360..6055ef3e9e02 100644
> --- a/drivers/bus/fsl-mc/fsl-mc-private.h
> +++ b/drivers/bus/fsl-mc/fsl-mc-private.h
> @@ -48,7 +48,6 @@ struct dpmng_rsp_get_version {
>
> /* DPMCP command IDs */
> #define DPMCP_CMDID_CLOSE DPMCP_CMD(0x800)
> -#define DPMCP_CMDID_OPEN DPMCP_CMD(0x80b)
> #define DPMCP_CMDID_RESET DPMCP_CMD(0x005)
>
> struct dpmcp_cmd_open {
> @@ -91,7 +90,6 @@ int dpmcp_reset(struct fsl_mc_io *mc_io,
>
> /* DPRC command IDs */
> #define DPRC_CMDID_CLOSE DPRC_CMD(0x800)
> -#define DPRC_CMDID_OPEN DPRC_CMD(0x805)
> #define DPRC_CMDID_GET_API_VERSION DPRC_CMD(0xa05)
>
> #define DPRC_CMDID_GET_ATTR DPRC_CMD(0x004)
> @@ -453,7 +451,6 @@ int dprc_get_connection(struct fsl_mc_io *mc_io,
>
> /* Command IDs */
> #define DPBP_CMDID_CLOSE DPBP_CMD(0x800)
> -#define DPBP_CMDID_OPEN DPBP_CMD(0x804)
>
> #define DPBP_CMDID_ENABLE DPBP_CMD(0x002)
> #define DPBP_CMDID_DISABLE DPBP_CMD(0x003)
> @@ -492,7 +489,6 @@ struct dpbp_rsp_get_attributes {
>
> /* Command IDs */
> #define DPCON_CMDID_CLOSE DPCON_CMD(0x800)
> -#define DPCON_CMDID_OPEN DPCON_CMD(0x808)
>
> #define DPCON_CMDID_ENABLE DPCON_CMD(0x002)
> #define DPCON_CMDID_DISABLE DPCON_CMD(0x003)
> @@ -524,6 +520,41 @@ struct dpcon_cmd_set_notification {
> __le64 user_ctx;
> };
>
> +/*
> + * Generic FSL MC API
> + */
> +
> +/* generic command versioning */
> +#define OBJ_CMD_BASE_VERSION 1
> +#define OBJ_CMD_ID_OFFSET 4
> +
> +#define OBJ_CMD(id) (((id) << OBJ_CMD_ID_OFFSET) | OBJ_CMD_BASE_VERSION)
> +
> +/* open command codes */
> +#define DPRTC_CMDID_OPEN OBJ_CMD(0x810)
> +#define DPNI_CMDID_OPEN OBJ_CMD(0x801)
> +#define DPSW_CMDID_OPEN OBJ_CMD(0x802)
> +#define DPIO_CMDID_OPEN OBJ_CMD(0x803)
> +#define DPBP_CMDID_OPEN OBJ_CMD(0x804)
> +#define DPRC_CMDID_OPEN OBJ_CMD(0x805)
> +#define DPDMUX_CMDID_OPEN OBJ_CMD(0x806)
> +#define DPCI_CMDID_OPEN OBJ_CMD(0x807)
> +#define DPCON_CMDID_OPEN OBJ_CMD(0x808)
> +#define DPSECI_CMDID_OPEN OBJ_CMD(0x809)
> +#define DPAIOP_CMDID_OPEN OBJ_CMD(0x80a)
> +#define DPMCP_CMDID_OPEN OBJ_CMD(0x80b)
> +#define DPMAC_CMDID_OPEN OBJ_CMD(0x80c)
> +#define DPDCEI_CMDID_OPEN OBJ_CMD(0x80d)
> +#define DPDMAI_CMDID_OPEN OBJ_CMD(0x80e)
> +#define DPDBG_CMDID_OPEN OBJ_CMD(0x80f)
> +
> +/* Generic object command IDs */
> +#define OBJ_CMDID_CLOSE OBJ_CMD(0x800)
> +#define OBJ_CMDID_RESET OBJ_CMD(0x005)
> +
> +struct obj_cmd_open {
Nit: maybe the name should be made less generic, e.g. fsl_mc_obj_cmd_open.
Otherwise, looks good to me:
Reviewed-by: Laurentiu Tudor <laurentiu.tudor@nxp.com>
---
Best Regards, Laurentiu
prev parent reply other threads:[~2021-08-30 9:29 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-25 9:05 [PATCH 1/2] bus/fsl-mc: Add generic implementation for open/reset/close commands Diana Craciun
2021-08-25 9:05 ` [PATCH 2/2] vfio/fsl-mc: Add per device reset support Diana Craciun
2021-08-30 9:42 ` Laurentiu Tudor
2021-08-30 9:29 ` Laurentiu Tudor [this message]
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=b0ec47ea-d32b-04bb-aea4-1c8a74bc8f99@nxp.com \
--to=laurentiu.tudor@nxp.com \
--cc=alex.williamson@redhat.com \
--cc=diana.craciun@oss.nxp.com \
--cc=gregkh@linuxfoundation.org \
--cc=kvm@vger.kernel.org \
--cc=leoyang.li@nxp.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
/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