LKML Archive on
help / color / mirror / Atom feed
	Kuppuswamy Sathyanarayanan 
Subject: [RFC v8 0/7] SCU/PMC/PUNIT Inter-Processor Communication(IPC) driver cleanup
Date: Sun, 29 Oct 2017 02:49:53 -0700	[thread overview]
Message-ID: <> (raw)

From: Kuppuswamy Sathyanarayanan <>

Hi All,

Currently intel_pmc_ipc.c, intel_punit_ipc.c, intel_scu_ipc.c drivers implements the same IPC features.
This code duplication could be avoided if we implement the IPC driver as a generic library and let custom
device drivers use API provided by generic driver. This patchset mainly addresses this issue.

Along with above code duplication issue, This patchset also addresses following issues in intel_pmc_ipc and
intel_punit_ipc drivers. 

1. Intel_pmc_ipc.c driver does not use any resource managed (devm_*) calls.
2. In Intel_pmc_ipc.c driver, dependent devices like PUNIT, Telemetry and iTCO are created manually and uses lot of redundant buffer code.
3. Global variable is used to store the IPC device structure and it is used across all functions in intel_pmc_ipc.c and intel_punit_ipc.c.

More info on Intel IPC device library:

A generic Intel IPC class driver has been implemented and all common IPC helper functions has been moved to this driver. It exposes APIs to create IPC device channel, send raw IPC command and simple IPC commands. It also creates device attribute to send IPC command from user space.

API for creating a new IPC channel device is,

struct intel_ipc_dev *devm_intel_ipc_dev_create(struct device *dev, const char *devname, struct intel_ipc_dev_cfg *cfg, struct intel_ipc_dev_ops *ops)

The IPC channel drivers (PUNIT/PMC/SCU) when creating a new device can configure their device params like register mapping, irq, irq-mode, channel type,etc  using intel_ipc_dev_cfg and intel_ipc_dev_ops arguments. After a new IPC channel device is created, IPC users can use the generic APIs to make IPC calls.

For example, after using this new model, IPC call to PMC device will look like,

pmc_ipc_dev = intel_ipc_dev_get(INTEL_PMC_IPC_DEV);
ipc_dev_raw_cmd(pmc_ipc_dev, ipc_raw_cmd);

I am still testing the driver in different products. But posted it to get some early comments. I also welcome any PMC/PUNIT driver users to check these patches in their product.

Changes since v7:
 * Fixed checkpatch errors/warnings.

Changes since v6:
 * First two patches of v6 patch set has already been approved, So removed it
   from the list.
 * Rebased rest of the patches on top of testing branch.
 * Fixed some style issues.

Changes since v5:
 * Added intel_ipc_cmd and intel_ipc_raw_cmd structures.
 * Fixed some minor style issues.
 * Rebased "intel_pmc_ipc: Use devm_* calls in driver probe function" patch on top of
   4.14-rc5 kernel.

Changes since v4:
 * Pushed "platform/x86: intel_pmc_ipc: Use spin_lock to protect GCR update" patch
   to the top of the patch list. Also its rebased on top of Andy's review branch.

Changes since v3:
 * Rebased on top of Andy's review branch.
 * Fixed resource ioremap warning in intel_punit_ipc.c.
 * Divided "platform/x86: intel_pmc_ipc: Use regmap calls for GCR updates" patch
   into two patches. One fixing the existing issue and another to add regmap support.
 * Fixed error in resource initalization logic in ipc_create_punit_device.
 * Changed PLATFORM_DEVID_AUTO to PLATFORM_DEVID_NONE in mfd device creation.
 * Added unique name to PUNIT BIOS, GTD, & ISP regmaps.
 * Fixed NULL pointer exception in intel_ipc_dev_get().
 * In intel_ipc_dev.c,
    * Fixed error in check for duplicate intel_ipc_dev.
    * Added custom interrupt handler support.
    * Used char array for error string conversion.
    * Added put dev support.

Changes since v2:
 * Refactored intel_scu_ipc.c to use generic IPC device APIs.
 * Fixed intel_pmc_ipc.c to use pcim_* device managed functions.

Changes since v1:
 * Merged devm_* changes in pmc_plat_probe and pmc_pci_probe functions into a
   single patch.
 * Addressed Andy's comment about keeping the library generic by not implementing
   the low level reg access calls in intel_ipc_dev.c. This version will start using
   the regmap pointer provided by channel drivers instead of fixed memory map.
 * Removed custom IPC APIs in intel_pmc_ipc.c and intel_punit_ipc.c.
 * Cleaned up IPC driver users to use APIs provided by generic library (intel_ipc_dev.c).

