RE: [RFC v2 2/5] drm/xe/RAS: Register netlink capability
>-Original Message- >From: Aravind Iddamsetty >Sent: Friday, October 20, 2023 11:59 AM >To: intel...@lists.freedesktop.org; dri-devel@lists.freedesktop.org; >alexander.deuc...@amd.com; airl...@gmail.com; dan...@ffwll.ch; >joonas.lahti...@linux.intel.com; ogab...@kernel.org; Tayar, Tomer (Habana) >; hawking.zh...@amd.com; >harish.kasiviswanat...@amd.com; felix.kuehl...@amd.com; >luben.tui...@amd.com; Ruhl, Michael J >Subject: [RFC v2 2/5] drm/xe/RAS: Register netlink capability > >Register netlink capability with the DRM and register the driver >callbacks to DRM RAS netlink commands. > >v2: >Move the netlink registration parts to DRM susbsytem (Tomer Tayar) > >Cc: Tomer Tayar >Signed-off-by: Aravind Iddamsetty >--- > drivers/gpu/drm/xe/Makefile | 1 + > drivers/gpu/drm/xe/xe_device.c | 4 > drivers/gpu/drm/xe/xe_device_types.h | 1 + > drivers/gpu/drm/xe/xe_netlink.c | 22 ++ > 4 files changed, 28 insertions(+) > create mode 100644 drivers/gpu/drm/xe/xe_netlink.c > >diff --git a/drivers/gpu/drm/xe/Makefile b/drivers/gpu/drm/xe/Makefile >index ed772f440689..048f9a23e2f0 100644 >--- a/drivers/gpu/drm/xe/Makefile >+++ b/drivers/gpu/drm/xe/Makefile >@@ -87,6 +87,7 @@ xe-y += xe_bb.o \ > xe_mmio.o \ > xe_mocs.o \ > xe_module.o \ >+ xe_netlink.o \ > xe_pat.o \ > xe_pci.o \ > xe_pcode.o \ >diff --git a/drivers/gpu/drm/xe/xe_device.c b/drivers/gpu/drm/xe/xe_device.c >index 628cb46a2509..8c928719a537 100644 >--- a/drivers/gpu/drm/xe/xe_device.c >+++ b/drivers/gpu/drm/xe/xe_device.c >@@ -151,6 +151,8 @@ static void xe_driver_release(struct drm_device *dev) > pci_set_drvdata(to_pci_dev(xe->drm.dev), NULL); > } > >+extern const struct driver_genl_ops xe_genl_ops[]; >+ > static struct drm_driver driver = { > /* Don't use MTRRs here; the Xserver or userspace app should >* deal with them for Intel hardware. >@@ -159,6 +161,7 @@ static struct drm_driver driver = { > DRIVER_GEM | > DRIVER_RENDER | DRIVER_SYNCOBJ | > DRIVER_SYNCOBJ_TIMELINE | DRIVER_GEM_GPUVA, >+ Gratuitous blank line? With or without this cleaned up: This looks reasonable to me. Reviewed-by: Michael J. Ruhl M > .open = xe_file_open, > .postclose = xe_file_close, > >@@ -170,6 +173,7 @@ static struct drm_driver driver = { > .show_fdinfo = xe_drm_client_fdinfo, > #endif > .release = _driver_release, >+ .genl_ops = xe_genl_ops, > > .ioctls = xe_ioctls, > .num_ioctls = ARRAY_SIZE(xe_ioctls), >diff --git a/drivers/gpu/drm/xe/xe_device_types.h >b/drivers/gpu/drm/xe/xe_device_types.h >index a1bacf820d37..8201f3644b86 100644 >--- a/drivers/gpu/drm/xe/xe_device_types.h >+++ b/drivers/gpu/drm/xe/xe_device_types.h >@@ -10,6 +10,7 @@ > > #include > #include >+#include > #include > > #include "xe_devcoredump_types.h" >diff --git a/drivers/gpu/drm/xe/xe_netlink.c b/drivers/gpu/drm/xe/xe_netlink.c >new file mode 100644 >index ..81d785455632 >--- /dev/null >+++ b/drivers/gpu/drm/xe/xe_netlink.c >@@ -0,0 +1,22 @@ >+// SPDX-License-Identifier: MIT >+/* >+ * Copyright © 2023 Intel Corporation >+ */ >+#include "xe_device.h" >+ >+static int xe_genl_list_errors(struct drm_device *drm, struct sk_buff *msg, >struct genl_info *info) >+{ >+ return 0; >+} >+ >+static int xe_genl_read_error(struct drm_device *drm, struct sk_buff *msg, >struct genl_info *info) >+{ >+ return 0; >+} >+ >+/* driver callbacks to DRM netlink commands*/ >+const struct driver_genl_ops xe_genl_ops[] = { >+ [DRM_RAS_CMD_QUERY] = { .doit = xe_genl_list_errors }, >+ [DRM_RAS_CMD_READ_ONE] ={ .doit = xe_genl_read_error }, >+ [DRM_RAS_CMD_READ_ALL] ={ .doit = xe_genl_list_errors, }, >+}; >-- >2.25.1
[RFC v2 2/5] drm/xe/RAS: Register netlink capability
Register netlink capability with the DRM and register the driver callbacks to DRM RAS netlink commands. v2: Move the netlink registration parts to DRM susbsytem (Tomer Tayar) Cc: Tomer Tayar Signed-off-by: Aravind Iddamsetty --- drivers/gpu/drm/xe/Makefile | 1 + drivers/gpu/drm/xe/xe_device.c | 4 drivers/gpu/drm/xe/xe_device_types.h | 1 + drivers/gpu/drm/xe/xe_netlink.c | 22 ++ 4 files changed, 28 insertions(+) create mode 100644 drivers/gpu/drm/xe/xe_netlink.c diff --git a/drivers/gpu/drm/xe/Makefile b/drivers/gpu/drm/xe/Makefile index ed772f440689..048f9a23e2f0 100644 --- a/drivers/gpu/drm/xe/Makefile +++ b/drivers/gpu/drm/xe/Makefile @@ -87,6 +87,7 @@ xe-y += xe_bb.o \ xe_mmio.o \ xe_mocs.o \ xe_module.o \ + xe_netlink.o \ xe_pat.o \ xe_pci.o \ xe_pcode.o \ diff --git a/drivers/gpu/drm/xe/xe_device.c b/drivers/gpu/drm/xe/xe_device.c index 628cb46a2509..8c928719a537 100644 --- a/drivers/gpu/drm/xe/xe_device.c +++ b/drivers/gpu/drm/xe/xe_device.c @@ -151,6 +151,8 @@ static void xe_driver_release(struct drm_device *dev) pci_set_drvdata(to_pci_dev(xe->drm.dev), NULL); } +extern const struct driver_genl_ops xe_genl_ops[]; + static struct drm_driver driver = { /* Don't use MTRRs here; the Xserver or userspace app should * deal with them for Intel hardware. @@ -159,6 +161,7 @@ static struct drm_driver driver = { DRIVER_GEM | DRIVER_RENDER | DRIVER_SYNCOBJ | DRIVER_SYNCOBJ_TIMELINE | DRIVER_GEM_GPUVA, + .open = xe_file_open, .postclose = xe_file_close, @@ -170,6 +173,7 @@ static struct drm_driver driver = { .show_fdinfo = xe_drm_client_fdinfo, #endif .release = _driver_release, + .genl_ops = xe_genl_ops, .ioctls = xe_ioctls, .num_ioctls = ARRAY_SIZE(xe_ioctls), diff --git a/drivers/gpu/drm/xe/xe_device_types.h b/drivers/gpu/drm/xe/xe_device_types.h index a1bacf820d37..8201f3644b86 100644 --- a/drivers/gpu/drm/xe/xe_device_types.h +++ b/drivers/gpu/drm/xe/xe_device_types.h @@ -10,6 +10,7 @@ #include #include +#include #include #include "xe_devcoredump_types.h" diff --git a/drivers/gpu/drm/xe/xe_netlink.c b/drivers/gpu/drm/xe/xe_netlink.c new file mode 100644 index ..81d785455632 --- /dev/null +++ b/drivers/gpu/drm/xe/xe_netlink.c @@ -0,0 +1,22 @@ +// SPDX-License-Identifier: MIT +/* + * Copyright © 2023 Intel Corporation + */ +#include "xe_device.h" + +static int xe_genl_list_errors(struct drm_device *drm, struct sk_buff *msg, struct genl_info *info) +{ + return 0; +} + +static int xe_genl_read_error(struct drm_device *drm, struct sk_buff *msg, struct genl_info *info) +{ + return 0; +} + +/* driver callbacks to DRM netlink commands*/ +const struct driver_genl_ops xe_genl_ops[] = { + [DRM_RAS_CMD_QUERY] = { .doit = xe_genl_list_errors }, + [DRM_RAS_CMD_READ_ONE] ={ .doit = xe_genl_read_error }, + [DRM_RAS_CMD_READ_ALL] ={ .doit = xe_genl_list_errors, }, +}; -- 2.25.1
[RFC v2 2/5] drm/xe/RAS: Register netlink capability
Register netlink capability with the DRM and register the driver callbacks to DRM RAS netlink commands. v2: Move the netlink registration parts to DRM susbsytem (Tomer Tayar) Cc: Tomer Tayar Signed-off-by: Aravind Iddamsetty --- drivers/gpu/drm/xe/Makefile | 1 + drivers/gpu/drm/xe/xe_device.c | 4 drivers/gpu/drm/xe/xe_device_types.h | 1 + drivers/gpu/drm/xe/xe_netlink.c | 22 ++ 4 files changed, 28 insertions(+) create mode 100644 drivers/gpu/drm/xe/xe_netlink.c diff --git a/drivers/gpu/drm/xe/Makefile b/drivers/gpu/drm/xe/Makefile index be1f3afec3dc..6bdea5ffb41b 100644 --- a/drivers/gpu/drm/xe/Makefile +++ b/drivers/gpu/drm/xe/Makefile @@ -86,6 +86,7 @@ xe-y += xe_bb.o \ xe_mmio.o \ xe_mocs.o \ xe_module.o \ + xe_netlink.o \ xe_pat.o \ xe_pci.o \ xe_pcode.o \ diff --git a/drivers/gpu/drm/xe/xe_device.c b/drivers/gpu/drm/xe/xe_device.c index 687dc3d79a66..21bc304af70b 100644 --- a/drivers/gpu/drm/xe/xe_device.c +++ b/drivers/gpu/drm/xe/xe_device.c @@ -150,6 +150,8 @@ static void xe_driver_release(struct drm_device *dev) pci_set_drvdata(to_pci_dev(xe->drm.dev), NULL); } +extern const struct driver_genl_ops xe_genl_ops[]; + static struct drm_driver driver = { /* Don't use MTRRs here; the Xserver or userspace app should * deal with them for Intel hardware. @@ -158,6 +160,7 @@ static struct drm_driver driver = { DRIVER_GEM | DRIVER_RENDER | DRIVER_SYNCOBJ | DRIVER_SYNCOBJ_TIMELINE | DRIVER_GEM_GPUVA, + .open = xe_file_open, .postclose = xe_file_close, @@ -169,6 +172,7 @@ static struct drm_driver driver = { .show_fdinfo = xe_drm_client_fdinfo, #endif .release = _driver_release, + .genl_ops = xe_genl_ops, .ioctls = xe_ioctls, .num_ioctls = ARRAY_SIZE(xe_ioctls), diff --git a/drivers/gpu/drm/xe/xe_device_types.h b/drivers/gpu/drm/xe/xe_device_types.h index ff476a167be4..fc6e132954e1 100644 --- a/drivers/gpu/drm/xe/xe_device_types.h +++ b/drivers/gpu/drm/xe/xe_device_types.h @@ -10,6 +10,7 @@ #include #include +#include #include #include "xe_devcoredump_types.h" diff --git a/drivers/gpu/drm/xe/xe_netlink.c b/drivers/gpu/drm/xe/xe_netlink.c new file mode 100644 index ..81d785455632 --- /dev/null +++ b/drivers/gpu/drm/xe/xe_netlink.c @@ -0,0 +1,22 @@ +// SPDX-License-Identifier: MIT +/* + * Copyright © 2023 Intel Corporation + */ +#include "xe_device.h" + +static int xe_genl_list_errors(struct drm_device *drm, struct sk_buff *msg, struct genl_info *info) +{ + return 0; +} + +static int xe_genl_read_error(struct drm_device *drm, struct sk_buff *msg, struct genl_info *info) +{ + return 0; +} + +/* driver callbacks to DRM netlink commands*/ +const struct driver_genl_ops xe_genl_ops[] = { + [DRM_RAS_CMD_QUERY] = { .doit = xe_genl_list_errors }, + [DRM_RAS_CMD_READ_ONE] ={ .doit = xe_genl_read_error }, + [DRM_RAS_CMD_READ_ALL] ={ .doit = xe_genl_list_errors, }, +}; -- 2.25.1
[RFC v2 2/5] drm/xe/RAS: Register netlink capability
Register netlink capability with the DRM and register the driver callbacks to DRM RAS netlink commands. v2: Move the netlink registration parts to DRM susbsytem (Tomer Tayar) Cc: Tomer Tayar Signed-off-by: Aravind Iddamsetty --- drivers/gpu/drm/xe/Makefile | 1 + drivers/gpu/drm/xe/xe_device.c | 6 +- drivers/gpu/drm/xe/xe_device_types.h | 1 + drivers/gpu/drm/xe/xe_netlink.c | 22 ++ 4 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 drivers/gpu/drm/xe/xe_netlink.c diff --git a/drivers/gpu/drm/xe/Makefile b/drivers/gpu/drm/xe/Makefile index b84e191ba14f..2b42165bc824 100644 --- a/drivers/gpu/drm/xe/Makefile +++ b/drivers/gpu/drm/xe/Makefile @@ -67,6 +67,7 @@ xe-y += xe_bb.o \ xe_mmio.o \ xe_mocs.o \ xe_module.o \ + xe_netlink.o \ xe_pat.o \ xe_pci.o \ xe_pcode.o \ diff --git a/drivers/gpu/drm/xe/xe_device.c b/drivers/gpu/drm/xe/xe_device.c index 323356a44e7f..42a3b50069b6 100644 --- a/drivers/gpu/drm/xe/xe_device.c +++ b/drivers/gpu/drm/xe/xe_device.c @@ -124,6 +124,8 @@ static void xe_driver_release(struct drm_device *dev) pci_set_drvdata(to_pci_dev(xe->drm.dev), NULL); } +extern const struct driver_genl_ops xe_genl_ops[]; + static struct drm_driver driver = { /* Don't use MTRRs here; the Xserver or userspace app should * deal with them for Intel hardware. @@ -131,7 +133,8 @@ static struct drm_driver driver = { .driver_features = DRIVER_GEM | DRIVER_RENDER | DRIVER_SYNCOBJ | - DRIVER_SYNCOBJ_TIMELINE, + DRIVER_SYNCOBJ_TIMELINE | + DRIVER_NETLINK, .open = xe_file_open, .postclose = xe_file_close, @@ -143,6 +146,7 @@ static struct drm_driver driver = { .dumb_create = xe_bo_dumb_create, .dumb_map_offset = drm_gem_ttm_dumb_map_offset, .release = _driver_release, + .genl_ops = xe_genl_ops, .ioctls = xe_ioctls, .num_ioctls = ARRAY_SIZE(xe_ioctls), diff --git a/drivers/gpu/drm/xe/xe_device_types.h b/drivers/gpu/drm/xe/xe_device_types.h index 682ebdd1c09e..b19053fb3130 100644 --- a/drivers/gpu/drm/xe/xe_device_types.h +++ b/drivers/gpu/drm/xe/xe_device_types.h @@ -10,6 +10,7 @@ #include #include +#include #include #include "xe_gt_types.h" diff --git a/drivers/gpu/drm/xe/xe_netlink.c b/drivers/gpu/drm/xe/xe_netlink.c new file mode 100644 index ..81d785455632 --- /dev/null +++ b/drivers/gpu/drm/xe/xe_netlink.c @@ -0,0 +1,22 @@ +// SPDX-License-Identifier: MIT +/* + * Copyright © 2023 Intel Corporation + */ +#include "xe_device.h" + +static int xe_genl_list_errors(struct drm_device *drm, struct sk_buff *msg, struct genl_info *info) +{ + return 0; +} + +static int xe_genl_read_error(struct drm_device *drm, struct sk_buff *msg, struct genl_info *info) +{ + return 0; +} + +/* driver callbacks to DRM netlink commands*/ +const struct driver_genl_ops xe_genl_ops[] = { + [DRM_RAS_CMD_QUERY] = { .doit = xe_genl_list_errors }, + [DRM_RAS_CMD_READ_ONE] ={ .doit = xe_genl_read_error }, + [DRM_RAS_CMD_READ_ALL] ={ .doit = xe_genl_list_errors, }, +}; -- 2.25.1