From patchwork Mon Aug 5 03:25:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Huan Yang X-Patchwork-Id: 13753097 Received: from APC01-SG2-obe.outbound.protection.outlook.com (mail-sgaapc01on2060.outbound.protection.outlook.com [40.107.215.60]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D97A213E881; Mon, 5 Aug 2024 03:26:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.215.60 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722828379; cv=fail; b=ekw6Xp3ZEKnX4AJEE73zye1o0HkL7XLjkoTRP8t1RaFtZbcWHvrZvkAR245BCqs7YsjkYZBJXP2rxFmtzJsnU2OpYN/IpEDHhG+eJE7EZz/l9lP1Jq8AmTBqw3lTcCxsUNedVFh1tPC9+H+eC3J98BONTdARaRV4CHguwQN7VGY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1722828379; c=relaxed/simple; bh=pErINMFT7IfmYG0GEJAUtRbyEkcrnvQ/3R3/ev6ebYY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: Content-Type:MIME-Version; b=mQ9dWU8r7r5muaTvy63CgKy8RgRu/abYihyQLtFkJ+f3jQuriNQyOTnGN7iO0oPqoGzVLmyB+d7Ede+qrarJGfcW5IHsSTN/1RXDmWjLW44MfuD0f2vUaqNw0qLkvs8SYsMLZYleJUFdCuREVFQI+7VR4LDtmJuOWNzMBmICzQA= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vivo.com; spf=pass smtp.mailfrom=vivo.com; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b=Ug+sMb+B; arc=fail smtp.client-ip=40.107.215.60 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=vivo.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=vivo.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=vivo.com header.i=@vivo.com header.b="Ug+sMb+B" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=kT2LGoI83+6lvunhp7+zi2bcNBVzAtAEDmY7OaKObmlXaTrNsPH5KigLNrUWQEPX11inSQR1sr3BIg7THt/LbWlXgS1C+2ge19A6ve8okvEUtyUf+BFccjSIz/q8qx/TWQ0V9jlDdMMHVUG4ejgAgs4vUZmqLT/acx6PKuqN0/ut0+wKZiUuUBtDEJVk8bTcL5e7eP1EHXobGA0LCRvPEMJmM06cfIJOR0k5PdlaEGGrP9SWLseEcYZYVEWYFcJ2qmPm+qUbkrly5IlTMq2UkgOlzj9jADXgXBdlH5EHxUzPT3gJn6wCrXC7+pz2IuwZq7atwEVz/Mm94XTgITvK+A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=N2cWvy/CqupHCFSbbHPQVyjQiZ/HSwtMGli/YgYqm7Y=; b=UkZ8xZDWvCHl0ThDc0Kb1PmR63pjK0MuoYy0KEVw4XQS3xdYS2BWvvH0J99pzVGxQ9hVPeeT7JHGGehLUOgls/iQmKYTkby5RZRKW5jXB/m08yDqp/BLHLOt01CUtrbW48MwQI02EFnHMfWAMIFQsFaowHIDQVZFQWm2ulxX5oh1d/NjPJNW8C8WfMuC1Jqh6hL+Z5RUj4NtuvhU8ekmd5vsbhJ8AUX7A4g69GsZpJlCgaNB32lMjpyLuLAsqy4CLabvxghrhmD/s/Kwhbf86qfELUg5KZiWKxD+B7ooRuUmPQ1cA3xu1ys0JB6rs7WLczkKKh5gHr2IQg4DyhVzRA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=vivo.com; dmarc=pass action=none header.from=vivo.com; dkim=pass header.d=vivo.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=vivo.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=N2cWvy/CqupHCFSbbHPQVyjQiZ/HSwtMGli/YgYqm7Y=; b=Ug+sMb+B+7Lmfztjj+ECy0+TS/MYpV+BQu3k+iv4CDQLjW1m21EnJ+8LaLJ0jS3CGzBK+VGrvIm5ROG/DsC6ntaaHpvUMQuhBDuw2I76ft98BvzxI2I4hifEcJyacAu5SKmXlEwtN65l+i6vItkd1lM29fyEicu43peAlLCbM3eoQJQdIvWEp99Wd+2SFHlavxnJrzDGYTEly9anfYRzHaLeznPqKyxjRrbu0fFAdjw6HPiwSzm46A4IqkjC07sAqv3yzFrcctUzAiyx2zQhP/GiZMREGebOQzGWRr3GXt3cpD5ZsHbR6U+Cj84P5QPBzJBlI4KcFAj94Qfa1HcX5g== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=vivo.com; Received: from PUZPR06MB5676.apcprd06.prod.outlook.com (2603:1096:301:f8::10) by KL1PR06MB6988.apcprd06.prod.outlook.com (2603:1096:820:11b::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7828.26; Mon, 5 Aug 2024 03:26:13 +0000 Received: from PUZPR06MB5676.apcprd06.prod.outlook.com ([fe80::a00b:f422:ac44:636f]) by PUZPR06MB5676.apcprd06.prod.outlook.com ([fe80::a00b:f422:ac44:636f%4]) with mapi id 15.20.7828.023; Mon, 5 Aug 2024 03:26:12 +0000 From: Huan Yang To: Gerd Hoffmann , Sumit Semwal , =?utf-8?q?Christian_K=C3=B6nig?= , dri-devel@lists.freedesktop.org, linux-media@vger.kernel.org, linaro-mm-sig@lists.linaro.org, linux-kernel@vger.kernel.org Cc: opensource.kernel@vivo.com, Huan Yang Subject: [PATCH v2 3/4] fix vmap_udmabuf error page set Date: Mon, 5 Aug 2024 11:25:45 +0800 Message-ID: <20240805032550.3912454-4-link@vivo.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20240805032550.3912454-1-link@vivo.com> References: <20240805032550.3912454-1-link@vivo.com> X-ClientProxiedBy: SI2P153CA0025.APCP153.PROD.OUTLOOK.COM (2603:1096:4:190::12) To PUZPR06MB5676.apcprd06.prod.outlook.com (2603:1096:301:f8::10) Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PUZPR06MB5676:EE_|KL1PR06MB6988:EE_ X-MS-Office365-Filtering-Correlation-Id: 970a2b40-6021-4f64-d6fd-08dcb4fe5b2f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|52116014|376014|1800799024|366016|38350700014; X-Microsoft-Antispam-Message-Info: dOKilgeqrm+Xo6eNryomT3SOd8pLGkglP22yrUILkQYiosX4/Pftf+jT7wRYGtkPvz4u9hVfDaKAvxBCuvL85K5VUtlHnXK4UrBfbrzb0s9IwqJuV1KxZfnvq9K8w4nQw1ZkS5wCecfUYKEaU3lqtKEfDvwgvs2xQrhwnhcgZOf8iNnVvceyBfTrLgu9rf7xuwV412jZzO8yZq6lROv82pFLBfdl+wTEQ2UBdtOvPk7VArisFr2KEGw7L75C99yZ9vxFg6I+YqMixBeV5pXtyRKJ7CUgWyaZxFPRacdoAKrbWtAqhvpANbC2XTJa6KdcXQlvP+6waCKXYvfPmaXdbNcMpbz14IweH2H970iC3UkoEGa/4RMpoTvBAiQTAU0itvSks4eqdecyr4xa4wDguw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PR06MB5676.apcprd06.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(52116014)(376014)(1800799024)(366016)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: YpD+DXiKUU/CYrWyAUjbeRAJemPXzED3aS/qfLQXAGUDlaayDIggT8KiKaVcDYL/nbRn872Y/a4Kw31mxl6gsqX/u4W3uaomZSHZ+u6A0lu7v3yxwFUdts6HBPVzk56WmdAiKElF4yV2TGFZ/WfDi6a79fBvieUlkg1KMNNsYuMrgntJuae9XCbqiVcCQ/aePOxLj0aFMga8oyi0WCf3f3/f6yyPFdhxwYSaEyQgfAPy+nkwiY+bp7zMdJMxD2xFDUNTCFE57S662lePAqI5dlzb64MahC2mojwIFtYEimrvacAcIctzenkz5DiVvoptSBF0QCg0MXyygxLR2kkE7Om4p8CqIsTYbkLHdq3ZxYnZ45UyNBtqnl7yFXh7OFkIjhfK57ZnfIXIBSF+iSjpMxo2ByO3lAEFgSMOjaUduklVfo3ugnrnGV0X6hct44rB9C78TRocW+kHyI+1qf+aTDKBR61zQLxQJyojPMu8d4UbySjkVGQs5jpOZNaKMMptOvghyv9ZeB8rsBpx5aUdP9GpganXMRvQLmhj6kcCxCjKiMwLvfuNA1Kp8J9zFQddR/CwsUuaSWlQ4gphBuqogH5lEmWkUdiC4ao5/F3dPHvz6ndW3eYde8t7D3L5YWajVjLuCYO11P01ZBlLU71sPcdWMZeTF7S6iTm+4boz0F5k5bm8GvOcYUtwhTYYRQUCxKZoJ8BUfCBp/l+UPzBSAKm33WrQ8Nv86+08s82BshaO3NHW5fr+VFeItzumHLXTMuoykFoum6M6hpTftaN0x6fdOhmFoq4WQlAwzIZzhIe61aMG/HE4tORgBX3MdgW0GgrR/uO/UPpua0edsR2oQO/jUwfFSpQsxUQFBXKNKByExKLfZknDT4Br83q6qD9bhy1BIxWlxTbLUupnBpJnnMPl04pDYUTys7TYvABli86Xl2jC0vqnAb5v7l9dEoOugr3v9KFiA1N1eC+yAkXJ+t9UgikTche+eC+gFmiKFCrLmSnlLYiVAVfSURSQKWKhCeMvmZEb/CXSuI9+u1ucthqApXfd+wV68D/+NbZXNZWYevt7Td7bXmtVoQEfsAJgQYx8hEOLJh4YJN6bFqMw/vJINN7MGjOTmY6KthbHPsd9ZTuuIeoYEAHFEVvVqw5ndqmc5ofDOE3o1zgnrESjiWE7mXVfd3uP8CVCJn6a6WOJFNfv6ptFSLl3xBhkQe+cR3f6Gdlj2IfXUvvBDnKgXKBqIQGtph6GYU17uPe/+CLF7tznCbAEbaTqVPTSqF5Lg5GneYzTDYNT32960Q0j7+rByTfjgfVcSfuNaN2x+fbhBT6n9B5YsZwqopl4R0QHXNcIrM231RaOy36pE0xp0KkiJbwgLPZK2AvZMktmWgofOwD1utN2nkI7WoU9reuxMloG3+9QNfUrZMupqWodF4WwdbfnA3lx9KHzaekytI7NfsVjjWfnLnqSGCRyJpN0fGwt/mzhC4cIjRn8/eB0f9l7Ogrq07DCCjJImJxkpgKNSl/tDNbQyPazBvpraYjCgG+0zRiA+TExTGheb9ZmkICQbGNoJwivO9mz31smAoPsmTbyrXI1wZtXKdC7IjLK X-OriginatorOrg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: 970a2b40-6021-4f64-d6fd-08dcb4fe5b2f X-MS-Exchange-CrossTenant-AuthSource: PUZPR06MB5676.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Aug 2024 03:26:12.6199 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 923e42dc-48d5-4cbe-b582-1a797a6412ed X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: umqNwg+O98Je9z0HhvYhZ4NdqB7seKM4j+KdgXfylpoI9Q4KagyJ1OR1ufb+sdt8AENDClVmPn7RyBmdekOGzw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: KL1PR06MB6988 Currently vmap_udmabuf set page's array by each folio. But, ubuf->folios is only contain's the folio's head page. That mean we repeatedly mapped the folio head page to the vmalloc area. This patch fix it, set each folio's page correct, so that pages array contains right page, and then map into vmalloc area Signed-off-by: Huan Yang --- drivers/dma-buf/udmabuf.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/dma-buf/udmabuf.c b/drivers/dma-buf/udmabuf.c index af2391cea0bf..9737f063b6b3 100644 --- a/drivers/dma-buf/udmabuf.c +++ b/drivers/dma-buf/udmabuf.c @@ -78,7 +78,8 @@ static int vmap_udmabuf(struct dma_buf *buf, struct iosys_map *map) return -ENOMEM; for (pg = 0; pg < ubuf->pagecount; pg++) - pages[pg] = &ubuf->folios[pg]->page; + pages[pg] = folio_page(ubuf->folios[pg], + ubuf->offsets[pg] >> PAGE_SHIFT); vaddr = vm_map_ram(pages, ubuf->pagecount, -1); kvfree(pages);