From mboxrd@z Thu Jan 1 00:00:00 1970 From: kbuild test robot Subject: Re: [PATCH v2 07/10] ASoC: cros_ec_codec: support WoV Date: Sun, 6 Oct 2019 00:53:31 +0800 Message-ID: <201910060040.RXI5XB2W%lkp@intel.com> References: <20191005164320.07.I5388b69a7a9c551078fed216a77440cee6dedf49@changeid> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <20191005164320.07.I5388b69a7a9c551078fed216a77440cee6dedf49@changeid> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" Cc: gwendal@google.com, devicetree@vger.kernel.org, alsa-devel@alsa-project.org, cychiang@google.com, drinkcat@google.com, robh+dt@kernel.org, tzungbi@google.com, broonie@kernel.org, kbuild-all@01.org, enric.balletbo@collabora.com, bleung@google.com, dgreid@google.com List-Id: devicetree@vger.kernel.org Hi Tzung-Bi, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on asoc/for-next] [cannot apply to v5.4-rc1 next-20191004] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see https://stackoverflow.com/a/37406982] url: https://github.com/0day-ci/linux/commits/Tzung-Bi-Shih/ASoC-mediatek-mt8183-mt6358-ts3a227-max98357-support-WoV/20191005-171021 base: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next reproduce: # apt-get install sparse # sparse version: v0.6.1-rc1-42-g38eda53-dirty make ARCH=x86_64 allmodconfig make C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' If you fix the issue, kindly add following tag Reported-by: kbuild test robot sparse warnings: (new ones prefixed by >>) >> sound/soc/codecs/cros_ec_codec.c:430:39: sparse: sparse: incorrect type in return expression (different address spaces) @@ expected void * @@ got void [noderef] > sound/soc/codecs/cros_ec_codec.c:430:39: sparse: expected void * >> sound/soc/codecs/cros_ec_codec.c:430:39: sparse: got void [noderef] * >> sound/soc/codecs/cros_ec_codec.c:549:69: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void const volatile [noderef] * @@ got latile [noderef] * @@ >> sound/soc/codecs/cros_ec_codec.c:549:69: sparse: expected void const volatile [noderef] * >> sound/soc/codecs/cros_ec_codec.c:549:69: sparse: got unsigned char [usertype] *addr >> sound/soc/codecs/cros_ec_codec.c:698:33: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void volatile [noderef] * @@ got latile [noderef] * @@ >> sound/soc/codecs/cros_ec_codec.c:698:33: sparse: expected void volatile [noderef] * >> sound/soc/codecs/cros_ec_codec.c:698:33: sparse: got unsigned char [usertype] *wov_lang_shm_p sound/soc/codecs/cros_ec_codec.c:699:48: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void volatile [noderef] * @@ got latile [noderef] * @@ sound/soc/codecs/cros_ec_codec.c:699:48: sparse: expected void volatile [noderef] * >> sound/soc/codecs/cros_ec_codec.c:699:48: sparse: got unsigned char [usertype] * vim +430 sound/soc/codecs/cros_ec_codec.c 406 407 static void *wov_map_shm(struct cros_ec_codec_priv *priv, 408 uint8_t shm_id, uint32_t *len, uint8_t *type) 409 { 410 struct ec_param_ec_codec p; 411 struct ec_response_ec_codec_get_shm_addr r; 412 uint32_t req, offset; 413 414 p.cmd = EC_CODEC_GET_SHM_ADDR; 415 p.get_shm_addr_param.shm_id = shm_id; 416 if (send_ec_host_command(priv->ec_device, EC_CMD_EC_CODEC, 417 (uint8_t *)&p, sizeof(p), 418 (uint8_t *)&r, sizeof(r)) < 0) { 419 dev_err(priv->dev, "failed to EC_CODEC_GET_SHM_ADDR\n"); 420 return NULL; 421 } 422 423 dev_dbg(priv->dev, "phys_addr=%#llx, len=%#x\n", r.phys_addr, r.len); 424 425 *len = r.len; 426 *type = r.type; 427 428 switch (r.type) { 429 case EC_CODEC_SHM_TYPE_EC_RAM: > 430 return devm_ioremap_wc(priv->dev, 431 r.phys_addr + priv->ec_shm_addr, r.len); 432 case EC_CODEC_SHM_TYPE_SYSTEM_RAM: 433 if (r.phys_addr) { 434 dev_err(priv->dev, "unknown status\n"); 435 return NULL; 436 } 437 438 req = round_up(r.len, PAGE_SIZE); 439 dev_dbg(priv->dev, "round up from %u to %u\n", r.len, req); 440 441 if (priv->ap_shm_last_alloc + req > 442 priv->ap_shm_phys_addr + priv->ap_shm_len) { 443 dev_err(priv->dev, "insufficient space for AP SHM\n"); 444 return NULL; 445 } 446 447 dev_dbg(priv->dev, "alloc AP SHM addr=%#llx, len=%#x\n", 448 priv->ap_shm_last_alloc, req); 449 450 p.cmd = EC_CODEC_SET_SHM_ADDR; 451 p.set_shm_addr_param.phys_addr = priv->ap_shm_last_alloc; 452 p.set_shm_addr_param.len = req; 453 p.set_shm_addr_param.shm_id = shm_id; 454 if (send_ec_host_command(priv->ec_device, EC_CMD_EC_CODEC, 455 (uint8_t *)&p, sizeof(p), 456 NULL, 0) < 0) { 457 dev_err(priv->dev, "failed to EC_CODEC_SET_SHM_ADDR\n"); 458 return NULL; 459 } 460 461 /* 462 * Note: EC codec only requests for `r.len' but we allocate 463 * round up PAGE_SIZE `req'. 464 */ 465 offset = priv->ap_shm_last_alloc - priv->ap_shm_phys_addr; 466 priv->ap_shm_last_alloc += req; 467 468 return (void *)(uintptr_t)(priv->ap_shm_addr + offset); 469 default: 470 return NULL; 471 } 472 } 473 474 static bool wov_queue_full(struct cros_ec_codec_priv *priv) 475 { 476 return ((priv->wov_wp + 1) % sizeof(priv->wov_buf)) == priv->wov_rp; 477 } 478 479 static size_t wov_queue_size(struct cros_ec_codec_priv *priv) 480 { 481 if (priv->wov_wp >= priv->wov_rp) 482 return priv->wov_wp - priv->wov_rp; 483 else 484 return sizeof(priv->wov_buf) - priv->wov_rp + priv->wov_wp; 485 } 486 487 static void wov_queue_dequeue(struct cros_ec_codec_priv *priv, size_t len) 488 { 489 struct snd_pcm_runtime *runtime = priv->wov_substream->runtime; 490 size_t req; 491 492 while (len) { 493 req = min(len, runtime->dma_bytes - priv->wov_dma_offset); 494 if (priv->wov_wp >= priv->wov_rp) 495 req = min(req, (size_t)priv->wov_wp - priv->wov_rp); 496 else 497 req = min(req, sizeof(priv->wov_buf) - priv->wov_rp); 498 499 memcpy(runtime->dma_area + priv->wov_dma_offset, 500 priv->wov_buf + priv->wov_rp, req); 501 502 priv->wov_dma_offset += req; 503 if (priv->wov_dma_offset == runtime->dma_bytes) 504 priv->wov_dma_offset = 0; 505 506 priv->wov_rp += req; 507 if (priv->wov_rp == sizeof(priv->wov_buf)) 508 priv->wov_rp = 0; 509 510 len -= req; 511 } 512 513 snd_pcm_period_elapsed(priv->wov_substream); 514 } 515 516 static void wov_queue_try_dequeue(struct cros_ec_codec_priv *priv) 517 { 518 size_t period_bytes = snd_pcm_lib_period_bytes(priv->wov_substream); 519 520 while (period_bytes && wov_queue_size(priv) >= period_bytes) { 521 wov_queue_dequeue(priv, period_bytes); 522 period_bytes = snd_pcm_lib_period_bytes(priv->wov_substream); 523 } 524 } 525 526 static void wov_queue_enqueue(struct cros_ec_codec_priv *priv, 527 uint8_t *addr, size_t len, bool iomem) 528 { 529 size_t req; 530 531 while (len) { 532 if (wov_queue_full(priv)) { 533 wov_queue_try_dequeue(priv); 534 535 if (wov_queue_full(priv)) { 536 dev_err(priv->dev, "overrun detected\n"); 537 return; 538 } 539 } 540 541 if (priv->wov_wp >= priv->wov_rp) 542 req = sizeof(priv->wov_buf) - priv->wov_wp; 543 else 544 /* Note: waste 1-byte to differentiate full and empty */ 545 req = priv->wov_rp - priv->wov_wp - 1; 546 req = min(req, len); 547 548 if (iomem) > 549 memcpy_fromio(priv->wov_buf + priv->wov_wp, addr, req); 550 else 551 memcpy(priv->wov_buf + priv->wov_wp, addr, req); 552 553 priv->wov_wp += req; 554 if (priv->wov_wp == sizeof(priv->wov_buf)) 555 priv->wov_wp = 0; 556 557 addr += req; 558 len -= req; 559 } 560 561 wov_queue_try_dequeue(priv); 562 } 563 --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.2 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1102DC47404 for ; Sat, 5 Oct 2019 16:55:23 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 101A922459 for ; Sat, 5 Oct 2019 16:55:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="slQACikn" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 101A922459 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id B3F221679; Sat, 5 Oct 2019 18:54:29 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz B3F221679 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1570294519; bh=mZJpKx1Fzb9iOX1I56BhBCl+38hwRo2moRB8lakMoTk=; h=Date:From:To:References:In-Reply-To:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=slQACikn0Nw+bUEWQoBKfMwdUW0x6CeAbli7OGNIigAT5R1UJa5BEVaQqAqyQldUm 6oxOrl1KIvCXmceS6sqPKdeQFQgB9/+60YS5foml8fK4ON59W0B/4t2EZgGjy+OPZd naLGJKGq7Fv7AOx0nxChGUnFF7CFJa2MpjZuthDQ= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 31077F804FF; Sat, 5 Oct 2019 18:54:29 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id BE86DF80506; Sat, 5 Oct 2019 18:54:27 +0200 (CEST) Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 07AC7F800DE for ; Sat, 5 Oct 2019 18:54:22 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 07AC7F800DE X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Oct 2019 09:54:18 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.67,261,1566889200"; d="scan'208";a="367684020" Received: from lkp-server01.sh.intel.com (HELO lkp-server01) ([10.239.97.150]) by orsmga005.jf.intel.com with ESMTP; 05 Oct 2019 09:54:17 -0700 Received: from kbuild by lkp-server01 with local (Exim 4.89) (envelope-from ) id 1iGnJw-0006CZ-Je; Sun, 06 Oct 2019 00:54:16 +0800 Date: Sun, 6 Oct 2019 00:53:31 +0800 From: kbuild test robot To: Tzung-Bi Shih Message-ID: <201910060040.RXI5XB2W%lkp@intel.com> References: <20191005164320.07.I5388b69a7a9c551078fed216a77440cee6dedf49@changeid> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20191005164320.07.I5388b69a7a9c551078fed216a77440cee6dedf49@changeid> X-Patchwork-Hint: ignore User-Agent: NeoMutt/20170113 (1.7.2) Cc: gwendal@google.com, devicetree@vger.kernel.org, alsa-devel@alsa-project.org, cychiang@google.com, drinkcat@google.com, robh+dt@kernel.org, tzungbi@google.com, broonie@kernel.org, kbuild-all@01.org, enric.balletbo@collabora.com, bleung@google.com, dgreid@google.com Subject: Re: [alsa-devel] [PATCH v2 07/10] ASoC: cros_ec_codec: support WoV X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" Hi Tzung-Bi, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on asoc/for-next] [cannot apply to v5.4-rc1 next-20191004] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see https://stackoverflow.com/a/37406982] url: https://github.com/0day-ci/linux/commits/Tzung-Bi-Shih/ASoC-mediatek-mt8183-mt6358-ts3a227-max98357-support-WoV/20191005-171021 base: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next reproduce: # apt-get install sparse # sparse version: v0.6.1-rc1-42-g38eda53-dirty make ARCH=x86_64 allmodconfig make C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' If you fix the issue, kindly add following tag Reported-by: kbuild test robot sparse warnings: (new ones prefixed by >>) >> sound/soc/codecs/cros_ec_codec.c:430:39: sparse: sparse: incorrect type in return expression (different address spaces) @@ expected void * @@ got void [noderef] > sound/soc/codecs/cros_ec_codec.c:430:39: sparse: expected void * >> sound/soc/codecs/cros_ec_codec.c:430:39: sparse: got void [noderef] * >> sound/soc/codecs/cros_ec_codec.c:549:69: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void const volatile [noderef] * @@ got latile [noderef] * @@ >> sound/soc/codecs/cros_ec_codec.c:549:69: sparse: expected void const volatile [noderef] * >> sound/soc/codecs/cros_ec_codec.c:549:69: sparse: got unsigned char [usertype] *addr >> sound/soc/codecs/cros_ec_codec.c:698:33: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void volatile [noderef] * @@ got latile [noderef] * @@ >> sound/soc/codecs/cros_ec_codec.c:698:33: sparse: expected void volatile [noderef] * >> sound/soc/codecs/cros_ec_codec.c:698:33: sparse: got unsigned char [usertype] *wov_lang_shm_p sound/soc/codecs/cros_ec_codec.c:699:48: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void volatile [noderef] * @@ got latile [noderef] * @@ sound/soc/codecs/cros_ec_codec.c:699:48: sparse: expected void volatile [noderef] * >> sound/soc/codecs/cros_ec_codec.c:699:48: sparse: got unsigned char [usertype] * vim +430 sound/soc/codecs/cros_ec_codec.c 406 407 static void *wov_map_shm(struct cros_ec_codec_priv *priv, 408 uint8_t shm_id, uint32_t *len, uint8_t *type) 409 { 410 struct ec_param_ec_codec p; 411 struct ec_response_ec_codec_get_shm_addr r; 412 uint32_t req, offset; 413 414 p.cmd = EC_CODEC_GET_SHM_ADDR; 415 p.get_shm_addr_param.shm_id = shm_id; 416 if (send_ec_host_command(priv->ec_device, EC_CMD_EC_CODEC, 417 (uint8_t *)&p, sizeof(p), 418 (uint8_t *)&r, sizeof(r)) < 0) { 419 dev_err(priv->dev, "failed to EC_CODEC_GET_SHM_ADDR\n"); 420 return NULL; 421 } 422 423 dev_dbg(priv->dev, "phys_addr=%#llx, len=%#x\n", r.phys_addr, r.len); 424 425 *len = r.len; 426 *type = r.type; 427 428 switch (r.type) { 429 case EC_CODEC_SHM_TYPE_EC_RAM: > 430 return devm_ioremap_wc(priv->dev, 431 r.phys_addr + priv->ec_shm_addr, r.len); 432 case EC_CODEC_SHM_TYPE_SYSTEM_RAM: 433 if (r.phys_addr) { 434 dev_err(priv->dev, "unknown status\n"); 435 return NULL; 436 } 437 438 req = round_up(r.len, PAGE_SIZE); 439 dev_dbg(priv->dev, "round up from %u to %u\n", r.len, req); 440 441 if (priv->ap_shm_last_alloc + req > 442 priv->ap_shm_phys_addr + priv->ap_shm_len) { 443 dev_err(priv->dev, "insufficient space for AP SHM\n"); 444 return NULL; 445 } 446 447 dev_dbg(priv->dev, "alloc AP SHM addr=%#llx, len=%#x\n", 448 priv->ap_shm_last_alloc, req); 449 450 p.cmd = EC_CODEC_SET_SHM_ADDR; 451 p.set_shm_addr_param.phys_addr = priv->ap_shm_last_alloc; 452 p.set_shm_addr_param.len = req; 453 p.set_shm_addr_param.shm_id = shm_id; 454 if (send_ec_host_command(priv->ec_device, EC_CMD_EC_CODEC, 455 (uint8_t *)&p, sizeof(p), 456 NULL, 0) < 0) { 457 dev_err(priv->dev, "failed to EC_CODEC_SET_SHM_ADDR\n"); 458 return NULL; 459 } 460 461 /* 462 * Note: EC codec only requests for `r.len' but we allocate 463 * round up PAGE_SIZE `req'. 464 */ 465 offset = priv->ap_shm_last_alloc - priv->ap_shm_phys_addr; 466 priv->ap_shm_last_alloc += req; 467 468 return (void *)(uintptr_t)(priv->ap_shm_addr + offset); 469 default: 470 return NULL; 471 } 472 } 473 474 static bool wov_queue_full(struct cros_ec_codec_priv *priv) 475 { 476 return ((priv->wov_wp + 1) % sizeof(priv->wov_buf)) == priv->wov_rp; 477 } 478 479 static size_t wov_queue_size(struct cros_ec_codec_priv *priv) 480 { 481 if (priv->wov_wp >= priv->wov_rp) 482 return priv->wov_wp - priv->wov_rp; 483 else 484 return sizeof(priv->wov_buf) - priv->wov_rp + priv->wov_wp; 485 } 486 487 static void wov_queue_dequeue(struct cros_ec_codec_priv *priv, size_t len) 488 { 489 struct snd_pcm_runtime *runtime = priv->wov_substream->runtime; 490 size_t req; 491 492 while (len) { 493 req = min(len, runtime->dma_bytes - priv->wov_dma_offset); 494 if (priv->wov_wp >= priv->wov_rp) 495 req = min(req, (size_t)priv->wov_wp - priv->wov_rp); 496 else 497 req = min(req, sizeof(priv->wov_buf) - priv->wov_rp); 498 499 memcpy(runtime->dma_area + priv->wov_dma_offset, 500 priv->wov_buf + priv->wov_rp, req); 501 502 priv->wov_dma_offset += req; 503 if (priv->wov_dma_offset == runtime->dma_bytes) 504 priv->wov_dma_offset = 0; 505 506 priv->wov_rp += req; 507 if (priv->wov_rp == sizeof(priv->wov_buf)) 508 priv->wov_rp = 0; 509 510 len -= req; 511 } 512 513 snd_pcm_period_elapsed(priv->wov_substream); 514 } 515 516 static void wov_queue_try_dequeue(struct cros_ec_codec_priv *priv) 517 { 518 size_t period_bytes = snd_pcm_lib_period_bytes(priv->wov_substream); 519 520 while (period_bytes && wov_queue_size(priv) >= period_bytes) { 521 wov_queue_dequeue(priv, period_bytes); 522 period_bytes = snd_pcm_lib_period_bytes(priv->wov_substream); 523 } 524 } 525 526 static void wov_queue_enqueue(struct cros_ec_codec_priv *priv, 527 uint8_t *addr, size_t len, bool iomem) 528 { 529 size_t req; 530 531 while (len) { 532 if (wov_queue_full(priv)) { 533 wov_queue_try_dequeue(priv); 534 535 if (wov_queue_full(priv)) { 536 dev_err(priv->dev, "overrun detected\n"); 537 return; 538 } 539 } 540 541 if (priv->wov_wp >= priv->wov_rp) 542 req = sizeof(priv->wov_buf) - priv->wov_wp; 543 else 544 /* Note: waste 1-byte to differentiate full and empty */ 545 req = priv->wov_rp - priv->wov_wp - 1; 546 req = min(req, len); 547 548 if (iomem) > 549 memcpy_fromio(priv->wov_buf + priv->wov_wp, addr, req); 550 else 551 memcpy(priv->wov_buf + priv->wov_wp, addr, req); 552 553 priv->wov_wp += req; 554 if (priv->wov_wp == sizeof(priv->wov_buf)) 555 priv->wov_wp = 0; 556 557 addr += req; 558 len -= req; 559 } 560 561 wov_queue_try_dequeue(priv); 562 } 563 --- 0-DAY kernel test infrastructure Open Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation _______________________________________________ Alsa-devel mailing list Alsa-devel@alsa-project.org https://mailman.alsa-project.org/mailman/listinfo/alsa-devel From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: multipart/mixed; boundary="===============7939301581183369208==" MIME-Version: 1.0 From: kbuild test robot To: kbuild-all@lists.01.org Subject: Re: [alsa-devel] [PATCH v2 07/10] ASoC: cros_ec_codec: support WoV Date: Sun, 06 Oct 2019 00:53:31 +0800 Message-ID: <201910060040.RXI5XB2W%lkp@intel.com> In-Reply-To: <20191005164320.07.I5388b69a7a9c551078fed216a77440cee6dedf49@changeid> List-Id: --===============7939301581183369208== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Hi Tzung-Bi, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on asoc/for-next] [cannot apply to v5.4-rc1 next-20191004] [if your patch is applied to the wrong git tree, please drop us a note to h= elp improve the system. BTW, we also suggest to use '--base' option to specify = the base tree in git format-patch, please see https://stackoverflow.com/a/37406= 982] url: https://github.com/0day-ci/linux/commits/Tzung-Bi-Shih/ASoC-mediate= k-mt8183-mt6358-ts3a227-max98357-support-WoV/20191005-171021 base: https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git f= or-next reproduce: # apt-get install sparse # sparse version: v0.6.1-rc1-42-g38eda53-dirty make ARCH=3Dx86_64 allmodconfig make C=3D1 CF=3D'-fdiagnostic-prefix -D__CHECK_ENDIAN__' If you fix the issue, kindly add following tag Reported-by: kbuild test robot sparse warnings: (new ones prefixed by >>) >> sound/soc/codecs/cros_ec_codec.c:430:39: sparse: sparse: incorrect type = in return expression (different address spaces) @@ expected void * @@ = got void [noderef] > sound/soc/codecs/cros_ec_codec.c:430:39: sparse: expected void * >> sound/soc/codecs/cros_ec_codec.c:430:39: sparse: got void [noderef] <= asn:2> * >> sound/soc/codecs/cros_ec_codec.c:549:69: sparse: sparse: incorrect type = in argument 2 (different address spaces) @@ expected void const volatile= [noderef] * @@ got latile [noderef] * @@ >> sound/soc/codecs/cros_ec_codec.c:549:69: sparse: expected void const = volatile [noderef] * >> sound/soc/codecs/cros_ec_codec.c:549:69: sparse: got unsigned char [u= sertype] *addr >> sound/soc/codecs/cros_ec_codec.c:698:33: sparse: sparse: incorrect type = in argument 1 (different address spaces) @@ expected void volatile [node= ref] * @@ got latile [noderef] * @@ >> sound/soc/codecs/cros_ec_codec.c:698:33: sparse: expected void volati= le [noderef] * >> sound/soc/codecs/cros_ec_codec.c:698:33: sparse: got unsigned char [u= sertype] *wov_lang_shm_p sound/soc/codecs/cros_ec_codec.c:699:48: sparse: sparse: incorrect type = in argument 1 (different address spaces) @@ expected void volatile [node= ref] * @@ got latile [noderef] * @@ sound/soc/codecs/cros_ec_codec.c:699:48: sparse: expected void volati= le [noderef] * >> sound/soc/codecs/cros_ec_codec.c:699:48: sparse: got unsigned char [u= sertype] * vim +430 sound/soc/codecs/cros_ec_codec.c 406 = 407 static void *wov_map_shm(struct cros_ec_codec_priv *priv, 408 uint8_t shm_id, uint32_t *len, uint8_t *type) 409 { 410 struct ec_param_ec_codec p; 411 struct ec_response_ec_codec_get_shm_addr r; 412 uint32_t req, offset; 413 = 414 p.cmd =3D EC_CODEC_GET_SHM_ADDR; 415 p.get_shm_addr_param.shm_id =3D shm_id; 416 if (send_ec_host_command(priv->ec_device, EC_CMD_EC_CODEC, 417 (uint8_t *)&p, sizeof(p), 418 (uint8_t *)&r, sizeof(r)) < 0) { 419 dev_err(priv->dev, "failed to EC_CODEC_GET_SHM_ADDR\n"); 420 return NULL; 421 } 422 = 423 dev_dbg(priv->dev, "phys_addr=3D%#llx, len=3D%#x\n", r.phys_addr, r= .len); 424 = 425 *len =3D r.len; 426 *type =3D r.type; 427 = 428 switch (r.type) { 429 case EC_CODEC_SHM_TYPE_EC_RAM: > 430 return devm_ioremap_wc(priv->dev, 431 r.phys_addr + priv->ec_shm_addr, r.len); 432 case EC_CODEC_SHM_TYPE_SYSTEM_RAM: 433 if (r.phys_addr) { 434 dev_err(priv->dev, "unknown status\n"); 435 return NULL; 436 } 437 = 438 req =3D round_up(r.len, PAGE_SIZE); 439 dev_dbg(priv->dev, "round up from %u to %u\n", r.len, req); 440 = 441 if (priv->ap_shm_last_alloc + req > 442 priv->ap_shm_phys_addr + priv->ap_shm_len) { 443 dev_err(priv->dev, "insufficient space for AP SHM\n"); 444 return NULL; 445 } 446 = 447 dev_dbg(priv->dev, "alloc AP SHM addr=3D%#llx, len=3D%#x\n", 448 priv->ap_shm_last_alloc, req); 449 = 450 p.cmd =3D EC_CODEC_SET_SHM_ADDR; 451 p.set_shm_addr_param.phys_addr =3D priv->ap_shm_last_alloc; 452 p.set_shm_addr_param.len =3D req; 453 p.set_shm_addr_param.shm_id =3D shm_id; 454 if (send_ec_host_command(priv->ec_device, EC_CMD_EC_CODEC, 455 (uint8_t *)&p, sizeof(p), 456 NULL, 0) < 0) { 457 dev_err(priv->dev, "failed to EC_CODEC_SET_SHM_ADDR\n"); 458 return NULL; 459 } 460 = 461 /* 462 * Note: EC codec only requests for `r.len' but we allocate 463 * round up PAGE_SIZE `req'. 464 */ 465 offset =3D priv->ap_shm_last_alloc - priv->ap_shm_phys_addr; 466 priv->ap_shm_last_alloc +=3D req; 467 = 468 return (void *)(uintptr_t)(priv->ap_shm_addr + offset); 469 default: 470 return NULL; 471 } 472 } 473 = 474 static bool wov_queue_full(struct cros_ec_codec_priv *priv) 475 { 476 return ((priv->wov_wp + 1) % sizeof(priv->wov_buf)) =3D=3D priv->wo= v_rp; 477 } 478 = 479 static size_t wov_queue_size(struct cros_ec_codec_priv *priv) 480 { 481 if (priv->wov_wp >=3D priv->wov_rp) 482 return priv->wov_wp - priv->wov_rp; 483 else 484 return sizeof(priv->wov_buf) - priv->wov_rp + priv->wov_wp; 485 } 486 = 487 static void wov_queue_dequeue(struct cros_ec_codec_priv *priv, size_= t len) 488 { 489 struct snd_pcm_runtime *runtime =3D priv->wov_substream->runtime; 490 size_t req; 491 = 492 while (len) { 493 req =3D min(len, runtime->dma_bytes - priv->wov_dma_offset); 494 if (priv->wov_wp >=3D priv->wov_rp) 495 req =3D min(req, (size_t)priv->wov_wp - priv->wov_rp); 496 else 497 req =3D min(req, sizeof(priv->wov_buf) - priv->wov_rp); 498 = 499 memcpy(runtime->dma_area + priv->wov_dma_offset, 500 priv->wov_buf + priv->wov_rp, req); 501 = 502 priv->wov_dma_offset +=3D req; 503 if (priv->wov_dma_offset =3D=3D runtime->dma_bytes) 504 priv->wov_dma_offset =3D 0; 505 = 506 priv->wov_rp +=3D req; 507 if (priv->wov_rp =3D=3D sizeof(priv->wov_buf)) 508 priv->wov_rp =3D 0; 509 = 510 len -=3D req; 511 } 512 = 513 snd_pcm_period_elapsed(priv->wov_substream); 514 } 515 = 516 static void wov_queue_try_dequeue(struct cros_ec_codec_priv *priv) 517 { 518 size_t period_bytes =3D snd_pcm_lib_period_bytes(priv->wov_substrea= m); 519 = 520 while (period_bytes && wov_queue_size(priv) >=3D period_bytes) { 521 wov_queue_dequeue(priv, period_bytes); 522 period_bytes =3D snd_pcm_lib_period_bytes(priv->wov_substream); 523 } 524 } 525 = 526 static void wov_queue_enqueue(struct cros_ec_codec_priv *priv, 527 uint8_t *addr, size_t len, bool iomem) 528 { 529 size_t req; 530 = 531 while (len) { 532 if (wov_queue_full(priv)) { 533 wov_queue_try_dequeue(priv); 534 = 535 if (wov_queue_full(priv)) { 536 dev_err(priv->dev, "overrun detected\n"); 537 return; 538 } 539 } 540 = 541 if (priv->wov_wp >=3D priv->wov_rp) 542 req =3D sizeof(priv->wov_buf) - priv->wov_wp; 543 else 544 /* Note: waste 1-byte to differentiate full and empty */ 545 req =3D priv->wov_rp - priv->wov_wp - 1; 546 req =3D min(req, len); 547 = 548 if (iomem) > 549 memcpy_fromio(priv->wov_buf + priv->wov_wp, addr, req); 550 else 551 memcpy(priv->wov_buf + priv->wov_wp, addr, req); 552 = 553 priv->wov_wp +=3D req; 554 if (priv->wov_wp =3D=3D sizeof(priv->wov_buf)) 555 priv->wov_wp =3D 0; 556 = 557 addr +=3D req; 558 len -=3D req; 559 } 560 = 561 wov_queue_try_dequeue(priv); 562 } 563 = --- 0-DAY kernel test infrastructure Open Source Technology Cent= er https://lists.01.org/pipermail/kbuild-all Intel Corporati= on --===============7939301581183369208==--