Add driver for GSC controller
Alexander Usyskin
maintainerv2 cover Add driver for GSC controller
GSC is a graphics system controller, it provides
a chassis controller for graphics discrete cards.
There are two MEI interfaces in GSC: HECI1 and HECI2.
This series includes instantiation of the auxiliary devices for HECI2 and mei-gsc auxiliary device driver that binds to the auxiliary device.
In v2 the platform device was replaced by the auxiliary device.
Greg KH, please review and ACK the MEI patches.
We are pushing all through gfx tree as the auxiliary device belongs there.
Alexander Usyskin (2):
mei: gsc: setup char driver alive in spite of firmware handshake
failure
mei: gsc: retrieve the firmware version
Tomas Winkler (3):
drm/i915/gsc: add gsc as a mei auxiliary device
mei: add support for graphics system controller (gsc) devices
mei: gsc: add runtime pm handlers
drivers/gpu/drm/i915/Kconfig | 1 + drivers/gpu/drm/i915/Makefile | 3 + drivers/gpu/drm/i915/gt/intel_gsc.c | 200 +++++++++++++++++ drivers/gpu/drm/i915/gt/intel_gsc.h | 37 ++++ drivers/gpu/drm/i915/gt/intel_gt.c | 3 + drivers/gpu/drm/i915/gt/intel_gt.h | 5 + drivers/gpu/drm/i915/gt/intel_gt_irq.c | 13 ++ drivers/gpu/drm/i915/gt/intel_gt_types.h | 2 + drivers/gpu/drm/i915/i915_drv.h | 8 + drivers/gpu/drm/i915/i915_pci.c | 3 +- drivers/gpu/drm/i915/i915_reg.h | 3 + drivers/gpu/drm/i915/intel_device_info.h | 2 + drivers/misc/mei/Kconfig | 14 ++ drivers/misc/mei/Makefile | 3 + drivers/misc/mei/bus-fixup.c | 25 +++ drivers/misc/mei/gsc-me.c | 271 +++++++++++++++++++++++ drivers/misc/mei/hw-me.c | 29 ++- drivers/misc/mei/hw-me.h | 2 + include/linux/mei_aux.h | 19 ++ 19 files changed, 640 insertions(+), 3 deletions(-) create mode 100644 drivers/gpu/drm/i915/gt/intel_gsc.c create mode 100644 drivers/gpu/drm/i915/gt/intel_gsc.h create mode 100644 drivers/misc/mei/gsc-me.c create mode 100644 include/linux/mei_aux.h
Signature · 1 line
2.32.0
Alexander Usyskin
maintainerPATCH v2 1/5 drm/i915/gsc: add gsc as a mei auxiliary device
From: Tomas Winkler <[email protected]>
GSC is a graphics system controller, it provides
a chassis controller for graphics discrete cards.
There are two MEI interfaces in GSC: HECI1 and HECI2.
Both interfaces are on the BAR0 at offsets 0x00258000 and 0x00259000. GSC is a GT Engine (class 4: instance 6). HECI1 interrupt is signaled via bit 15 and HECI2 via bit 14 in the interrupt register.
This patch exports GSC as auxiliary device for mei driver to bind to for HECI2 interface.
--- drivers/gpu/drm/i915/Kconfig | 1 + drivers/gpu/drm/i915/Makefile | 3 + drivers/gpu/drm/i915/gt/intel_gsc.c | 200 +++++++++++++++++++++++ drivers/gpu/drm/i915/gt/intel_gsc.h | 37 +++++ drivers/gpu/drm/i915/gt/intel_gt.c | 3 + drivers/gpu/drm/i915/gt/intel_gt.h | 5 + drivers/gpu/drm/i915/gt/intel_gt_irq.c | 13 ++ drivers/gpu/drm/i915/gt/intel_gt_types.h | 2 + drivers/gpu/drm/i915/i915_drv.h | 8 + drivers/gpu/drm/i915/i915_pci.c | 3 +- drivers/gpu/drm/i915/i915_reg.h | 3 + drivers/gpu/drm/i915/intel_device_info.h | 2 + include/linux/mei_aux.h | 19 +++ 13 files changed, 298 insertions(+), 1 deletion(-) create mode 100644 drivers/gpu/drm/i915/gt/intel_gsc.c create mode 100644 drivers/gpu/drm/i915/gt/intel_gsc.h create mode 100644 include/linux/mei_aux.h
drivers/gpu/drm/i915/Kconfig +1 -0
@@ -27,6 +27,7 @@ config DRM_I915 select CEC_CORE if CEC_NOTIFIER select VMAP_PFN select DRM_TTM + select AUXILIARY_BUS help Choose this option if you have a system that has "Intel Graphics Media Accelerator" or "HD Graphics" integrated graphics,
drivers/gpu/drm/i915/Makefile +3 -0
@@ -193,6 +193,9 @@ i915-y += gt/uc/intel_uc.o \ gt/uc/intel_huc_debugfs.o \ gt/uc/intel_huc_fw.o +# graphics system controller (GSC) support +i915-y += gt/intel_gsc.o + # modesetting core code i915-y += \ display/intel_atomic.o \
drivers/gpu/drm/i915/gt/intel_gsc.c new file +200 -0
200 lines not on this page · raw message
drivers/gpu/drm/i915/gt/intel_gsc.h new file +37 -0
@@ -0,0 +1,37 @@ +/* SPDX-License-Identifier: MIT */ +/* +* Copyright(c) 2019-2022, Intel Corporation. All rights reserved. +*/ +#ifndef __INTEL_GSC_DEV_H__ +#define __INTEL_GSC_DEV_H__ + +#include <linux/types.h> + +struct drm_i915_private ; +struct intel_gt ; +struct mei_aux_device ; + +#define INTEL_GSC_NUM_INTERFACES 2 +/* +* The HECI1 bit corresponds to bit15 and HECI2 to bit14. +* The reason for this is to allow growth for more interfaces in the future. +*/ +#define GSC_IRQ_INTF (_x) BIT(15 - (_x)) + +/** +* struct intel_gsc - graphics security controller +* @intf : gsc interface +*/ +struct intel_gsc { +struct intel_gsc_intf { +struct mei_aux_device *adev; +int irq; +unsigned int id; + } intf[INTEL_GSC_NUM_INTERFACES ]; +}; + +void intel_gsc_init (struct intel_gsc *gsc,struct drm_i915_private *dev_priv); +void intel_gsc_fini (struct intel_gsc *gsc); +void gsc_irq_handler (struct intel_gt *gt,u32 iir); + +#endif /* __INTEL_GSC_DEV_H__ */
drivers/gpu/drm/i915/gt/intel_gt.c +3 -0
@@ -436,6 +436,8 @@ void intel_gt_chipset_flush(struct intel_gt *gt)void intel_gt_driver_register (struct intel_gt *gt) { +intel_gsc_init (>->gsc, gt->i915); +intel_rps_driver_register (>->rps);intel_gt_debugfs_register (gt);
@@ -756,6 +758,7 @@ void intel_gt_driver_unregister(struct intel_gt *gt)intel_wakeref_t wakeref;intel_rps_driver_unregister (>->rps); +intel_gsc_fini (>->gsc);intel_pxp_fini (>->pxp);
drivers/gpu/drm/i915/gt/intel_gt.h +5 -0
@@ -34,6 +34,11 @@ static inline struct intel_gt *huc_to_gt(struct intel_huc *huc) return container_of(huc, struct intel_gt, uc.huc); } +static inline struct intel_gt *gsc_to_gt (struct intel_gsc *gsc) +{ + return container_of(gsc, struct intel_gt, gsc); +} +void intel_gt_init_early (struct intel_gt *gt,struct drm_i915_private *i915);void intel_gt_init_hw_early (struct intel_gt *gt,struct i915_ggtt *ggtt);int intel_gt_probe_lmem (struct intel_gt *gt);
drivers/gpu/drm/i915/gt/intel_gt_irq.c +13 -0
@@ -68,6 +68,9 @@ gen11_other_irq_handler(struct intel_gt *gt, const u8 instance,if (instance ==OTHER_KCR_INSTANCE )return intel_pxp_irq_handler (>->pxp, iir); +if (instance ==OTHER_GSC_INSTANCE ) +return gsc_irq_handler (gt, iir); +WARN_ONCE (1 ,"unhandled other interrupt instance=0x%x, iir=0x%x\n" , instance, iir); }
@@ -182,6 +185,8 @@ void gen11_gt_irq_reset(struct intel_gt *gt)/* Disable RCS, BCS, VCS and VECS class engines. */ intel_uncore_write (uncore,GEN11_RENDER_COPY_INTR_ENABLE ,0 );intel_uncore_write (uncore,GEN11_VCS_VECS_INTR_ENABLE ,0 ); +if (HAS_HECI_GSC (gt->i915)) +intel_uncore_write (uncore,GEN11_GUNIT_CSME_INTR_ENABLE ,0 );/* Restore masks irqs on RCS, BCS, VCS and VECS engines. */ intel_uncore_write (uncore,GEN11_RCS0_RSVD_INTR_MASK , ~0 );
@@ -195,6 +200,8 @@ void gen11_gt_irq_reset(struct intel_gt *gt)intel_uncore_write (uncore,GEN11_VECS0_VECS1_INTR_MASK , ~0 );if (HAS_ENGINE (gt,VECS2 ) ||HAS_ENGINE (gt,VECS3 ))intel_uncore_write (uncore,GEN12_VECS2_VECS3_INTR_MASK , ~0 ); +if (HAS_HECI_GSC (gt->i915)) +intel_uncore_write (uncore,GEN11_GUNIT_CSME_INTR_MASK , ~0 );intel_uncore_write (uncore,GEN11_GPM_WGBOXPERF_INTR_ENABLE ,0 );intel_uncore_write (uncore,GEN11_GPM_WGBOXPERF_INTR_MASK , ~0 );
@@ -209,6 +216,7 @@ void gen11_gt_irq_postinstall(struct intel_gt *gt) {struct intel_uncore *uncore = gt->uncore;u32 irqs =GT_RENDER_USER_INTERRUPT ; +const u32 gsc_mask =GSC_IRQ_INTF (0 ) |GSC_IRQ_INTF (1 );u32 dmask;u32 smask;
@@ -225,6 +233,9 @@ void gen11_gt_irq_postinstall(struct intel_gt *gt)/* Enable RCS, BCS, VCS and VECS class interrupts. */ intel_uncore_write (uncore,GEN11_RENDER_COPY_INTR_ENABLE , dmask);intel_uncore_write (uncore,GEN11_VCS_VECS_INTR_ENABLE , dmask); +if (HAS_HECI_GSC (gt->i915)) +intel_uncore_write (uncore,GEN11_GUNIT_CSME_INTR_ENABLE , + gsc_mask);/* Unmask irqs on RCS, BCS, VCS and VECS engines. */ intel_uncore_write (uncore,GEN11_RCS0_RSVD_INTR_MASK , ~smask);
@@ -238,6 +249,8 @@ void gen11_gt_irq_postinstall(struct intel_gt *gt)intel_uncore_write (uncore,GEN11_VECS0_VECS1_INTR_MASK , ~dmask);if (HAS_ENGINE (gt,VECS2 ) ||HAS_ENGINE (gt,VECS3 ))intel_uncore_write (uncore,GEN12_VECS2_VECS3_INTR_MASK , ~dmask); +if (HAS_HECI_GSC (gt->i915)) +intel_uncore_write (uncore,GEN11_GUNIT_CSME_INTR_MASK ,0 );/* * RPS interrupts will get enabled/disabled on demand when RPS itself * is enabled/disabled.
drivers/gpu/drm/i915/gt/intel_gt_types.h +2 -0
@@ -16,6 +16,7 @@#include <linux/workqueue.h> #include "uc/intel_uc.h" +#include "intel_gsc.h" #include "i915_vma.h" #include "intel_engine_types.h"
@@ -72,6 +73,7 @@ struct intel_gt {struct i915_ggtt *ggtt;struct intel_uc uc; +struct intel_gsc gsc;struct i915_wa_list wa_list;
drivers/gpu/drm/i915/i915_drv.h +8 -0
@@ -1496,6 +1496,14 @@ IS_SUBPLATFORM(const struct drm_i915_private *i915,#define HAS_DMC (dev_priv) (INTEL_INFO(dev_priv)->display.has_dmc) +#define HAS_HECI_PXP (dev_priv) \ + (INTEL_INFO(dev_priv)->has_heci_pxp) + +#define HAS_HECI_GSCFI (dev_priv) \ + (INTEL_INFO(dev_priv)->has_heci_gscfi) + +#define HAS_HECI_GSC (dev_priv) (HAS_HECI_PXP(dev_priv) || HAS_HECI_GSCFI(dev_priv)) +#define HAS_MSO (i915) (GRAPHICS_VER(i915) >= 12)#define HAS_RUNTIME_PM (dev_priv) (INTEL_INFO(dev_priv)->has_runtime_pm)
drivers/gpu/drm/i915/i915_pci.c +2 -1
@@ -899,7 +899,8 @@ static const struct intel_device_info rkl_info = { .has_llc = 0, \ .has_pxp = 0, \ .has_snoop = 1, \ - .is_dgfx = 1 + .is_dgfx = 1, \ + .has_heci_gscfi = 1 static const struct intel_device_info dg1_info = {GEN12_FEATURES ,
drivers/gpu/drm/i915/i915_reg.h +3 -0
@@ -1768,6 +1768,8 @@#define GEN11_VEBOX2_RING_BASE 0x1d8000#define XEHP_VEBOX3_RING_BASE 0x1e8000#define XEHP_VEBOX4_RING_BASE 0x1f8000 +#define GSC_DG1_HECI1_BASE 0x00258000 +#define GSC_DG1_HECI2_BASE 0x00259000#define BLT_RING_BASE 0x22000
@@ -7270,6 +7272,7 @@ enum {#define OTHER_GUC_INSTANCE 0#define OTHER_GTPM_INSTANCE 1#define OTHER_KCR_INSTANCE 4 +#define OTHER_GSC_INSTANCE 6#define GEN11_INTR_IDENTITY_REG (x) _MMIO(0x190060 + ((x) * 4))
drivers/gpu/drm/i915/intel_device_info.h +2 -0
@@ -133,6 +133,8 @@ enum intel_ppgtt_type {func (has_reset_engine); \func (has_global_mocs); \func (has_gt_uc); \ +func (has_heci_pxp); \ +func (has_heci_gscfi); \func (has_l3_dpf); \func (has_llc); \func (has_logical_ring_contexts); \
include/linux/mei_aux.h new file +19 -0
@@ -0,0 +1,19 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* +* Copyright (c) 2022, Intel Corporation. All rights reserved. +*/ +#ifndef _LINUX_MEI_AUX_H +#define _LINUX_MEI_AUX_H + +#include <linux/auxiliary_bus.h> + +struct mei_aux_device { +struct auxiliary_device aux_dev; +int irq; +struct resource bar; +}; + +#define auxiliary_dev_to_mei_aux_dev (auxiliary_dev) \ + container_of(auxiliary_dev, struct mei_aux_device, aux_dev) + +#endif /* _LINUX_MEI_AUX_H */
Signature · 1 line
2.32.0
Alexander Usyskin
maintainerPATCH v2 2/5 mei: add support for graphics system controller (gsc) devices
In reply to Alexander UsyskinFrom: Tomas Winkler <[email protected]>
GSC is a graphics system controller, based on CSE, it provides a chassis controller for graphics discrete cards, as well as it supports media protection on selected devices.
mei_gsc binds to a auxiliary devices exposed by Intel discrete driver i915.
--- drivers/misc/mei/Kconfig | 14 +++ drivers/misc/mei/Makefile | 3 + drivers/misc/mei/gsc-me.c | 192 ++++++++++++++++++++++++++++++++++++++ drivers/misc/mei/hw-me.c | 27 +++++- drivers/misc/mei/hw-me.h | 2 + 5 files changed, 236 insertions(+), 2 deletions(-) create mode 100644 drivers/misc/mei/gsc-me.c
drivers/misc/mei/Kconfig +14 -0
@@ -46,6 +46,20 @@ config INTEL_MEI_TXE Supported SoCs: Intel Bay Trail +config INTEL_MEI_GSC + tristate "Intel MEI GSC embedded device" + select INTEL_MEI + select INTEL_MEI_ME + depends on X86 && PCI + depends on DRM_I915 + help + Intel auxiliary driver for GSC devices embedded in Intel graphics devices. + + An MEI device here called GSC can be embedded in an + Intel graphics devices, to support a range of chassis + tasks such as graphics card firmware update and security + tasks. + source "drivers/misc/mei/hdcp/Kconfig" source "drivers/misc/mei/pxp/Kconfig"
drivers/misc/mei/Makefile +3 -0
@@ -18,6 +18,9 @@ obj-$(CONFIG_INTEL_MEI_ME) += mei-me.o mei-me-objs := pci-me.o mei-me-objs += hw-me.o +obj-$(CONFIG_INTEL_MEI_GSC) += mei-gsc.o +mei-gsc-objs := gsc-me.o + obj-$(CONFIG_INTEL_MEI_TXE) += mei-txe.o mei-txe-objs := pci-txe.o mei-txe-objs += hw-txe.o
drivers/misc/mei/gsc-me.c new file +192 -0
192 lines not on this page · raw message
drivers/misc/mei/hw-me.c +25 -2
@@ -1226,6 +1226,7 @@ irqreturn_t mei_me_irq_quick_handler(int irq, void *dev_id)me_intr_disable (dev, hcsr);return IRQ_WAKE_THREAD ; } +EXPORT_SYMBOL_GPL (mei_me_irq_quick_handler);/** * mei_me_irq_thread_handler - function called after ISR to handle the interrupt
@@ -1320,6 +1321,7 @@ irqreturn_t mei_me_irq_thread_handler(int irq, void *dev_id)mutex_unlock (&dev->device_lock);return IRQ_HANDLED ; } +EXPORT_SYMBOL_GPL (mei_me_irq_thread_handler);static const struct mei_hw_ops mei_me_hw_ops = {
@@ -1433,6 +1435,12 @@ static bool mei_me_fw_type_sps(const struct pci_dev *pdev)#define MEI_CFG_KIND_ITOUCH \ .kind = "itouch" +#define MEI_CFG_TYPE_GSC \ + .kind = "gsc" + +#define MEI_CFG_TYPE_GSCFI \ + .kind = "gscfi" +#define MEI_CFG_FW_SPS \ .quirk_probe = mei_me_fw_type_sps
@@ -1565,6 +1573,18 @@ static const struct mei_cfg mei_me_pch15_sps_cfg = { MEI_CFG_FW_SPS, }; +/* Graphics System Controller */ +static const struct mei_cfg mei_me_gsc_cfg = { +MEI_CFG_TYPE_GSC , +MEI_CFG_PCH8_HFS , +}; + +/* Graphics System Controller Firmware Interface */ +static const struct mei_cfg mei_me_gscfi_cfg = { +MEI_CFG_TYPE_GSCFI , +MEI_CFG_PCH8_HFS , +}; +/* * mei_cfg_list - A list of platform platform specific configurations. * Note: has to be synchronized with enum mei_cfg_idx.
@@ -1585,6 +1605,8 @@ static const struct mei_cfg *const mei_cfg_list[] = { [MEI_ME_PCH12_SPS_ITOUCH_CFG] = &mei_me_pch12_itouch_sps_cfg, [MEI_ME_PCH15_CFG] = &mei_me_pch15_cfg, [MEI_ME_PCH15_SPS_CFG] = &mei_me_pch15_sps_cfg, + [MEI_ME_GSC_CFG] = &mei_me_gsc_cfg, + [MEI_ME_GSCFI_CFG] = &mei_me_gscfi_cfg, };const struct mei_cfg *mei_me_get_cfg (kernel_ulong_t idx)
@@ -1595,7 +1617,8 @@ const struct mei_cfg *mei_me_get_cfg(kernel_ulong_t idx)return NULL ;return mei_cfg_list[idx]; -}; +} +EXPORT_SYMBOL_GPL (mei_me_get_cfg);/** * mei_me_dev_init - allocates and initializes the mei device structure
@@ -1630,4 +1653,4 @@ struct mei_device *mei_me_dev_init(struct device *parent,return dev; } - +EXPORT_SYMBOL_GPL (mei_me_dev_init);
drivers/misc/mei/hw-me.h +2 -0
@@ -112,6 +112,8 @@ enum mei_cfg_idx {MEI_ME_PCH12_SPS_ITOUCH_CFG ,MEI_ME_PCH15_CFG ,MEI_ME_PCH15_SPS_CFG , +MEI_ME_GSC_CFG , +MEI_ME_GSCFI_CFG , MEI_ME_NUM_CFG, };
Signature · 1 line
2.32.0
Greg Kroah-Hartman
maintainerRe: [PATCH v2 2/5] mei: add support for graphics system controller (gsc) devices
Quoted 25 lines · Alexander Usyskin
From: Tomas Winkler <[email protected]>
GSC is a graphics system controller, based on CSE, it provides a chassis controller for graphics discrete cards, as well as it supports media protection on selected devices.
mei_gscbinds to a auxiliary devices exposed by Intel discrete driver i915.Signed-off-by Alexander Usyskin <[email protected]>Signed-off-by Tomas Winkler <[email protected]>--- drivers/misc/mei/Kconfig | 14 +++ drivers/misc/mei/Makefile | 3 + drivers/misc/mei/gsc-me.c | 192 ++++++++++++++++++++++++++++++++++++++ drivers/misc/mei/hw-me.c | 27 +++++- drivers/misc/mei/hw-me.h | 2 + 5 files changed, 236 insertions(+), 2 deletions(-) create mode 100644 drivers/misc/mei/gsc-me.cdrivers/misc/mei/Kconfig +0
-0
drivers/misc/mei/Kconfig config INTEL_MEI_TXE · line 52
Quoted 7 lines
drivers/misc/mei/Kconfig +4
-0@@ -46,6 +46,20 @@ config INTEL_MEI_TXE Supported SoCs: Intel Bay Trail +config INTEL_MEI_GSC + tristate "Intel MEI GSC embedded device" + select INTEL_MEI + select INTEL_MEI_ME
Please don't select, why not just depend on?
thanks,
greg k-h
Usyskin, Alexander
maintainerRE: [PATCH v2 2/5] mei: add support for graphics system controller (gsc) devices
Quoted 44 lines
-----Original Message-----
From: Greg Kroah-Hartman <[email protected]>
Sent: Wednesday, January 26, 2022 20:06
To: Usyskin, Alexander <[email protected]>
Cc: Jani Nikula <[email protected]>; Joonas Lahtinen <[email protected]>; Vivi, Rodrigo <[email protected]>; David Airlie <[email protected]>; Daniel Vetter <[email protected]>; Winkler, Tomas <[email protected]>; Lubart, Vitaly <[email protected]>; [email protected]; [email protected]
Subject: Re: [PATCH v2 2/5] mei: add support for graphics system controller (gsc) devicesQuoted 9 lines · Alexander Usyskin
From: Tomas Winkler <[email protected]>
GSC is a graphics system controller, based on CSE, it provides a chassis controller for graphics discrete cards, as well as it supports media protection on selected devices.
mei_gscbinds to a auxiliary devices exposed by Intel discrete driver i915.Quoted 6 lines
Signed-off-by Alexander Usyskin <[email protected]>Signed-off-by Tomas Winkler <[email protected]>--- drivers/misc/mei/Kconfig | 14 +++ drivers/misc/mei/Makefile | 3 + drivers/misc/mei/gsc-me.c | 192++++++++++++++++++++++++++++++++++++++
Quoted 13 lines
drivers/misc/mei/hw-me.c | 27 +++++- drivers/misc/mei/hw-me.h | 2 + 5 files changed, 236 insertions(+), 2 deletions(-) create mode 100644 drivers/misc/mei/gsc-me.cdrivers/misc/mei/Kconfig +0
-0@@ -46,6 +46,20 @@ config INTEL_MEI_TXE Supported SoCs: Intel Bay Trail
Quoted 6 lines
drivers/misc/mei/Kconfig config INTEL_MEI_TXE · line 52
Quoted 4 lines
drivers/misc/mei/Kconfig +4
-0+config INTEL_MEI_GSC + tristate "Intel MEI GSC embedded device" + select INTEL_MEI + select INTEL_MEI_MEPlease don't select, why not just depend on?
These are hard dependencies. If user wants to have INTEL_GSC, user should enable INTEL_MEI and INTEL_MEI_ME anyway.
INTEL_MEI_ME selects INTEL_MEI in this file and it was taken as example.
What is wrong with select? Why to avoid it use?
Signature · 2 lines
Thanks, Sasha
Quoted 4 lines
thanks,
greg k-h
Jani Nikula
maintainerRE: [PATCH v2 2/5] mei: add support for graphics system controller (gsc) devices
Quoted 49 lines · Alexander
Quoted 42 lines
-----Original Message-----
From: Greg Kroah-Hartman <[email protected]>
Sent: Wednesday, January 26, 2022 20:06
To: Usyskin, Alexander <[email protected]>
Cc: Jani Nikula <[email protected]>; Joonas Lahtinen <[email protected]>; Vivi, Rodrigo <[email protected]>; David Airlie <[email protected]>; Daniel Vetter <[email protected]>; Winkler, Tomas <[email protected]>; Lubart, Vitaly <[email protected]>; [email protected]; [email protected]
Subject: Re: [PATCH v2 2/5] mei: add support for graphics system controller (gsc) devicesQuoted 9 lines · Alexander Usyskin
From: Tomas Winkler <[email protected]>
GSC is a graphics system controller, based on CSE, it provides a chassis controller for graphics discrete cards, as well as it supports media protection on selected devices.
mei_gscbinds to a auxiliary devices exposed by Intel discrete driver i915.Quoted 6 lines
Signed-off-by Alexander Usyskin <[email protected]>Signed-off-by Tomas Winkler <[email protected]>--- drivers/misc/mei/Kconfig | 14 +++ drivers/misc/mei/Makefile | 3 + drivers/misc/mei/gsc-me.c | 192++++++++++++++++++++++++++++++++++++++
Quoted 13 lines
drivers/misc/mei/hw-me.c | 27 +++++- drivers/misc/mei/hw-me.h | 2 + 5 files changed, 236 insertions(+), 2 deletions(-) create mode 100644 drivers/misc/mei/gsc-me.cdrivers/misc/mei/Kconfig +0
-0@@ -46,6 +46,20 @@ config INTEL_MEI_TXE Supported SoCs: Intel Bay TrailQuoted 6 lines
drivers/misc/mei/Kconfig config INTEL_MEI_TXE · line 52
Quoted 4 lines
drivers/misc/mei/Kconfig +4
-0+config INTEL_MEI_GSC + tristate "Intel MEI GSC embedded device" + select INTEL_MEI + select INTEL_MEI_MEPlease don't select, why not just depend on?
Quoted 2 lines
These are hard dependencies. If user wants to have
INTEL_GSC, user should enableINTEL_MEIandINTEL_MEI_MEanyway.
Isn't that exactly what depends on conveys?
Quoted 3 lines
INTEL_MEI_MEselectsINTEL_MEIin this file and it was taken as example.What is wrong with select? Why to avoid it use?
Documentation/kbuild/kconfig-language.rst:
Note:
select should be used with care. select will force a symbol to a value without visiting the dependencies. By abusing select you are able to select a symbol FOO even if FOO depends on BAR that is not set.
In general use select only for non-visible symbols (no prompts anywhere) and for symbols with no dependencies. That will limit the usefulness but on the other hand avoid the illegal configurations all over.
If we followed that rule, we'd have a lot less kconfig dependency issues.
If I had the time, I'd add a lint/verbose mode to scripts/kconfig tool to warn about selecting symbols that are visible or have dependencies.
BR,
Jani.
Signature · 1 line
Jani Nikula, Intel Open Source Graphics Center
Alexander Usyskin
maintainerPATCH v2 3/5 mei: gsc: setup char driver alive in spite of firmware handshake failure
In reply to Alexander UsyskinSetup char device in spite of firmware handshake failure.
In order to provide host access to the firmware status registers and other information required for the manufacturing process.
--- drivers/misc/mei/gsc-me.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
drivers/misc/mei/gsc-me.c +6 -5
@@ -79,11 +79,12 @@ static int mei_gsc_probe(struct auxiliary_device *aux_dev,pm_runtime_set_active (device);pm_runtime_enable (device); -if (mei_start (dev)) { -dev_err (device,"init hw failure.\n" ); - ret = -ENODEV ; - goto err; - } +/* Continue to char device setup in spite of firmware handshake failure. +* In order to provide access to the firmware status registers to the user +* space via sysfs. +*/ +if (mei_start (dev)) +dev_warn (device,"init hw failure.\n" );pm_runtime_set_autosuspend_delay (device,MEI_GSC_RPM_TIMEOUT );pm_runtime_use_autosuspend (device);
Signature · 1 line
2.32.0
Alexander Usyskin
maintainerPATCH v2 4/5 mei: gsc: add runtime pm handlers
In reply to Alexander UsyskinFrom: Tomas Winkler <[email protected]>
Implement runtime handlers for mei-gsc, to track idle state of the device properly.
--- drivers/misc/mei/gsc-me.c | 80 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 79 insertions(+), 1 deletion(-)
drivers/misc/mei/gsc-me.c +79 -1
@@ -158,7 +158,85 @@ static int __maybe_unused mei_gsc_pm_resume(struct device *device)return 0 ; } -static SIMPLE_DEV_PM_OPS(mei_gsc_pm_ops, mei_gsc_pm_suspend, mei_gsc_pm_resume); +static int __maybe_unused mei_gsc_pm_runtime_idle (struct device *device) +{ +struct mei_device *dev; + +dev_dbg (device,"rpm: me: runtime_idle\n" ); + + dev =dev_get_drvdata (device); +if (!dev) +return -ENODEV ; +if (mei_write_is_idle (dev)) +pm_runtime_autosuspend (device); + +return -EBUSY ; +} + +static int __maybe_unused mei_gsc_pm_runtime_suspend (struct device *device) +{ +struct mei_device *dev; +struct mei_me_hw *hw; +int ret; + +dev_dbg (device,"rpm: me: runtime suspend\n" ); + + dev =dev_get_drvdata (device); +if (!dev) +return -ENODEV ; + +mutex_lock (&dev->device_lock); + +if (mei_write_is_idle (dev)) { + hw =to_me_hw (dev); + hw->pg_state =MEI_PG_ON ; + ret =0 ; + }else { + ret = -EAGAIN ; + } + +mutex_unlock (&dev->device_lock); + +dev_dbg (device,"rpm: me: runtime suspend ret=%d\n" , ret); + +return ret; +} + +static int __maybe_unused mei_gsc_pm_runtime_resume (struct device *device) +{ +struct mei_device *dev; +struct mei_me_hw *hw; +irqreturn_t irq_ret; + +dev_dbg (device,"rpm: me: runtime resume\n" ); + + dev =dev_get_drvdata (device); +if (!dev) +return -ENODEV ; + +mutex_lock (&dev->device_lock); + + hw =to_me_hw (dev); + hw->pg_state =MEI_PG_OFF ; + +mutex_unlock (&dev->device_lock); + + irq_ret =mei_me_irq_thread_handler (1 , dev); +if (irq_ret !=IRQ_HANDLED ) +dev_err (dev->dev,"thread handler fail %d\n" , irq_ret); + +dev_dbg (device,"rpm: me: runtime resume ret = 0\n" ); + +return 0 ; +} + +static const struct dev_pm_ops mei_gsc_pm_ops = { + SET_SYSTEM_SLEEP_PM_OPS(mei_gsc_pm_suspend, + mei_gsc_pm_resume) +SET_RUNTIME_PM_OPS (mei_gsc_pm_runtime_suspend, + mei_gsc_pm_runtime_resume, + mei_gsc_pm_runtime_idle) +};static const struct auxiliary_device_id mei_gsc_id_table[] = { {
Signature · 1 line
2.32.0
Greg Kroah-Hartman
maintainerRe: [PATCH v2 4/5] mei: gsc: add runtime pm handlers
Quoted 33 lines · Alexander Usyskin
From: Tomas Winkler <[email protected]>
Implement runtime handlers for mei-gsc, to track idle state of the device properly.
CC Rodrigo Vivi <[email protected]>Signed-off-by Tomas Winkler <[email protected]>Signed-off-by Alexander Usyskin <[email protected]>--- drivers/misc/mei/gsc-me.c | 80 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 79 insertions(+), 1 deletion(-)drivers/misc/mei/gsc-me.c +12
-1@@ -158,7 +158,85 @@ static int __maybe_unused mei_gsc_pm_resume(struct device *device)return 0 ; } -static SIMPLE_DEV_PM_OPS(mei_gsc_pm_ops, mei_gsc_pm_suspend, mei_gsc_pm_resume); +static int __maybe_unused mei_gsc_pm_runtime_idle (struct device *device) +{ +struct mei_device *dev; + +dev_dbg (device,"rpm: me: runtime_idle\n" ); + + dev =dev_get_drvdata (device); +if (!dev) +return -ENODEV ; +if (mei_write_is_idle (dev)) +pm_runtime_autosuspend (device); +
drivers/misc/mei/gsc-me.c static int __maybe_unused mei_gsc_pm_resume(struct device *device) · line 182
Quoted 10 lines
drivers/misc/mei/gsc-me.c +10
-0+return -EBUSY ; +} + +static int __maybe_unused mei_gsc_pm_runtime_suspend (struct device *device) +{ +struct mei_device *dev; +struct mei_me_hw *hw; +int ret; + +dev_dbg (device,"rpm: me: runtime suspend\n" );
No need for debugging code to remain, use ftrace if you really need it.
Same for other dev_dbg() calls in this patch, they can all be removed.
thanks,
greg k-h
Alexander Usyskin
maintainerPATCH v2 5/5 mei: gsc: retrieve the firmware version
In reply to Alexander UsyskinAdd a hook to retrieve the firmware version of the
GSC devices to bus-fixup.
GSC has a different MKHI clients GUIDs but the same message structure to retrieve the firmware version as MEI so mei_fwver() can be reused.
--- drivers/misc/mei/bus-fixup.c | 25 +++++++++++++++++++++++++ drivers/misc/mei/hw-me.c | 2 ++ 2 files changed, 27 insertions(+)
drivers/misc/mei/bus-fixup.c +25 -0
@@ -30,6 +30,12 @@ static const uuid_le mei_nfc_info_guid = MEI_UUID_NFC_INFO;#define MEI_UUID_MKHIF_FIX UUID_LE(0x55213584, 0x9a29, 0x4916, \ 0xba, 0xdf, 0xf, 0xb7, 0xed, 0x68, 0x2a, 0xeb) +#define MEI_UUID_IGSC_MKHI UUID_LE(0xE2C2AFA2, 0x3817, 0x4D19, \ + 0x9D, 0x95, 0x06, 0xB1, 0x6B, 0x58, 0x8A, 0x5D) + +#define MEI_UUID_IGSC_MKHI_FIX UUID_LE(0x46E0C1FB, 0xA546, 0x414F, \ + 0x91, 0x70, 0xB7, 0xF4, 0x6D, 0x57, 0xB4, 0xAD) +#define MEI_UUID_HDCP UUID_LE(0xB638AB7E, 0x94E2, 0x4EA2, \ 0xA5, 0x52, 0xD1, 0xC5, 0x4B, 0x62, 0x7F, 0x04)
@@ -241,6 +247,23 @@ static void mei_mkhi_fix(struct mei_cl_device *cldev)mei_cldev_disable (cldev); } +static void mei_gsc_mkhi_ver (struct mei_cl_device *cldev) +{ +int ret; + +/* No need to enable the client if nothing is needed from it */ +if (!cldev->bus->fw_f_fw_ver_supported) +return ; + + ret =mei_cldev_enable (cldev); +if (ret) +return ; + + ret =mei_fwver (cldev); +if (ret <0 ) +dev_err (&cldev->dev,"FW version command failed %d\n" , ret); +mei_cldev_disable (cldev); +}/** * mei_wd - wd client on the bus, change protocol version * as the API has changed.
@@ -492,6 +515,8 @@ static struct mei_fixup {MEI_FIXUP (MEI_UUID_NFC_HCI , mei_nfc),MEI_FIXUP (MEI_UUID_WD , mei_wd),MEI_FIXUP (MEI_UUID_MKHIF_FIX , mei_mkhi_fix), +MEI_FIXUP (MEI_UUID_IGSC_MKHI , mei_gsc_mkhi_ver), +MEI_FIXUP (MEI_UUID_IGSC_MKHI_FIX , mei_gsc_mkhi_ver),MEI_FIXUP (MEI_UUID_HDCP , whitelist),MEI_FIXUP (MEI_UUID_ANY , vt_support), MEI_FIXUP(MEI_UUID_PAVP, whitelist),
drivers/misc/mei/hw-me.c +2 -0
@@ -1577,12 +1577,14 @@ static const struct mei_cfg mei_me_pch15_sps_cfg = {static const struct mei_cfg mei_me_gsc_cfg = {MEI_CFG_TYPE_GSC ,MEI_CFG_PCH8_HFS , +MEI_CFG_FW_VER_SUPP , };/* Graphics System Controller Firmware Interface */ static const struct mei_cfg mei_me_gscfi_cfg = {MEI_CFG_TYPE_GSCFI ,MEI_CFG_PCH8_HFS , +MEI_CFG_FW_VER_SUPP , };/*
Signature · 1 line
2.32.0
Patchwork
CI[Intel-gfx] ✗ Fi.CI.BUILD: failure for Add driver for GSC controller (rev2)
In reply to Alexander Usyskin== Series Details ==
== Series Details ==
Series: Add driver for GSC controller (rev2)
URL : https://patchwork.freedesktop.org/series/98066/
State : failure
== Summary ==
Applying: drm/i915/gsc: add gsc as a mei auxiliary device Using index info to reconstruct a base tree...
M drivers/gpu/drm/i915/Kconfig
M drivers/gpu/drm/i915/Makefile
M drivers/gpu/drm/i915/gt/intel_gt.c
M drivers/gpu/drm/i915/gt/intel_gt.h
M drivers/gpu/drm/i915/i915_drv.h
M drivers/gpu/drm/i915/i915_pci.c
M drivers/gpu/drm/i915/i915_reg.h
M drivers/gpu/drm/i915/intel_device_info.h
Falling back to patching base and 3-way merge... Auto-merging drivers/gpu/drm/i915/intel_device_info.h Auto-merging drivers/gpu/drm/i915/i915_reg.h
Auto-merging drivers/gpu/drm/i915/i915_pci.c
Auto-merging drivers/gpu/drm/i915/i915_drv.h
Auto-merging drivers/gpu/drm/i915/gt/intel_gt.h
Auto-merging drivers/gpu/drm/i915/gt/intel_gt.c
Auto-merging drivers/gpu/drm/i915/Makefile
Auto-merging drivers/gpu/drm/i915/Kconfig
CONFLICT (content): Merge conflict in drivers/gpu/drm/i915/Kconfig
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch Patch failed at 0001 drm/i915/gsc: add gsc as a mei auxiliary device When you have resolved this problem, run "git am --continue". If you prefer to skip this patch, run "git am --skip" instead. To restore the original branch and stop patching, run "git am --abort".
Greg Kroah-Hartman
maintainerQuoted 5 lines · Alexander Usyskin
GSC is a graphics system controller, it provides
a chassis controller for graphics discrete cards.There are two MEI interfaces in GSC: HECI1 and HECI2.
Quoted 7 lines
This series includes instantiation of the auxiliary devices for HECI2 and mei-gsc auxiliary device driver that binds to the auxiliary device.
In v2 the platform device was replaced by the auxiliary device.
Greg KH, please review and ACK the MEI patches.
We are pushing all through gfx tree as the auxiliary device belongs there.
I will review this after 5.17-rc1 is out. Please give us some time, there is no rush.
greg k-h