public inbox for alsa-devel@alsa-project.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Cc: alsa-devel@alsa-project.org, tiwai@suse.de,
	Daniel Baluta <daniel.baluta@gmail.com>,
	liam.r.girdwood@linux.intel.com, vkoul@kernel.org,
	broonie@kernel.org, Alan Cox <alan@linux.intel.com>,
	sound-open-firmware@alsa-project.org
Subject: Re: [PATCH v3 04/14] ASoC: SOF: Add support for IPC IO between DSP and Host
Date: Wed, 12 Dec 2018 00:57:33 +0200	[thread overview]
Message-ID: <20181211225733.GK10650@smile.fi.intel.com> (raw)
In-Reply-To: <20181211212318.28644-5-pierre-louis.bossart@linux.intel.com>

On Tue, Dec 11, 2018 at 03:23:08PM -0600, Pierre-Louis Bossart wrote:
> From: Liam Girdwood <liam.r.girdwood@linux.intel.com>
> 
> Define an IPC ABI for all host <--> DSP communication. This ABI should
> be transport agnostic. i.e. it should work on MMIO and SPI/I2C style
> interfaces.

> + /* ssc1: TINTE */
> +#define SOF_DAI_INTEL_SSP_QUIRK_TINTE		(1 << 0)
> + /* ssc1: PINTE */
> +#define SOF_DAI_INTEL_SSP_QUIRK_PINTE		(1 << 1)
> + /* ssc2: SMTATF */
> +#define SOF_DAI_INTEL_SSP_QUIRK_SMTATF		(1 << 2)
> + /* ssc2: MMRATF */
> +#define SOF_DAI_INTEL_SSP_QUIRK_MMRATF		(1 << 3)
> + /* ssc2: PSPSTWFDFD */
> +#define SOF_DAI_INTEL_SSP_QUIRK_PSPSTWFDFD	(1 << 4)
> + /* ssc2: PSPSRWFDFD */
> +#define SOF_DAI_INTEL_SSP_QUIRK_PSPSRWFDFD	(1 << 5)

Style mismatch. Looks like a candidate for BIT()

> +#define SOF_DAI_FMT_FORMAT_MASK		0x000f
> +#define SOF_DAI_FMT_CLOCK_MASK		0x00f0
> +#define SOF_DAI_FMT_INV_MASK		0x0f00
> +#define SOF_DAI_FMT_MASTER_MASK		0xf000

GENMASK() ?

> +/* flags indicating which time stamps are in sync with each other */
> +#define	SOF_TIME_HOST_SYNC	(1 << 0)
> +#define	SOF_TIME_DAI_SYNC	(1 << 1)
> +#define	SOF_TIME_WALL_SYNC	(1 << 2)
> +#define	SOF_TIME_STAMP_SYNC	(1 << 3)
> +
> +/* flags indicating which time stamps are valid */
> +#define	SOF_TIME_HOST_VALID	(1 << 8)
> +#define	SOF_TIME_DAI_VALID	(1 << 9)
> +#define	SOF_TIME_WALL_VALID	(1 << 10)
> +#define	SOF_TIME_STAMP_VALID	(1 << 11)
> +
> +/* flags indicating time stamps are 64bit else 3use low 32bit */
> +#define	SOF_TIME_HOST_64	(1 << 16)
> +#define	SOF_TIME_DAI_64		(1 << 17)
> +#define	SOF_TIME_WALL_64	(1 << 18)
> +#define	SOF_TIME_STAMP_64	(1 << 19)

BIT() ?


> +#define SOF_IPC_PANIC_MAGIC_MASK		0x0ffff000
> +#define SOF_IPC_PANIC_CODE_MASK			0x00000fff

GENMASK() ?

> +#define IPC_TIMEOUT_MSECS	300

Simple _MS ?

