From patchwork Fri Aug 2 13:51:23 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vijendar Mukunda X-Patchwork-Id: 11073631 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D41F814DB for ; Fri, 2 Aug 2019 13:43:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C18F826538 for ; Fri, 2 Aug 2019 13:43:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B584328868; Fri, 2 Aug 2019 13:43:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 92D7A28845 for ; Fri, 2 Aug 2019 13:43:54 +0000 (UTC) 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 20ED41731; Fri, 2 Aug 2019 15:43:02 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 20ED41731 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1564753432; bh=LuPpK681M3z3XMFEgva1fFxSaHbNZR0O3tMm9yOuCaM=; h=From:To:Date:Cc:Subject:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From; b=Lz/xzbLafmwL44KqKoYMdre6gjxFJ0YY5RoE/KDJQ+nbpDqyjsE0cvfS5AxzpMQNg YL3+w/vrW6ZCpg9abaI6ObA8re52IuEm+oMen0nEhmu+7Zy47ve6Siy/oA4Zpvvl56 tx494bUEoLyQRexFZsrzBbxy5sUo1FCVuwN1aiiI= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id A1508F8048E; Fri, 2 Aug 2019 15:43:01 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa1.perex.cz (Postfix, from userid 50401) id F0DA1F8048F; Fri, 2 Aug 2019 15:43:00 +0200 (CEST) Received: from NAM04-CO1-obe.outbound.protection.outlook.com (mail-eopbgr690072.outbound.protection.outlook.com [40.107.69.72]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 99937F800F3 for ; Fri, 2 Aug 2019 15:42:57 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 99937F800F3 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=amdcloud.onmicrosoft.com header.i=@amdcloud.onmicrosoft.com header.b="porYQsY+" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=LgXSMLAuwwJ6qj5Y2oEImUu+NNyuvTt+iQmg5V9+CKlOYN/vNMfAxQy7rfqLh0Tl5Vbv2sArtB6GNexO1KNgW3CgnxuOUpt80BKALG45LzDmvfrLkcGqe4YjBMKE/6bUysroQ6PqHsH8LEFE5UpTHCrrVzPaEBXJNRDmSupV5hOz1oGZ1A/EOxPyA9TuAulGrrJ/Y+pmpJFzRJxHpTbR+01YVPG6cvwVt2tsJzPLmOugDzHhqMb1//8p089ZhZvYKnTy4TNdbdQh215n+frm8y26nyMm9vt4AA6O637Z/mtYVg0MkEShH9aPiwz2kzZxjrU+x4bAoMMUilid+DalvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=TmeCfkDp+EPjuHjLWJdg3X0ajXQqiLdpvv9EdxNIPYA=; b=C4aphddrpfmpW5edYBXAPjaQlTawvoi4Ja7J1/v7DtFnArZp4VU2izYIOilEhg0Q03CKwHk+pwK6tibEjvv2rZwyOiUia6AjzwujZr3UZDUO/fLShoGcilpcpgUj01Nrsj338udjqX/mtSxg3Mb0C1XhnEZsyd2IEEC53EZnsyBmrRUrs9yzaeYhp2+odm/Zm4M9nDWD155+rsIo/h2yaXKknKczYvoIf7raS6jGaodGFJgoJmcbm9bXIHjY5gWYkrspkwNK64vhaRNIWePvx9ia4H0Riuj4mh8FaJN6eGdASpNx9Uro+skStMvuGi+G1P+ffSjfG3mMByZH1tYThg== ARC-Authentication-Results: i=1; mx.microsoft.com 1;spf=none (sender ip is 165.204.84.17) smtp.rcpttodomain=canonical.com smtp.mailfrom=amd.com;dmarc=permerror action=none header.from=amd.com;dkim=none (message not signed);arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amdcloud-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=TmeCfkDp+EPjuHjLWJdg3X0ajXQqiLdpvv9EdxNIPYA=; b=porYQsY+gCdrG/dZAgLg7XZLpSjvda/RlbUKJrG9lFyFrQh+dsTQYPwyuE0vhgX2rpghY7ESCQIfFk282+qDZ/O6TvcnsMVhb/BBi1iRtorObslEtR62tDA4aNp8twLeK/qyxRV2ue2PUfPrZgOhU35G18UbEglJEN/wzyRKL6A= Received: from MWHPR12CA0048.namprd12.prod.outlook.com (2603:10b6:301:2::34) by DM6PR12MB3482.namprd12.prod.outlook.com (2603:10b6:5:3c::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2136.17; Fri, 2 Aug 2019 13:42:53 +0000 Received: from DM3NAM03FT031.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e49::204) by MWHPR12CA0048.outlook.office365.com (2603:10b6:301:2::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2136.13 via Frontend Transport; Fri, 2 Aug 2019 13:42:52 +0000 Authentication-Results: spf=none (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; canonical.com; dkim=none (message not signed) header.d=none; canonical.com; dmarc=permerror action=none header.from=amd.com; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from SATLEXCHOV01.amd.com (165.204.84.17) by DM3NAM03FT031.mail.protection.outlook.com (10.152.82.199) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2136.14 via Frontend Transport; Fri, 2 Aug 2019 13:42:51 +0000 Received: from LinuxHost.amd.com (10.34.1.3) by SATLEXCHOV01.amd.com (10.181.40.71) with Microsoft SMTP Server id 14.3.389.1; Fri, 2 Aug 2019 08:42:50 -0500 From: Vijendar Mukunda To: Date: Fri, 2 Aug 2019 19:21:23 +0530 Message-ID: <1564753899-17124-1-git-send-email-Vijendar.Mukunda@amd.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:165.204.84.17; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(4636009)(396003)(346002)(376002)(39860400002)(136003)(2980300002)(428003)(199004)(189003)(8676002)(81156014)(81166006)(8936002)(478600001)(53936002)(109986005)(70206006)(53416004)(70586007)(2906002)(5660300002)(4326008)(50226002)(68736007)(47776003)(50466002)(48376002)(186003)(476003)(126002)(2616005)(86362001)(36756003)(486006)(426003)(305945005)(356004)(1671002)(6666004)(336012)(54906003)(26005)(316002)(16586007)(7696005)(51416003)(42413003)(266003)(32563001); DIR:OUT; SFP:1101; SCL:1; SRVR:DM6PR12MB3482; H:SATLEXCHOV01.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoDomainNonexistent; A:1; MX:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: e54de44c-f26b-4b86-b881-08d7174f50e3 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(2017052603328); SRVR:DM6PR12MB3482; X-MS-TrafficTypeDiagnostic: DM6PR12MB3482: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4714; X-Forefront-PRVS: 011787B9DD X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info: CLnL4hrBsJMuUPBM+duXjeHLvwVbp66svjjEkqQ5NSbfErHSgFD5B1KpmSqCW/8Z61rjRv+VLM/m9SuKULbg74pJTxbXZBmy52HQIq7q34ETOuf8lkZrQg+skIydFoCuUXqyrW52GQG3ASL6JMP6AlKdn5KBNurWQ4mrz8nsVcwj/wKGYBvBuiAdAHw4CNnoPMcQOwKrTgbxAEpryEJfltRV7tFg8BfHBZ5yyNcnk4jH1UIEUtmWCIIrqZvcspcNNWgREipL7xm5TZzMsvJAMu4kBr5yXpojC+OH+BYQbHtRlEBbLlUf9aV23t1d0Z849zL9zwgonHAFYINsI/GbzOlwF384SD8n5LzWOe5k1prforN1F5vS7cVkJpE8ygBgQatcRI+yEbi2cWSevbZWDCeAWIPFaTkgN4/VdS8FrS4= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Aug 2019 13:42:51.9418 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e54de44c-f26b-4b86-b881-08d7174f50e3 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXCHOV01.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB3482 Cc: "moderated list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM..." , Maruthi Bayyavarapu , Liam Girdwood , open list , YueHaibing , Takashi Iwai , Ravulapati Vishnu vardhan rao , Mark Brown , Vijendar Mukunda , Alexander.Deucher@amd.com, Colin Ian King Subject: [alsa-devel] [PATCH 1/2] ASoC: amd: acp3x: use dma_ops of parent device for acp3x dma driver 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" X-Virus-Scanned: ClamAV using ClamSMTP AMD platform device acp3x_rv_i2s created by parent PCI device driver. Pass struct device of the parent to snd_pcm_lib_preallocate_pages() so dma_alloc_coherent() can use correct dma_ops. Otherwise, it will use default dma_ops which is nommu_dma_ops on x86_64 even when IOMMU is enabled and set to non passthrough mode. Signed-off-by: Vijendar Mukunda --- sound/soc/amd/raven/acp3x-pcm-dma.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sound/soc/amd/raven/acp3x-pcm-dma.c b/sound/soc/amd/raven/acp3x-pcm-dma.c index a4ade6b..905ed2f 100644 --- a/sound/soc/amd/raven/acp3x-pcm-dma.c +++ b/sound/soc/amd/raven/acp3x-pcm-dma.c @@ -385,9 +385,11 @@ static snd_pcm_uframes_t acp3x_dma_pointer(struct snd_pcm_substream *substream) static int acp3x_dma_new(struct snd_soc_pcm_runtime *rtd) { + struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, + DRV_NAME); + struct device *parent = component->dev->parent; snd_pcm_lib_preallocate_pages_for_all(rtd->pcm, SNDRV_DMA_TYPE_DEV, - rtd->pcm->card->dev, - MIN_BUFFER, MAX_BUFFER); + parent, MIN_BUFFER, MAX_BUFFER); return 0; } From patchwork Fri Aug 2 13:51:24 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vijendar Mukunda X-Patchwork-Id: 11073635 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id B146514DB for ; Fri, 2 Aug 2019 13:44:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A008128845 for ; Fri, 2 Aug 2019 13:44:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 938F128868; Fri, 2 Aug 2019 13:44:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D1B7B28845 for ; Fri, 2 Aug 2019 13:44:54 +0000 (UTC) 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 2E3D81769; Fri, 2 Aug 2019 15:44:03 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 2E3D81769 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1564753493; bh=47IS5CmSji3OMJLt9OunEIsKFDZkJzHZ8D4ynIOuqg8=; h=From:To:Date:In-Reply-To:References:Cc:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=gIHY4vaRgZwbpJFbeDWGDMylvegZonx+ECWv9GpwcBQixklOXk4o5g/nTjcg5hDZ+ vctjLVzBMqfTkji27rvFwByk4suAPVnP6Ue6QQ/QxFba/7Iu1WCUOxQmfCfNTYr9Fx jQHziBeOrPViw02k5zHXWan0CV1LK/k6QXfj7fnI= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 7ED95F804FD; Fri, 2 Aug 2019 15:43:19 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa1.perex.cz (Postfix, from userid 50401) id EF5B0F80508; Fri, 2 Aug 2019 15:43:17 +0200 (CEST) Received: from NAM05-CO1-obe.outbound.protection.outlook.com (mail-eopbgr720059.outbound.protection.outlook.com [40.107.72.59]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id C09D9F80114 for ; Fri, 2 Aug 2019 15:43:14 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz C09D9F80114 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=amdcloud.onmicrosoft.com header.i=@amdcloud.onmicrosoft.com header.b="gWSUrlTQ" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RhrvtyuaBTpUZlUMInca7B+JS+x0n2iSHXMiAkwuzHdQocvPQuyEPx/YCR587Ijh/r+4aNfC9zph56OC2OijDLtzq5mx/+Ri7DN3KvMOCtz2M5A8AKNvS4SDEdmKAh+kvxH/bKwiUPaJKe4gPC8suWw3CuObm+NixMQuM2ZWmrJ4o1xf3N6bibot7mGfDl1GF5dn+cPSjIUDslDln/qboCg3NhxkSSuO8dybG5Bu+uG+GxLE5kDhNf4mOySvtnlAMmK6c2xw/mNUOzVsuw4fkCW29XF27dsACWx7GdWVFeva4TENMI/uhAHAiaiAard51nLR2GQaCav5xbgXFJ7JKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=eEwUf1kttizLlLXuRiXzVZnNSjtUsOnTr1jDG1TvPcw=; b=JUx91Apvz6qvMuxuPl4HVsZa1VTnsUW5685s77J/iLuCJV9ymYU/iBlPiDmb9Ib4bHQyOb5NsY3NSV4bd0f4isS8gIkW5sYuHfmTfrKja1URrz8vf3hMrG0aj9PcKEvST8J2qFo8JvAXx3h/rzhsmYZmS2pe2Yo+9fipDvTuKuR7QhUIGHjgquc9t8tUUV5mNDlVAKHWNpEFuCNSwLXGcnhsSk69BhvbOjCGdF04o7r2iWj/Fsa6uRIiFtCGkfsg9MTQUOMRYWccX6dAtIOrs2sY6m3OoLg3kLa97xGUKDBtamHvwmmdNWuPoxRytNEi74rz41pyQ+5XmozNgB+6ew== ARC-Authentication-Results: i=1; mx.microsoft.com 1;spf=none (sender ip is 165.204.84.17) smtp.rcpttodomain=embeddedor.com smtp.mailfrom=amd.com;dmarc=permerror action=none header.from=amd.com;dkim=none (message not signed);arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amdcloud-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=eEwUf1kttizLlLXuRiXzVZnNSjtUsOnTr1jDG1TvPcw=; b=gWSUrlTQOVyRYH97F1F9n314dZDZLqZA5T+JMFdSoxCGaAOV2FxndykoBllpmXLJQeNYxfa3/YAdUiQCxDdiZFzrgWPcKD/Rjzash1aF33At95UgI79kNEGj5Dnic9LigCNDAQo9Y8DiUNOSCX5ugmnU/0i1K+jTJGmL5LKdoB8= Received: from DM3PR12CA0136.namprd12.prod.outlook.com (2603:10b6:0:51::32) by BYAPR12MB3479.namprd12.prod.outlook.com (2603:10b6:a03:ad::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2136.12; Fri, 2 Aug 2019 13:43:10 +0000 Received: from DM3NAM03FT043.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e49::202) by DM3PR12CA0136.outlook.office365.com (2603:10b6:0:51::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2136.16 via Frontend Transport; Fri, 2 Aug 2019 13:43:10 +0000 Authentication-Results: spf=none (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; embeddedor.com; dkim=none (message not signed) header.d=none;embeddedor.com; dmarc=permerror action=none header.from=amd.com; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from SATLEXCHOV01.amd.com (165.204.84.17) by DM3NAM03FT043.mail.protection.outlook.com (10.152.83.227) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384) id 15.20.2136.14 via Frontend Transport; Fri, 2 Aug 2019 13:43:10 +0000 Received: from LinuxHost.amd.com (10.34.1.3) by SATLEXCHOV01.amd.com (10.181.40.71) with Microsoft SMTP Server id 14.3.389.1; Fri, 2 Aug 2019 08:43:08 -0500 From: Vijendar Mukunda To: Date: Fri, 2 Aug 2019 19:21:24 +0530 Message-ID: <1564753899-17124-2-git-send-email-Vijendar.Mukunda@amd.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1564753899-17124-1-git-send-email-Vijendar.Mukunda@amd.com> References: <1564753899-17124-1-git-send-email-Vijendar.Mukunda@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:165.204.84.17; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(4636009)(136003)(39860400002)(376002)(346002)(396003)(2980300002)(428003)(199004)(189003)(50466002)(48376002)(36756003)(356004)(2616005)(476003)(86362001)(426003)(68736007)(336012)(486006)(186003)(126002)(7696005)(446003)(76176011)(6666004)(51416003)(109986005)(26005)(316002)(81156014)(81166006)(2906002)(50226002)(8936002)(8676002)(16586007)(53936002)(11346002)(4326008)(70586007)(70206006)(1671002)(478600001)(47776003)(53416004)(54906003)(5660300002)(305945005)(42413003)(266003)(32563001); DIR:OUT; SFP:1101; SCL:1; SRVR:BYAPR12MB3479; H:SATLEXCHOV01.amd.com; FPR:; SPF:None; LANG:en; PTR:InfoDomainNonexistent; A:1; MX:1; X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2afc14ff-ee42-416b-2a3e-08d7174f5bc4 X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(5600148)(711020)(4605104)(1401327)(2017052603328); SRVR:BYAPR12MB3479; X-MS-TrafficTypeDiagnostic: BYAPR12MB3479: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8273; X-Forefront-PRVS: 011787B9DD X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam-Message-Info: vVHjSopCqUrpuehlS8/EjDP1KkFBRIbrud9g+HXiF/j9Ufk+UmCE7bf7v/DugmJ3jyjdeVUtQqTe878r9y2hMsYv/togIIMSQ0g1XzGClwGNZDEtX2W6uUCg5ToLKG4mWbdMZcnpCB/LwWGZJK6snZQfvuoRHqIeIIB7cSLiFxlztZ5ayBtvZb0Ga4s9FSahxqoaubKDzo9KAXhyZ148A616NgPUK6ucY8tU1hpQVumE6jC4CuGcQMQaoGduK7H+y5MRyIp/vZ/kadPEA0nTLEYZuCeoHwCyaqi2PkGLkGxzl8fTJqsMVVIB8xYr+zbHFayB6prZK8jIi93E7VYYrDK+nIHMBCtveT+4Ph3ACIlOnOa8MPXp2COl2i12XReU6T1SS2DW3vmFc/+EKU19vogLyJfN2VDIkS+QCOjTx5I= X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Aug 2019 13:43:10.1539 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2afc14ff-ee42-416b-2a3e-08d7174f5bc4 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.17]; Helo=[SATLEXCHOV01.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BYAPR12MB3479 Cc: "moderated list:SOUND - SOC LAYER / DYNAMIC AUDIO POWER MANAGEM..." , Maruthi Bayyavarapu , Liam Girdwood , open list , "Gustavo A. R. Silva" , YueHaibing , Takashi Iwai , Ravulapati Vishnu vardhan rao , Mark Brown , Vijendar Mukunda , Alexander.Deucher@amd.com Subject: [alsa-devel] [PATCH 2/2] ASoC: amd: acp3x: use dma address for acp3x dma driver 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: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" X-Virus-Scanned: ClamAV using ClamSMTP We shouldn't assume CPU physical address we get from page_to_phys() is same as DMA address we get from dma_alloc_coherent(). On x86_64, we won't run into any problem with the assumption when dma_ops is nommu_dma_ops. However, DMA address is IOVA when IOMMU is enabled. And it's most likely different from CPU physical address when AMD IOMMU is not in passthrough mode. This patch fixes page faults when IOMMU is enabled. Signed-off-by: Vijendar Mukunda --- sound/soc/amd/raven/acp3x-pcm-dma.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/sound/soc/amd/raven/acp3x-pcm-dma.c b/sound/soc/amd/raven/acp3x-pcm-dma.c index 905ed2f..bc4dfaf 100644 --- a/sound/soc/amd/raven/acp3x-pcm-dma.c +++ b/sound/soc/amd/raven/acp3x-pcm-dma.c @@ -31,8 +31,8 @@ struct i2s_stream_instance { u16 num_pages; u16 channels; u32 xfer_resolution; - struct page *pg; u64 bytescount; + dma_addr_t dma_addr; void __iomem *acp3x_base; }; @@ -211,9 +211,8 @@ static irqreturn_t i2s_irq_handler(int irq, void *dev_id) static void config_acp3x_dma(struct i2s_stream_instance *rtd, int direction) { u16 page_idx; - u64 addr; u32 low, high, val, acp_fifo_addr; - struct page *pg = rtd->pg; + dma_addr_t addr = rtd->dma_addr; /* 8 scratch registers used to map one 64 bit address */ if (direction == SNDRV_PCM_STREAM_PLAYBACK) @@ -229,7 +228,6 @@ static void config_acp3x_dma(struct i2s_stream_instance *rtd, int direction) for (page_idx = 0; page_idx < rtd->num_pages; page_idx++) { /* Load the low address of page int ACP SRAM through SRBM */ - addr = page_to_phys(pg); low = lower_32_bits(addr); high = upper_32_bits(addr); @@ -239,7 +237,7 @@ static void config_acp3x_dma(struct i2s_stream_instance *rtd, int direction) + 4); /* Move to next physically contiguos page */ val += 8; - pg++; + addr += PAGE_SIZE; } if (direction == SNDRV_PCM_STREAM_PLAYBACK) { @@ -341,7 +339,6 @@ static int acp3x_dma_hw_params(struct snd_pcm_substream *substream, { int status; u64 size; - struct page *pg; struct snd_pcm_runtime *runtime = substream->runtime; struct i2s_stream_instance *rtd = runtime->private_data; @@ -354,9 +351,8 @@ static int acp3x_dma_hw_params(struct snd_pcm_substream *substream, return status; memset(substream->runtime->dma_area, 0, params_buffer_bytes(params)); - pg = virt_to_page(substream->dma_buffer.area); - if (pg) { - rtd->pg = pg; + if (substream->dma_buffer.area) { + rtd->dma_addr = substream->dma_buffer.addr; rtd->num_pages = (PAGE_ALIGN(size) >> PAGE_SHIFT); config_acp3x_dma(rtd, substream->stream); status = 0;