Kuppuswamy Sathyanarayanan (7):
  platform/x86: intel_punit_ipc: Fix resource ioremap warning
  platform/x86: intel_pmc_ipc: Use MFD framework to create dependent
  platform/x86: intel_pmc_ipc: Use regmap calls for GCR updates
  platform: x86: Add generic Intel IPC driver
  platform/x86: intel_punit_ipc: Use generic intel ipc device calls
  platform/x86: intel_pmc_ipc: Use generic Intel IPC device calls
  platform/x86: intel_scu_ipc: Use generic Intel IPC device calls

 MAINTAINERS                                     |   7 +
 arch/x86/include/asm/intel_pmc_ipc.h            |  31 +-
 arch/x86/include/asm/intel_punit_ipc.h          | 125 ++--
 arch/x86/include/asm/intel_scu_ipc.h            |  10 +-
 arch/x86/platform/intel-mid/intel-mid.c         |  15 +-
 drivers/mfd/intel_soc_pmic_bxtwc.c              |  37 +-
 drivers/platform/x86/Kconfig                    |  11 +
 drivers/platform/x86/Makefile                   |   1 +
 drivers/platform/x86/intel_ipc_dev.c            | 563 +++++++++++++++
 drivers/platform/x86/intel_pmc_ipc.c            | 886 +++++++++---------------
 drivers/platform/x86/intel_punit_ipc.c          | 307 +++-----
 drivers/platform/x86/intel_scu_ipc.c            | 488 ++++++-------
 drivers/platform/x86/intel_telemetry_pltdrv.c   | 229 +++---
 drivers/rtc/rtc-mrst.c                          |  16 +-
 drivers/watchdog/intel-mid_wdt.c                |  18 +-
 drivers/watchdog/intel_scu_watchdog.c           |  23 +-
 include/linux/mfd/intel_soc_pmic.h              |   2 +
 include/linux/platform_data/x86/intel_ipc_dev.h | 246 +++++++
 18 files changed, 1741 insertions(+), 1274 deletions(-)
 create mode 100644 drivers/platform/x86/intel_ipc_dev.c
 create mode 100644 include/linux/platform_data/x86/intel_ipc_dev.h


             reply	other threads:[~2017-10-29  9:50 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-29  9:49 sathyanarayanan.kuppuswamy [this message]
2017-10-29  9:49 ` [RFC v8 1/7] platform/x86: intel_punit_ipc: Fix resource ioremap warning sathyanarayanan.kuppuswamy
2017-11-03 12:13   ` Andy Shevchenko
2017-10-29  9:49 ` [RFC v8 2/7] platform/x86: intel_pmc_ipc: Use MFD framework to create dependent devices sathyanarayanan.kuppuswamy
2017-11-23 11:49   ` Heikki Krogerus
2017-11-23 17:08     ` Guenter Roeck
2018-01-21  4:42     ` sathya
2017-10-29  9:49 ` [RFC v8 3/7] platform/x86: intel_pmc_ipc: Use regmap calls for GCR updates sathyanarayanan.kuppuswamy
2017-11-23 12:29   ` Heikki Krogerus
2017-10-29  9:49 ` [RFC v8 4/7] platform: x86: Add generic Intel IPC driver sathyanarayanan.kuppuswamy
2017-11-23 13:29   ` Heikki Krogerus
2018-01-21  4:59     ` sathya
2017-10-29  9:49 ` [RFC v8 5/7] platform/x86: intel_punit_ipc: Use generic intel ipc device calls sathyanarayanan.kuppuswamy
2017-10-29  9:49 ` [RFC v8 6/7] platform/x86: intel_pmc_ipc: Use generic Intel IPC " sathyanarayanan.kuppuswamy
2017-10-29  9:50 ` [RFC v8 7/7] platform/x86: intel_scu_ipc: " sathyanarayanan.kuppuswamy
2017-11-23 13:56 ` [RFC v8 0/7] SCU/PMC/PUNIT Inter-Processor Communication(IPC) driver cleanup Heikki Krogerus

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:

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

  git send-email \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \

* 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;
as well as URLs for NNTP newsgroup(s).