Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1037132pxu; Thu, 17 Dec 2020 00:01:34 -0800 (PST) X-Google-Smtp-Source: ABdhPJwnGmBLhDpQJg7RGhQpcpziQB2rCrGyooEMdXeukbEZdAToXCV4901J2b6MCJpeSN39t0Ca X-Received: by 2002:a05:6402:b9a:: with SMTP id cf26mr36812469edb.372.1608192094238; Thu, 17 Dec 2020 00:01:34 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1608192094; cv=pass; d=google.com; s=arc-20160816; b=Cg+zTc/i5SNzixp1/AeybHzxBj7qXZRC5YKW7IFBSCPcqUPB//1w2UEchGbuiCNPjn bJSkvGsJWiHBM2eiarzndb6cm9a1fcBwK5WzArm0MHU2kBUKvNebZgWyesWMSebibhF1 tzAD298MY1operQ+8ZC6YWL6llx7cnIBve26ucCT18bRaboTpOu4unNnZmqGrDi77U7C re8SfWnK/bLfBFcNzmPJwW7xHwhcAOwnNIBVl/R1iAx/CelWPE92abBzejQHb9rk0LuG 3IE31p6EmIZtSP8W4QBddfe4VnSKERlhCcR9ix1MYyZA+ok15R1PGLywxZKaNwZcyVz3 1wPA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from :dkim-signature; bh=Hg8l/NYhQ+1E/LChxorRpKnBB3P4TfJ2XYNh5dqZNQY=; b=tSeNj3PiNhPzh7U68Zg0YVDB/ckZ70rza6ohdDYw7M6ke+mozCtii72F4gvwa77yeJ JJ49+mie5gCRxu8HSVgsELa2eyiBVM1B22ts0PgxCgx/4AJj9r+Yy86uqhM02SA9H/xp L5fyQraShVGxkIv4T5Pj4W/95fnjNOORO7unr1NPDzbZ/sTEewGdxnLXb/z8yFNQlFLx A0uYlP2oiGg/cX5I9eW6FclBhO4wkEof4JCxfZiurQxmvsYXm/smPK6gki/FmAo21r8F 8sU2rKcoLjAOgbV8q0UFwEB5rDjbvi56Jx+a1lJNurbNFr3CcOS7ilylTGilBdpVeNJe Qyeg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=L7x7dviX; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gf18si2222442ejb.202.2020.12.17.00.01.11; Thu, 17 Dec 2020 00:01:34 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=L7x7dviX; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727006AbgLQIAw (ORCPT + 99 others); Thu, 17 Dec 2020 03:00:52 -0500 Received: from mail-eopbgr50051.outbound.protection.outlook.com ([40.107.5.51]:37253 "EHLO EUR03-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726703AbgLQIAw (ORCPT ); Thu, 17 Dec 2020 03:00:52 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HHaz4fkccrtJ/l5WhMeks8dA/mm4WD0LstdngQu1IhL4j5+OoQePA7Y/ehe3j0Z5iLeB7A7WlANHFrbLRi1AkRsXk1v1csspmJqpYEU0dq/dx9Ku9OSHQzllINcn4Mpaqf6Psl2PjOQZ1ESWG39/TRDCG/BlJFlByY+JMRgzlwau0j5/xALs4STQn8zZI+LhnfNPzB37vKe3tfpPJGue9hAi7rVWRvswQAi9lbNHW+TxlRaLrgtCIozRL5vgaaziHcP/CNlzIGKgPEC6Xv7CvWueY7FW8jSthBKwNWDGtYncjm1RWa5YasAw7SuD25oELzRWyGtzeXXnqlaAZoeTfw== 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=Hg8l/NYhQ+1E/LChxorRpKnBB3P4TfJ2XYNh5dqZNQY=; b=ZmNU+y51YGFisq6kzIoGROLefbfXg45q6ab40OcjtGMmKE5BleUV6QGDNEBRqvD61neA3eqi+zUPJIGWd/r5uOZ+NxpQ902BY8xPm/ksWn/9nnPnWFoHXBzx7k2pvdUVwoQgx/2vKzUsSPjxE6dC6St8GmzSrZ9efRcfRRcz8l4Tx/xVYrYVppjeKoMCW6XGpHqIj/Kyq/LyyQ4TXyJQOtA2w8WmisgKuSdfzoq5upKuPXHjdiQJYy/oB3O7KLQ0qXRNo5NL6hz9F39nDu5UFQa7CbzYa0TsYLzyhQFKu2tYRysMXwn3n/kK3lU69kDZSR+04a+KYpcZqFUdVuvGzw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Hg8l/NYhQ+1E/LChxorRpKnBB3P4TfJ2XYNh5dqZNQY=; b=L7x7dviXKQZM4qPzpbRyrUUPj/zJUeEPEbvV35Y1Jki6JLgRNvX8IEFO2zqbBvcKjzOPkyXbYLP1qpEOB/vvf19wyY2FmztT0ow+XmWHH2rFAUFPlwh8WbNuFwpW9EUJHhGx9ew3bM6JHAbY532of6p27pQvuMBzG6YL/zRKipo= Authentication-Results: perex.cz; dkim=none (message not signed) header.d=none;perex.cz; dmarc=none action=none header.from=nxp.com; Received: from VE1PR04MB6638.eurprd04.prod.outlook.com (2603:10a6:803:119::15) by VI1PR0402MB3549.eurprd04.prod.outlook.com (2603:10a6:803:8::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3654.15; Thu, 17 Dec 2020 08:00:03 +0000 Received: from VE1PR04MB6638.eurprd04.prod.outlook.com ([fe80::b042:5b55:165a:87e2]) by VE1PR04MB6638.eurprd04.prod.outlook.com ([fe80::b042:5b55:165a:87e2%5]) with mapi id 15.20.3676.025; Thu, 17 Dec 2020 08:00:03 +0000 From: Robin Gong To: perex@perex.cz, tiwai@suse.com, akpm@linux-foundation.org, xiang@kernel.org, pierre-louis.bossart@linux.intel.com, gustavoars@kernel.org, shengjiu.wang@nxp.com Cc: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Subject: [PATCH v1 ] ALSA: core: memalloc: add page alignment for iram Date: Fri, 18 Dec 2020 00:15:47 +0800 Message-Id: <1608221747-3474-1-git-send-email-yibin.gong@nxp.com> X-Mailer: git-send-email 2.7.4 Content-Type: text/plain X-Originating-IP: [119.31.174.66] X-ClientProxiedBy: SG2PR02CA0004.apcprd02.prod.outlook.com (2603:1096:3:17::16) To VE1PR04MB6638.eurprd04.prod.outlook.com (2603:10a6:803:119::15) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from robin-OptiPlex-790.ap.freescale.net (119.31.174.66) by SG2PR02CA0004.apcprd02.prod.outlook.com (2603:1096:3:17::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.20.3654.12 via Frontend Transport; Thu, 17 Dec 2020 07:59:59 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: bcdca302-a3c5-4ed3-1bb3-08d8a261c278 X-MS-TrafficTypeDiagnostic: VI1PR0402MB3549: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4303; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: oxBOE49abwn1qigOjMY4nWRCp6G726ZQMHyGGYlWe9vx9qt8e76FGoI2g4zq2z0IJd3v/nkEuUenR67es6iY+uckiHe5uyPmWKUtlot6Cs+k+hj6hlkePMOnjkjKjroPrfaO3GX1GiJ+a4SeGuHFOhlIUPm4Msy0XVb5ZOQIxjCCkPH12fcvPTOZi/6r/57s2sUlr90HzHQw130vue7vxCsnV3szAAvyaAxtFdg52oSOeDAdXwcDJHbsf+CqAajkCIU52fxpfrmYav12J2Idz7Rpca60mID5MSAZJSsBsYFMDmUOYR4+91o97ox3nWgUM23h4dYSgOv798PlycygRQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VE1PR04MB6638.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(346002)(366004)(39860400002)(396003)(376002)(136003)(6512007)(316002)(956004)(66476007)(478600001)(6486002)(36756003)(86362001)(6666004)(6636002)(52116002)(8936002)(186003)(4326008)(66946007)(83380400001)(2616005)(16526019)(26005)(4744005)(2906002)(8676002)(5660300002)(66556008)(6506007);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: =?us-ascii?Q?d6kRqk39AqeaA9nRnlDXo7iq7Cjhb3mrGV+HUYVUfvmfKgUMsYEb3csfNDGK?= =?us-ascii?Q?9jYrKPfDog7Rjvfl8MaIUNGmSuJ0Htu1lCBSsuvFpV98SJ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ZcWD9S27RuoDAwanEgvCmwuiVI1VhCimzlDuXZ?= =?us-ascii?Q?wJyv?= X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-AuthSource: VE1PR04MB6638.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Dec 2020 08:00:03.0104 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-Network-Message-Id: bcdca302-a3c5-4ed3-1bb3-08d8a261c278 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: rYccN9F+yDGyi3QGBd1QKhYCXx9xaw8uC7wwyJ97eci0wl+ImjM9VB8KNqipatu13n2ntmtrFQ8KX04Cnn1wjw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0402MB3549 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Since mmap for userspace is based on page alignment, add page alignment for iram alloc from pool, otherwise, some good data located in the same page of dmab->area maybe touched wrongly by userspace like pulseaudio. Signed-off-by: Robin Gong --- sound/core/memalloc.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sound/core/memalloc.c b/sound/core/memalloc.c index 0aeeb62..0f33516 100644 --- a/sound/core/memalloc.c +++ b/sound/core/memalloc.c @@ -77,7 +77,8 @@ static void snd_malloc_dev_iram(struct snd_dma_buffer *dmab, size_t size) /* Assign the pool into private_data field */ dmab->private_data = pool; - dmab->area = gen_pool_dma_alloc(pool, size, &dmab->addr); + dmab->area = gen_pool_dma_alloc_align(pool, size, &dmab->addr, + PAGE_SIZE); } /** -- 2.7.4