> +/* find original TX message from DSP reply */
> +static struct snd_sof_ipc_msg *sof_ipc_reply_find_msg(struct snd_sof_ipc *ipc,
> +						      u32 header)
> +{
> +	struct snd_sof_dev *sdev = ipc->sdev;
> +	struct snd_sof_ipc_msg *msg;
> +
> +	header = SOF_IPC_MESSAGE_ID(header);
> +

> +	if (list_empty(&ipc->reply_list))
> +		goto err;

Redundant. list_for_each_*() have this check already.

> +
> +	list_for_each_entry(msg, &ipc->reply_list, list) {
> +		if (SOF_IPC_MESSAGE_ID(msg->header) == header)
> +			return msg;
> +	}
> +
> +err:
> +	dev_err(sdev->dev, "error: rx list empty but received 0x%x\n",
> +		header);
> +	return NULL;
> +}

> +int snd_sof_ipc_valid(struct snd_sof_dev *sdev)
> +{
> +	struct sof_ipc_fw_ready *ready = &sdev->fw_ready;
> +	struct sof_ipc_fw_version *v = &ready->version;
> +

> +	dev_info(sdev->dev,
> +		 " Firmware info: version %d:%d:%d-%s\n",  v->major, v->minor,

Indentation issues.

> +		 v->micro, v->tag);
> +	dev_info(sdev->dev,
> +		 " Firmware: ABI %d:%d:%d Kernel ABI %d:%d:%d\n",
> +		 SOF_ABI_VERSION_MAJOR(v->abi_version),
> +		 SOF_ABI_VERSION_MINOR(v->abi_version),
> +		 SOF_ABI_VERSION_PATCH(v->abi_version),
> +		 SOF_ABI_MAJOR, SOF_ABI_MINOR, SOF_ABI_PATCH);
> +
> +	if (SOF_ABI_VERSION_INCOMPATIBLE(SOF_ABI_VERSION, v->abi_version)) {
> +		dev_err(sdev->dev, "error: incompatible FW ABI version\n");
> +		return -EINVAL;
> +	}
> +
> +	if (ready->debug.bits.build) {
> +		dev_info(sdev->dev,
> +			 " Firmware debug build %d on %s-%s - options:\n"
> +			 "  GDB: %s\n"
> +			 "  lock debug: %s\n"
> +			 "  lock vdebug: %s\n",
> +			 v->build, v->date, v->time,
> +			 ready->debug.bits.gdb ? "enabled" : "disabled",
> +			 ready->debug.bits.locks ? "enabled" : "disabled",

> +			 ready->debug.bits.locks_verbose ?
> +			 "enabled" : "disabled");

I would leave it on one line (only 3 characters more, but better readability).

			 ready->debug.bits.locks_verbose ? "enabled" : "disabled");

> +	}
> +
> +	/* copy the fw_version into debugfs at first boot */
> +	memcpy(&sdev->fw_version, v, sizeof(*v));
> +
> +	return 0;
> +}
> +EXPORT_SYMBOL(snd_sof_ipc_valid);

> +	dev_dbg(sdev->dev, "pre-allocate %d IPC messages\n",
> +		IPC_EMPTY_LIST_SIZE);

Noise.

> +
> +	/* pre-allocate message data */
> +	for (i = 0; i < IPC_EMPTY_LIST_SIZE; i++) {
> +		msg->msg_data = devm_kzalloc(sdev->dev, PAGE_SIZE, GFP_KERNEL);
> +		if (!msg->msg_data)
> +			return NULL;
> +
> +		msg->reply_data = devm_kzalloc(sdev->dev, PAGE_SIZE,
> +					       GFP_KERNEL);
> +		if (!msg->reply_data)
> +			return NULL;

Can't you just get enough (non-continuous?) pages at once via get_free_pages interface?
I didn't know that one, so, consider rather a way to look into.

> +
> +		init_waitqueue_head(&msg->waitq);
> +		list_add(&msg->list, &ipc->empty_list);
> +		msg++;
> +	}
> +
> +	return ipc;
> +}
> +EXPORT_SYMBOL(snd_sof_ipc_init);

