From patchwork Tue Aug 23 11:57:36 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 12952002 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id E4EFEC32792 for ; Tue, 23 Aug 2022 11:59:09 +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 0789A161E; Tue, 23 Aug 2022 13:58:18 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 0789A161E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1661255948; bh=+dqqshU0ljAmVZyhTYG7iiU8fb91m8OUnHtfmn7v4d0=; h=From:To:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=fcCw0adiAdGmF+D1fOw8hrP45c6GbaLh08HKY5qOXA/9aAtga0ugtd9ehIyq2vvFa M8+IyWGItBU/ChwnA6xzvK7L1nTonDcvQCZ0NsIT1GSHkuS6EPi7eL8MzFb4k7Lxel eUuH2wvlNx4jbREGMa/4SV49BW/8p2lYAhm9XGnM= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id ED4C5F804E7; Tue, 23 Aug 2022 13:57:51 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 7CCA1F804E7; Tue, 23 Aug 2022 13:57:50 +0200 (CEST) Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 4091EF80152 for ; Tue, 23 Aug 2022 13:57:44 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 4091EF80152 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="G4CU3WxE"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="o1tlDPQf" Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id F21631F94D; Tue, 23 Aug 2022 11:57:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1661255863; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=BXF00BisYHzylICag8YIUs03V+Q8c/qjPMlGSFey5XY=; b=G4CU3WxEhhmWhR18rQD/sMR+mlZ1SQwIxDLNMV7qKj23K2dKGDwsO6eUB6O99aeD4oIhC1 NBuiTQkEnRCpTKXqhZmerh+gsXP1Kb0qA1DsxO+UHiNgQ6LZTG9EsROZgKj+e0sDHApSHy syKkGrNxjRAH82bcidTTSEFrg28hnLk= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1661255863; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=BXF00BisYHzylICag8YIUs03V+Q8c/qjPMlGSFey5XY=; b=o1tlDPQfEFkQ8nYoFHc0ZpARE1QdxNoK0ye/zPPDSiHKmiaRYFgCFt9QzF1h7Y2Y+uWsoR /ip31CDLKJPeLXDQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id D5B0613AE6; Tue, 23 Aug 2022 11:57:43 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id eAGAM7fABGP1OAAAMHmgww (envelope-from ); Tue, 23 Aug 2022 11:57:43 +0000 From: Takashi Iwai To: alsa-devel@alsa-project.org Subject: [PATCH 1/5] ALSA: vx: Drop superfluous GFP setup Date: Tue, 23 Aug 2022 13:57:36 +0200 Message-Id: <20220823115740.14123-2-tiwai@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220823115740.14123-1-tiwai@suse.de> References: <20220823115740.14123-1-tiwai@suse.de> MIME-Version: 1.0 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" The extra setup with GFP_DMA32 is superfluous for this driver. The whole operation is a simple copy loop, and there is no memory address restriction at all. Drop the useless GFP setup. Signed-off-by: Takashi Iwai --- sound/drivers/vx/vx_pcm.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sound/drivers/vx/vx_pcm.c b/sound/drivers/vx/vx_pcm.c index 3924f5283745..ceaeb257003b 100644 --- a/sound/drivers/vx/vx_pcm.c +++ b/sound/drivers/vx/vx_pcm.c @@ -1215,8 +1215,7 @@ int snd_vx_pcm_new(struct vx_core *chip) if (ins) snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &vx_pcm_capture_ops); snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_VMALLOC, - snd_dma_continuous_data(GFP_KERNEL | GFP_DMA32), - 0, 0); + NULL, 0, 0); pcm->private_data = chip; pcm->private_free = snd_vx_pcm_free; From patchwork Tue Aug 23 11:57:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 12952004 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 24EAEC32792 for ; Tue, 23 Aug 2022 11:59:41 +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 2EDAE163D; Tue, 23 Aug 2022 13:58:49 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 2EDAE163D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1661255979; bh=xZRkHEqI3K8OqHp4glIeN+A9hKbDPjErRa130PN2J/Q=; h=From:To:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=XY8nXIvp0c0bd2LRzqkcylknjiwocdukfN4zDqtyHa80IkyEtDRnnp8GMoto04UpI QOjGKyTERYKN7MrOMnv/UgTuigcEHwIvdUks63g48WvFyx8YMKx6yJjBwB0in03kdw 7rdetDRNgV0q7oVtgrs45cpHjE/1SfdNIcRmubnY= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id E3FF0F804E6; Tue, 23 Aug 2022 13:57:55 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 1566CF80529; Tue, 23 Aug 2022 13:57:53 +0200 (CEST) Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 9E2A8F8027B for ; Tue, 23 Aug 2022 13:57:44 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 9E2A8F8027B Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="LLwYSgkA"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="K/+xy1Wk" Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 19DA61FA73; Tue, 23 Aug 2022 11:57:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1661255864; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=PI/wZdbUkYjQ+d0u4cmEjRKQ6hCMKwq058yCf3kBdzY=; b=LLwYSgkApXESesMaJb4BVlvepwWONfegMf9jDk4jBAMFJ3M9o0jWk+88jzXNCwmW+Sf4ql xQk94mj60b4sfonKtUW5ZocUQzRqiFx2kX9wq8ZLVWZSAN/6dcVrwjN4tOKsOEWPV73hFF 76gRIvuhIUTmwSCQBfl0paVTqzGJAX0= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1661255864; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=PI/wZdbUkYjQ+d0u4cmEjRKQ6hCMKwq058yCf3kBdzY=; b=K/+xy1WkAnDEllOCMQafCAa4GaKsQRsHBZiTQbGenAHFM2Khh02skrYmzV7Pcc2vt/CPhy /Pybk+UCRnIq1dBA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id F380C13AB7; Tue, 23 Aug 2022 11:57:43 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id aCLHOrfABGP1OAAAMHmgww (envelope-from ); Tue, 23 Aug 2022 11:57:43 +0000 From: Takashi Iwai To: alsa-devel@alsa-project.org Subject: [PATCH 2/5] ALSA: pdaudiocf: Drop superfluous GFP setup Date: Tue, 23 Aug 2022 13:57:37 +0200 Message-Id: <20220823115740.14123-3-tiwai@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220823115740.14123-1-tiwai@suse.de> References: <20220823115740.14123-1-tiwai@suse.de> MIME-Version: 1.0 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" The extra setup with GFP_DMA32 is superfluous for this driver. The whole operation is a simple copy loop, and there is no memory address restriction at all. Drop the useless GFP setup. Signed-off-by: Takashi Iwai --- sound/pcmcia/pdaudiocf/pdaudiocf_pcm.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/sound/pcmcia/pdaudiocf/pdaudiocf_pcm.c b/sound/pcmcia/pdaudiocf/pdaudiocf_pcm.c index dfc4295b69c4..aaa82ec36540 100644 --- a/sound/pcmcia/pdaudiocf/pdaudiocf_pcm.c +++ b/sound/pcmcia/pdaudiocf/pdaudiocf_pcm.c @@ -257,8 +257,7 @@ int snd_pdacf_pcm_new(struct snd_pdacf *chip) return err; snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &pdacf_pcm_capture_ops); - snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_VMALLOC, - snd_dma_continuous_data(GFP_KERNEL | GFP_DMA32), + snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_VMALLOC, NULL, 0, 0); pcm->private_data = chip; From patchwork Tue Aug 23 11:57:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 12952003 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 20221C32772 for ; Tue, 23 Aug 2022 11:59:32 +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 5B35715E5; Tue, 23 Aug 2022 13:58:40 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 5B35715E5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1661255970; bh=C1BMA+oajfykmDSKVt/GGLxX3Segr9izj69AIN4edBI=; h=From:To:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=tATYY/NUUPy2DPLLh9k8UAUg7/fv1xMo9MSSn4681a9ndPIOOLSUDM7ngLlYHDuKg CqbhzV2Z3W3lRgZUB5oxs6f2OCwVayf5G6DvOJEA7envkRYvI9WqNP5nmWSbQtFR3W 5z1qDlPW+k9KP3nvyqwD/RXudf89YwzJswyO+q2g= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 670B9F80528; Tue, 23 Aug 2022 13:57:53 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 75AB8F8052D; Tue, 23 Aug 2022 13:57:52 +0200 (CEST) Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 758CAF8020D for ; Tue, 23 Aug 2022 13:57:44 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 758CAF8020D Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="JCPBQ5OU"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="4b7tptFp" Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 31CCC336D1; Tue, 23 Aug 2022 11:57:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1661255864; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Gxr8Ly5IK/o0TT3qgwNuWi7ShMLbZpLRgUMkaHLTuV0=; b=JCPBQ5OUjkRsg8TIfieWG0x7tExAong8obZ90uFgTWXBtVvzzB+z991LqKhXJy7RARO4fS Ls+kR6lnZcqaCUzUJkLugwrfLoFNiSBLhg8PBwnz+jdWuZr+ouLrBbpn0jSq4PeqU2lsUT k6qrgvzzdjvcxPj1s5vkFEkctPqGRxg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1661255864; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Gxr8Ly5IK/o0TT3qgwNuWi7ShMLbZpLRgUMkaHLTuV0=; b=4b7tptFp8L3u0RbCtynJCICW0+EYqFmpDMxSHUyeaqalkKEmP38VxUnGNrbcekCp4GxyJE uY73JYjXq4wtgyCQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 1A75013AE6; Tue, 23 Aug 2022 11:57:44 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id gMfaBbjABGP1OAAAMHmgww (envelope-from ); Tue, 23 Aug 2022 11:57:44 +0000 From: Takashi Iwai To: alsa-devel@alsa-project.org Subject: [PATCH 3/5] ASoC: Intel: sst: Switch to standard device pages Date: Tue, 23 Aug 2022 13:57:38 +0200 Message-Id: <20220823115740.14123-4-tiwai@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220823115740.14123-1-tiwai@suse.de> References: <20220823115740.14123-1-tiwai@suse.de> MIME-Version: 1.0 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" ASoC Atom SST driver is using the continuous RAM pages with GFP_DMA flag for its PCM buffer, but this should work fine with the standard DMA pages. As a part of cleanup work, this patch replaces the buffer allocation to the standard device pages with SNDRV_DMA_TYPE_DEV. Signed-off-by: Takashi Iwai Reviewed-by: Cezary Rojewski --- sound/soc/intel/atom/sst-mfld-platform-pcm.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/sound/soc/intel/atom/sst-mfld-platform-pcm.c b/sound/soc/intel/atom/sst-mfld-platform-pcm.c index a56dd48c045f..c75616a5fd0a 100644 --- a/sound/soc/intel/atom/sst-mfld-platform-pcm.c +++ b/sound/soc/intel/atom/sst-mfld-platform-pcm.c @@ -676,10 +676,9 @@ static int sst_soc_pcm_new(struct snd_soc_component *component, if (dai->driver->playback.channels_min || dai->driver->capture.channels_min) { - snd_pcm_set_managed_buffer_all(pcm, - SNDRV_DMA_TYPE_CONTINUOUS, - snd_dma_continuous_data(GFP_DMA), - SST_MIN_BUFFER, SST_MAX_BUFFER); + snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV, + pcm->card->dev, + SST_MIN_BUFFER, SST_MAX_BUFFER); } return 0; } From patchwork Tue Aug 23 11:57:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 12952006 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 8D2E2C32772 for ; Tue, 23 Aug 2022 12:00:12 +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 C79C61630; Tue, 23 Aug 2022 13:59:20 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz C79C61630 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1661256010; bh=4TkKrNJGCiQwsQXZPh9uK1TpbLnyLoxWI4wmeLCveRQ=; h=From:To:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=FMPVQDtaTPlmcFL8aJJ/8TK57UIIcBd3U56Rhb/GLOxA+I+ymmtPI4+AF6UxNO6ZD 6/7oQHpz3fA1wstWO4XWwvJMml8dpnR3IfFPIF1CFs8rBF/RJHg9szKR9sh1c6cDVC spU75CLfnWT+BsTuobIzCu3eFPaVWPWcP1z99azI= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id E5DEFF8053D; Tue, 23 Aug 2022 13:57:56 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id EDF35F8052F; Tue, 23 Aug 2022 13:57:53 +0200 (CEST) Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 5B86FF8030F for ; Tue, 23 Aug 2022 13:57:44 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 5B86FF8030F Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="KiW+Y7/e"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="arPYVCNF" Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 4BE3B1FAA7; Tue, 23 Aug 2022 11:57:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1661255864; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=l2ilPtrE9iMiB4IWTA1MpyM0CsvjsxnRcg5rJ32OSxw=; b=KiW+Y7/eA6bGB59vFHPU2/XL4ec6cLZmKpdER3r4SG3L6iOD6FQixhHlTXAv27CtvbInEY re/cw74qeK6FFrYfiQ1v2ClC6xvwQrEScs+2fObFwBD3fg5zaQNwaYjWoediCCGpRQvwi0 tAwg3EC5bPbpGv5shmXp6l8ZlAM6eJg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1661255864; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=l2ilPtrE9iMiB4IWTA1MpyM0CsvjsxnRcg5rJ32OSxw=; b=arPYVCNFwKDlKu3One0xAARFkRsLmm/cHIRbwn2ldjGUdfA8p9wkgnoBJ1BtqE8xSgPUch nK/Vh7ToSXSaVfDg== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 3327313AB7; Tue, 23 Aug 2022 11:57:44 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id uCfdC7jABGP1OAAAMHmgww (envelope-from ); Tue, 23 Aug 2022 11:57:44 +0000 From: Takashi Iwai To: alsa-devel@alsa-project.org Subject: [PATCH 4/5] ALSA: memalloc: Drop special handling of GFP for CONTINUOUS allocation Date: Tue, 23 Aug 2022 13:57:39 +0200 Message-Id: <20220823115740.14123-5-tiwai@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220823115740.14123-1-tiwai@suse.de> References: <20220823115740.14123-1-tiwai@suse.de> MIME-Version: 1.0 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" Now that all users of snd_dma_continuous_data() is gone, let's drop this ugly (and dangerous) way. After this commit, SNDRV_DMA_TYPE_CONTINUOUS may take the standard device pointer instead of the hacked pointer by the macro above, and the memalloc core refers to the coherent_dma_mask of the given device like other SNDRV_DMA_TYPE. It's still allowed to pass NULL there, and in that case, the allocation is performed always in the normal zone. For SNDRV_DMA_TYPE_VMALLOC, the device pointer is simply ignored. Signed-off-by: Takashi Iwai --- include/sound/memalloc.h | 3 -- sound/core/memalloc.c | 113 +++++++++++++++++---------------------- 2 files changed, 48 insertions(+), 68 deletions(-) diff --git a/include/sound/memalloc.h b/include/sound/memalloc.h index 8d79cebf95f3..43d524580bd2 100644 --- a/include/sound/memalloc.h +++ b/include/sound/memalloc.h @@ -26,9 +26,6 @@ struct snd_dma_device { struct device *dev; /* generic device */ }; -#define snd_dma_continuous_data(x) ((struct device *)(__force unsigned long)(x)) - - /* * buffer types */ diff --git a/sound/core/memalloc.c b/sound/core/memalloc.c index b665ac66ccbe..39561faef6e9 100644 --- a/sound/core/memalloc.c +++ b/sound/core/memalloc.c @@ -18,25 +18,18 @@ #include #include "memalloc_local.h" +#define DEFAULT_GFP \ + (GFP_KERNEL | \ + __GFP_COMP | /* compound page lets parts be mapped */ \ + __GFP_NORETRY | /* don't trigger OOM-killer */ \ + __GFP_NOWARN) /* no stack trace print - this call is non-critical */ + static const struct snd_malloc_ops *snd_dma_get_ops(struct snd_dma_buffer *dmab); #ifdef CONFIG_SND_DMA_SGBUF -static void *do_alloc_fallback_pages(struct device *dev, size_t size, - dma_addr_t *addr, bool wc); -static void do_free_fallback_pages(void *p, size_t size, bool wc); static void *snd_dma_sg_fallback_alloc(struct snd_dma_buffer *dmab, size_t size); #endif -/* a cast to gfp flag from the dev pointer; for CONTINUOUS and VMALLOC types */ -static inline gfp_t snd_mem_get_gfp_flags(const struct snd_dma_buffer *dmab, - gfp_t default_gfp) -{ - if (!dmab->dev.dev) - return default_gfp; - else - return (__force gfp_t)(unsigned long)dmab->dev.dev; -} - static void *__snd_dma_alloc_pages(struct snd_dma_buffer *dmab, size_t size) { const struct snd_malloc_ops *ops = snd_dma_get_ops(dmab); @@ -284,24 +277,54 @@ EXPORT_SYMBOL(snd_sgbuf_get_chunk_size); /* * Continuous pages allocator */ -static void *do_alloc_pages(size_t size, dma_addr_t *addr, gfp_t gfp) +static void *do_alloc_pages(struct device *dev, size_t size, dma_addr_t *addr, + bool wc) { - void *p = alloc_pages_exact(size, gfp); + void *p; + gfp_t gfp = GFP_KERNEL | __GFP_NORETRY | __GFP_NOWARN; - if (p) - *addr = page_to_phys(virt_to_page(p)); + again: + p = alloc_pages_exact(size, gfp); + if (!p) + return NULL; + *addr = page_to_phys(virt_to_page(p)); + if (!dev) + return p; + if ((*addr + size - 1) & ~dev->coherent_dma_mask) { + if (IS_ENABLED(CONFIG_ZONE_DMA32) && !(gfp & GFP_DMA32)) { + gfp |= GFP_DMA32; + goto again; + } + if (IS_ENABLED(CONFIG_ZONE_DMA) && !(gfp & GFP_DMA)) { + gfp = (gfp & ~GFP_DMA32) | GFP_DMA; + goto again; + } + } +#ifdef CONFIG_X86 + if (wc) + set_memory_wc((unsigned long)(p), size >> PAGE_SHIFT); +#endif return p; } +static void do_free_pages(void *p, size_t size, bool wc) +{ +#ifdef CONFIG_X86 + if (wc) + set_memory_wb((unsigned long)(p), size >> PAGE_SHIFT); +#endif + free_pages_exact(p, size); +} + + static void *snd_dma_continuous_alloc(struct snd_dma_buffer *dmab, size_t size) { - return do_alloc_pages(size, &dmab->addr, - snd_mem_get_gfp_flags(dmab, GFP_KERNEL)); + return do_alloc_pages(dmab->dev.dev, size, &dmab->addr, false); } static void snd_dma_continuous_free(struct snd_dma_buffer *dmab) { - free_pages_exact(dmab->area, dmab->bytes); + do_free_pages(dmab->area, dmab->bytes, false); } static int snd_dma_continuous_mmap(struct snd_dma_buffer *dmab, @@ -324,9 +347,7 @@ static const struct snd_malloc_ops snd_dma_continuous_ops = { */ static void *snd_dma_vmalloc_alloc(struct snd_dma_buffer *dmab, size_t size) { - gfp_t gfp = snd_mem_get_gfp_flags(dmab, GFP_KERNEL | __GFP_HIGHMEM); - - return __vmalloc(size, gfp); + return vmalloc(size); } static void snd_dma_vmalloc_free(struct snd_dma_buffer *dmab) @@ -440,12 +461,6 @@ static const struct snd_malloc_ops snd_dma_iram_ops = { }; #endif /* CONFIG_GENERIC_ALLOCATOR */ -#define DEFAULT_GFP \ - (GFP_KERNEL | \ - __GFP_COMP | /* compound page lets parts be mapped */ \ - __GFP_NORETRY | /* don't trigger OOM-killer */ \ - __GFP_NOWARN) /* no stack trace print - this call is non-critical */ - /* * Coherent device pages allocator */ @@ -479,12 +494,12 @@ static const struct snd_malloc_ops snd_dma_dev_ops = { #ifdef CONFIG_SND_DMA_SGBUF static void *snd_dma_wc_alloc(struct snd_dma_buffer *dmab, size_t size) { - return do_alloc_fallback_pages(dmab->dev.dev, size, &dmab->addr, true); + return do_alloc_pages(dmab->dev.dev, size, &dmab->addr, true); } static void snd_dma_wc_free(struct snd_dma_buffer *dmab) { - do_free_fallback_pages(dmab->area, dmab->bytes, true); + do_free_pages(dmab->area, dmab->bytes, true); } static int snd_dma_wc_mmap(struct snd_dma_buffer *dmab, @@ -697,37 +712,6 @@ static const struct snd_malloc_ops snd_dma_sg_wc_ops = { .get_chunk_size = snd_dma_noncontig_get_chunk_size, }; -/* manual page allocations with wc setup */ -static void *do_alloc_fallback_pages(struct device *dev, size_t size, - dma_addr_t *addr, bool wc) -{ - gfp_t gfp = GFP_KERNEL | __GFP_NORETRY | __GFP_NOWARN; - void *p; - - again: - p = do_alloc_pages(size, addr, gfp); - if (!p || (*addr + size - 1) & ~dev->coherent_dma_mask) { - if (IS_ENABLED(CONFIG_ZONE_DMA32) && !(gfp & GFP_DMA32)) { - gfp |= GFP_DMA32; - goto again; - } - if (IS_ENABLED(CONFIG_ZONE_DMA) && !(gfp & GFP_DMA)) { - gfp = (gfp & ~GFP_DMA32) | GFP_DMA; - goto again; - } - } - if (p && wc) - set_memory_wc((unsigned long)(p), size >> PAGE_SHIFT); - return p; -} - -static void do_free_fallback_pages(void *p, size_t size, bool wc) -{ - if (wc) - set_memory_wb((unsigned long)(p), size >> PAGE_SHIFT); - free_pages_exact(p, size); -} - /* Fallback SG-buffer allocations for x86 */ struct snd_dma_sg_fallback { size_t count; @@ -742,7 +726,7 @@ static void __snd_dma_sg_fallback_free(struct snd_dma_buffer *dmab, size_t i; for (i = 0; i < sgbuf->count && sgbuf->pages[i]; i++) - do_free_fallback_pages(page_address(sgbuf->pages[i]), PAGE_SIZE, wc); + do_free_pages(page_address(sgbuf->pages[i]), PAGE_SIZE, wc); kvfree(sgbuf->pages); kvfree(sgbuf->addrs); kfree(sgbuf); @@ -769,8 +753,7 @@ static void *snd_dma_sg_fallback_alloc(struct snd_dma_buffer *dmab, size_t size) goto error; for (i = 0; i < count; sgbuf->count++, i++) { - p = do_alloc_fallback_pages(dmab->dev.dev, PAGE_SIZE, - &sgbuf->addrs[i], wc); + p = do_alloc_pages(dmab->dev.dev, PAGE_SIZE, &sgbuf->addrs[i], wc); if (!p) goto error; sgbuf->pages[i] = virt_to_page(p); From patchwork Tue Aug 23 11:57:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Takashi Iwai X-Patchwork-Id: 12952005 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 5168DC32772 for ; Tue, 23 Aug 2022 11:59:55 +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 99CCD1654; Tue, 23 Aug 2022 13:59:03 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 99CCD1654 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1661255993; bh=xL4KA/wZrY4kZmBA8+zjMIZqW0SsFCgEW76L1igVqWE=; h=From:To:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=hUJg/kDTV+kj2UNpPsCD1ju0dZU7WtURGblVS4KDJIEV3c9VsAXjgeT2ruD/d8YDu 29+2NEKlI1T1/p0JZiMhIl4L+Jh/qt78IueyfQ2MSYp5xU2+SmNL0KG+3vsmC/1AUm y/2Mi8VW+bHwyZwk4vwGp6RkyjD7ECctXvvHSYyI= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 69916F80536; Tue, 23 Aug 2022 13:57:56 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 9BE1DF8020D; Tue, 23 Aug 2022 13:57:53 +0200 (CEST) Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id D9FB8F804E6 for ; Tue, 23 Aug 2022 13:57:44 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz D9FB8F804E6 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.b="dgHVwyQP"; dkim=permerror (0-bit key) header.d=suse.de header.i=@suse.de header.b="+SaJrFe7" Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 68862336D3; Tue, 23 Aug 2022 11:57:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1661255864; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QExBB+fUDys4PhhPdbLolaTTUnFQ4aogbQI4fJNZXfE=; b=dgHVwyQPiEnM1SngscGTXzaP/BAT19sl5c9kj7TDF7z9D24Qm2mRFeSud8oNvDknR8/2JZ tJH9hDK+S1qNLFSktI+sMe/bUrrwsue4bTbotWwRmkkDdReijg+VbFDJUlcCiHpV6mt3kT /61FRRoOYz3fvQoO/5GTulZOwhh0FuA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1661255864; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=QExBB+fUDys4PhhPdbLolaTTUnFQ4aogbQI4fJNZXfE=; b=+SaJrFe7VkWlr/ltDzyswGmfnb8KLcl9K6jQNM701DC60txA/vWfknXrKB97HNfS9nIZgd Iiu1SXDRM7NWPdAQ== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 4D43913AE6; Tue, 23 Aug 2022 11:57:44 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id gC9SErjABGP1OAAAMHmgww (envelope-from ); Tue, 23 Aug 2022 11:57:44 +0000 From: Takashi Iwai To: alsa-devel@alsa-project.org Subject: [PATCH 5/5] ALSA: doc: Drop snd_dma_continuous_data() usages Date: Tue, 23 Aug 2022 13:57:40 +0200 Message-Id: <20220823115740.14123-6-tiwai@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20220823115740.14123-1-tiwai@suse.de> References: <20220823115740.14123-1-tiwai@suse.de> MIME-Version: 1.0 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" Update the documentation to follow the recent change of the memory allocation helpers. The macro snd_dma_continuous_data() is gone, and the driver needs to set up the coherent dma mask for allocating in the lower memory addresses, instead. Signed-off-by: Takashi Iwai --- .../kernel-api/writing-an-alsa-driver.rst | 21 +++++++------------ 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/Documentation/sound/kernel-api/writing-an-alsa-driver.rst b/Documentation/sound/kernel-api/writing-an-alsa-driver.rst index 176b73583b7a..07a620c5ca74 100644 --- a/Documentation/sound/kernel-api/writing-an-alsa-driver.rst +++ b/Documentation/sound/kernel-api/writing-an-alsa-driver.rst @@ -3565,13 +3565,17 @@ given size. The second argument (type) and the third argument (device pointer) are dependent on the bus. For normal devices, pass the device pointer (typically identical as ``card->dev``) to the third argument with -``SNDRV_DMA_TYPE_DEV`` type. For the continuous buffer unrelated to the +``SNDRV_DMA_TYPE_DEV`` type. + +For the continuous buffer unrelated to the bus can be pre-allocated with ``SNDRV_DMA_TYPE_CONTINUOUS`` type. You can pass NULL to the device pointer in that case, which is the default mode implying to allocate with ``GFP_KERNEL`` flag. -If you need a different GFP flag, you can pass it by encoding the flag -into the device pointer via a special macro -:c:func:`snd_dma_continuous_data()`. +If you need a restricted (lower) address, set up the coherent DMA mask +bits for the device, and pass the device pointer, like the normal +device memory allocations. For this type, it's still allowed to pass +NULL to the device pointer, too, if no address restriction is needed. + For the scatter-gather buffers, use ``SNDRV_DMA_TYPE_DEV_SG`` with the device pointer (see the `Non-Contiguous Buffers`_ section). @@ -3811,15 +3815,6 @@ arguments here. Since each vmalloc call should succeed at any time, we don't need to pre-allocate the buffers like other continuous pages. -If you need the 32bit DMA allocation, pass the device pointer encoded -by :c:func:`snd_dma_continuous_data()` with ``GFP_KERNEL|__GFP_DMA32`` -argument. - -:: - - snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_VMALLOC, - snd_dma_continuous_data(GFP_KERNEL | __GFP_DMA32), 0, 0); - Proc Interface ==============