From patchwork Wed Jul 31 09:02:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Huan Yang X-Patchwork-Id: 13748286 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 AF67CC3DA64 for ; Wed, 31 Jul 2024 09:02:56 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 214DA10E103; Wed, 31 Jul 2024 09:02:56 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=vivo.com header.i=@vivo.com header.b="Mp7UU5oK"; dkim-atps=neutral Received: from APC01-SG2-obe.outbound.protection.outlook.com (mail-sgaapc01on2082.outbound.protection.outlook.com [40.107.215.82]) by gabe.freedesktop.org (Postfix) with ESMTPS id 3F4BC10E103 for ; Wed, 31 Jul 2024 09:02:53 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=CS2oL8DDGp5lpQpEetRgcfLQK9B0Yl13+oyUx3fGlXq27aupo0oE+hnhOxgTWLRF7TyWUGKaPaF1qJV2vNdTGFNDT8K/Df8wsRt0WJsfezUvm8MT0IcExyL1cdB8ehbD7C02h48Sh2EbgOz1XAsV9xpBJHDO+m44iuY2T6CkAMf/C0NcvLTycjdMNdSwrlwKx3v7qSW+j1SNAvxYNirZO8jito49hsU7F+R1mbgpqtAeBFAyxvC9jfnvi8IS0CI+UQF392FU7f4CrHTP/XGDIDpEAFTVz/3kkZARN23+wVE8Nr/vItLVe9EVXt0leFKo5zjHOHqwTDlST57OXYCBcQ== 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=3nn5gEFQG3ouo3UIbgc1txXVuZpkTgkwJnnt2k//NsA=; b=iN5KV08zmxmc61NOep59GgSGcB0pYsus2qU9yQCi0Trr9dRZ3rmKjAfYwRivHp5sKYbu0fnD3sGiDtXL1rf46kJOkP2A1pltfDmaHXGnopkJhYsiuQMt1ZVEvBirdulanPRtErlRfKOmEVlzfuRzvSmxFS3YMPuQm0iKTBrJoWnQ8sQ2QMyY00ju0M5Kevv9SP1zzjaEUEVTG9KURGQC3dSORrmFbUfFXd8Ejm+Gwffh5j1Jc7l2KYG3X4t/vhDr7VwtaeiqpBp99HDZO527gHZpUomBc1mFOFtoINBzRTU/dylNgmle9hOV492mo3E+CZjmy/4pQirfql0Aqg5Wqg== 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=3nn5gEFQG3ouo3UIbgc1txXVuZpkTgkwJnnt2k//NsA=; b=Mp7UU5oK/uelY6JD+jYF5eTgVgbGrHCcA1kFb2DMeP3iGRGRl0C472/MhINz8G4IHz/wDuC+L1JP5Pw/B5SURz561ZuG5Xh/NTy08CexB+T/A3Rb9xT3BL0EiZyDfqErJfM8/nQ/dEmvZVeBTn2PXW3mmTzuVkds6VjxNm8AHR2CFuxt7xh/+1sIRtVw8kLP2t+BfdTap4VikqfbKoVlZKTFWE0E6iS9gdfL1USE5SyEibXqs7xjIX/GHINVe5bSAeUUcEJgfm2KHHHqhvbyqCOEtGbBApeBv2weggIfFWuv6Yq8Gx1QL3+yl3zNBTAYYuW0PeOcqsxMYMKmt1kBJw== 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 SEYPR06MB7027.apcprd06.prod.outlook.com (2603:1096:101:1e3::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7762.33; Wed, 31 Jul 2024 09:02:45 +0000 Received: from PUZPR06MB5676.apcprd06.prod.outlook.com ([fe80::a00b:f422:ac44:636f]) by PUZPR06MB5676.apcprd06.prod.outlook.com ([fe80::a00b:f422:ac44:636f%6]) with mapi id 15.20.7807.026; Wed, 31 Jul 2024 09:02:45 +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 1/2] udmabuf: fix vmap_udmabuf error page set Date: Wed, 31 Jul 2024 17:02:32 +0800 Message-ID: <20240731090233.1343559-1-link@vivo.com> X-Mailer: git-send-email 2.45.2 X-ClientProxiedBy: SI2PR01CA0035.apcprd01.prod.exchangelabs.com (2603:1096:4:192::13) To PUZPR06MB5676.apcprd06.prod.outlook.com (2603:1096:301:f8::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: PUZPR06MB5676:EE_|SEYPR06MB7027:EE_ X-MS-Office365-Filtering-Correlation-Id: da3641f9-83ca-4682-8275-08dcb13f8ae6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|366016|376014|1800799024|52116014|38350700014; X-Microsoft-Antispam-Message-Info: 7xb+3cbzTmXGoIndO2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oKPX2koQnTr7SSgW6JHxFItAqFYo5OwGmIgzIBKOhxGlEX650GfSOgWOmIaEQhl0oNZVT2nyLd3TmL8J3DS6tymC6gGKEUDDmA79X9x1cnD91Pt4Id53mMJq5nlvXOT+qPxxFwkkKlhCJi83ocjTMMm8APknoImCxJMbvtx8Auz6uo3UzeNzVowZCj6BLDSYSZgIRfuMnYvagGFfQffTKrpZawKFau+/iWKPDw16rAaWCBgs2n6PK+8uH1ONaQg3Uie6Ysr2lR8tfr9cVsFL3SRxCoYQZ+sm7uEYLwYJnkgA0H+Xl479YDT4CEGOR2mssr/G3oA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:PUZPR06MB5676.apcprd06.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(366016)(376014)(1800799024)(52116014)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: q5KE05wV1J/YUUcn+hVGAIeQQbhBzuKBCd1fXgDHuCmdk2uQJqY/qnidX0AEqyPAwDolr13CiMX+foUFyv0yQYChnxHv5V7OkddX7T40vHsXZeeqwpGa5UJFTCp2TbNcR8cr04Y84zzFot2MgWJBWvBUZvoMr5lakxGIz0be0Z8jsYRrY/sYIk6n/2remusV03mpv1ubIP+hi48dqhux0TUn3Y+asWrP6khnD5BP7a1s390xxc8x/GXtTQ5WU/BlkWLuMAMZk7xVyzlK2pawnvFd9EXTEdGi7/0DSWdbNM3f5iaqfzYiI9hPC5jkoOkM1LSWt1E7Olr/4Yo+NhB5ZeSAuG5iuB9Xz1QRMswb3DPdhObzRjvqdPoY8pOBrw79Ox9dTo/CWlgFoBv+p7IAqJIckPI2JqHnl0qabo5bpLIJMVgv5G3XbsRQwYeKVJli7G9d8eFrGB/l1bNBmLH16tA9bp62CSJA6GGOh8dF5bDKZ6iVThVHl2bO8Ic8/o5tgDjsRQr0Ivc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rg: vivo.com X-MS-Exchange-CrossTenant-Network-Message-Id: da3641f9-83ca-4682-8275-08dcb13f8ae6 X-MS-Exchange-CrossTenant-AuthSource: PUZPR06MB5676.apcprd06.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 31 Jul 2024 09:02:45.3951 (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: BuiiuONYAJJpJ6oaMvXtUSeObgbbVwFbpebQVfbLa0SVrAjg6Qf6DMAzBYSFrdbT8x/lVwkz6X5vDwNVYmMIbA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SEYPR06MB7027 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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(-) base-commit: cd19ac2f903276b820f5d0d89de0c896c27036ed diff --git a/drivers/dma-buf/udmabuf.c b/drivers/dma-buf/udmabuf.c index 047c3cd2ceff..6604d91e7072 100644 --- a/drivers/dma-buf/udmabuf.c +++ b/drivers/dma-buf/udmabuf.c @@ -85,7 +85,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); kfree(pages);