-- 
With Best Regards,
Andy Shevchenko

  reply	other threads:[~2018-12-11 22:57 UTC|newest]

Thread overview: 95+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-11 21:23 [PATCH v3 00/14] Sound Open Firmware (SOF) core Pierre-Louis Bossart
2018-12-11 21:23 ` [PATCH v3 01/14] ASoC: SOF: Add Sound Open Firmware driver core Pierre-Louis Bossart
2018-12-11 22:20   ` Andy Shevchenko
2018-12-11 23:20     ` Pierre-Louis Bossart
2018-12-12  7:51   ` Takashi Iwai
2018-12-12 14:53     ` Pierre-Louis Bossart
2018-12-12 20:42   ` Daniel Baluta
2018-12-12 22:35     ` Pierre-Louis Bossart
2019-01-29 16:49   ` Daniel Baluta
2019-01-30 16:12     ` Pierre-Louis Bossart
2018-12-11 21:23 ` [PATCH v3 02/14] ASoC: SOF: Add Sound Open Firmware KControl support Pierre-Louis Bossart
2018-12-11 22:23   ` Andy Shevchenko
2018-12-11 22:48     ` Pierre-Louis Bossart
2018-12-11 23:25       ` Andy Shevchenko
2018-12-12 20:18     ` Pierre-Louis Bossart
2018-12-12  7:35   ` Takashi Iwai
2018-12-12 15:01     ` Pierre-Louis Bossart
2018-12-11 21:23 ` [PATCH v3 03/14] ASoC: SOF: Add driver debug support Pierre-Louis Bossart
2018-12-11 22:32   ` Andy Shevchenko
2018-12-11 23:29     ` Pierre-Louis Bossart
2019-01-09 19:40   ` Mark Brown
2019-01-10 20:47     ` Pierre-Louis Bossart
2018-12-11 21:23 ` [PATCH v3 04/14] ASoC: SOF: Add support for IPC IO between DSP and Host Pierre-Louis Bossart
2018-12-11 22:57   ` Andy Shevchenko [this message]
2018-12-11 23:38     ` Pierre-Louis Bossart
2018-12-12  8:17   ` Takashi Iwai
2018-12-12 15:19     ` Pierre-Louis Bossart
2018-12-12 15:34       ` Takashi Iwai
2018-12-13  5:24       ` Keyon Jie
2018-12-13  7:48         ` Takashi Iwai
2018-12-13  9:13           ` Keyon Jie
2018-12-13  8:06         ` Keyon Jie
2018-12-13  8:59           ` rander.wang
2019-01-09 20:37   ` Mark Brown
2019-01-10 20:11     ` Pierre-Louis Bossart
2019-01-22 19:04       ` Mark Brown
2019-01-22 21:05         ` Pierre-Louis Bossart
2019-01-22 21:13           ` Mark Brown
2019-01-23  5:51           ` [Sound-open-firmware] " Keyon Jie
2019-01-14 15:10   ` Daniel Baluta
2019-01-14 17:39     ` Pierre-Louis Bossart
2018-12-11 21:23 ` [PATCH v3 05/14] ASoC: SOF: Add PCM operations support Pierre-Louis Bossart
2018-12-12  8:04   ` Takashi Iwai
2018-12-12 13:12     ` Andy Shevchenko
2018-12-12 15:29     ` [Sound-open-firmware] " Pierre-Louis Bossart
2018-12-12 15:43       ` Takashi Iwai
2018-12-12 16:10         ` Pierre-Louis Bossart
2018-12-12 22:09   ` Daniel Baluta
2018-12-11 21:23 ` [PATCH v3 06/14] ASoC: SOF: Add support for loading topologies Pierre-Louis Bossart
2018-12-11 21:23 ` [PATCH v3 07/14] ASoC: SOF: Add DSP firmware logger support Pierre-Louis Bossart
2018-12-11 23:21   ` Andy Shevchenko
2018-12-11 23:43     ` Pierre-Louis Bossart
2018-12-12  6:44       ` Takashi Iwai
2018-12-12 11:11   ` Takashi Iwai
2018-12-12 16:04     ` [Sound-open-firmware] " Pierre-Louis Bossart
2018-12-12 16:12       ` Takashi Iwai
2018-12-12 17:01         ` Pierre-Louis Bossart
2019-01-09 20:44   ` Mark Brown
2019-01-09 21:39     ` Pierre-Louis Bossart
2019-01-22 18:57       ` Mark Brown
2019-01-22 20:33         ` Pierre-Louis Bossart
2019-01-22 20:41           ` Mark Brown
2019-01-22 20:52             ` Pierre-Louis Bossart
2019-01-22 21:08               ` Mark Brown
2019-01-22 21:13                 ` Pierre-Louis Bossart
2018-12-11 21:23 ` [PATCH v3 08/14] ASoC: SOF: Add DSP HW abstraction operations Pierre-Louis Bossart
2018-12-11 23:16   ` Andy Shevchenko
2018-12-11 23:45     ` Pierre-Louis Bossart
2019-01-09 20:51   ` Mark Brown
2019-01-09 21:37     ` Pierre-Louis Bossart
2019-01-22 18:56       ` Mark Brown
2018-12-11 21:23 ` [PATCH v3 09/14] ASoC: SOF: Add firmware loader support Pierre-Louis Bossart
2018-12-11 22:38   ` Andy Shevchenko
2018-12-11 23:54     ` Pierre-Louis Bossart
2019-01-09 20:55       ` Mark Brown
2018-12-12 11:23   ` Takashi Iwai
2018-12-12 16:06     ` [Sound-open-firmware] " Pierre-Louis Bossart
2019-01-09 21:02   ` Mark Brown
2019-01-09 21:24     ` Pierre-Louis Bossart
2018-12-11 21:23 ` [PATCH v3 10/14] ASoC: SOF: Add userspace ABI support Pierre-Louis Bossart
2018-12-21 11:10   ` Daniel Baluta
2018-12-21 14:59     ` [Sound-open-firmware] " Pierre-Louis Bossart
2018-12-11 21:23 ` [PATCH v3 11/14] ASoC: SOF: Add PM support Pierre-Louis Bossart
2018-12-12 11:32   ` Takashi Iwai
2018-12-12 16:08     ` Pierre-Louis Bossart
2018-12-11 21:23 ` [PATCH v3 12/14] ASoC: SOF: Add Nocodec machine driver support Pierre-Louis Bossart
2018-12-11 21:23 ` [PATCH v3 13/14] ASoC: SOF: Add xtensa support Pierre-Louis Bossart
2018-12-11 23:08   ` Andy Shevchenko
2018-12-12  0:00     ` Pierre-Louis Bossart
     [not found]       ` <93aff9af-c693-c951-4821-e9e334133ed0@linux.intel.com>
2018-12-13  9:58         ` [Sound-open-firmware] " rander.wang
2018-12-17 13:45           ` Takashi Iwai
2018-12-17 14:24             ` Mark Brown
2018-12-11 21:23 ` [PATCH v3 14/14] ASoC: SOF: Add utils Pierre-Louis Bossart
2018-12-11 23:06   ` Andy Shevchenko
2018-12-12  0:06     ` Pierre-Louis Bossart

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=20181211225733.GK10650@smile.fi.intel.com \
    --to=andriy.shevchenko@intel.com \
    --cc=alan@linux.intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=daniel.baluta@gmail.com \
    --cc=liam.r.girdwood@linux.intel.com \
    --cc=pierre-louis.bossart@linux.intel.com \
    --cc=sound-open-firmware@alsa-project.org \
    --cc=tiwai@suse.de \
    --cc=vkoul@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