Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp498267pxu; Thu, 26 Nov 2020 04:17:00 -0800 (PST) X-Google-Smtp-Source: ABdhPJy0aNfURwSvhVrQTcAbjNftXn9mPvFgXUM8Xyc9XzNHB+cgTO8VWHLp9HvLKmi+Q38sSksV X-Received: by 2002:a05:6402:154b:: with SMTP id p11mr2207695edx.217.1606393020296; Thu, 26 Nov 2020 04:17:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606393020; cv=none; d=google.com; s=arc-20160816; b=XCvevktnx4s2/sbJ7t9ah7fOWIqBHtUnxprjAyBnL2HP7a219i29W8JJlIDoLEr6kh gZvlnc2RrN2Wdk983XJ/YxqBIg0HI3qTiFbrMzpSCIs/DWJrNgKIZvFpi2WLCLGrcNqD g0rag5qmbiZiNMdGBFwwc6YezX39OjmEJ8U/6FUxZgio4TTFHvtqG8qddoP9pS5xJtUu qVYbkqhwrUYFPWHfM6HZJyCq8IBNYZAbqIkl6tfyrxTduyvAViIhxcNJjR+6fQb4iLWO 4cCookh0nqzNrhB7PE8FH1KhvxKGXtxKXd2cgdGu2pij5QeC7M19uaitxGERCX3rJebb XonA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=UpERwUmn/OuG9/9GiqizbXJDLzVxL1S8PfGCKpa9aUg=; b=Du8eMX9QNP8uRsKjUSCock3w6LFRAwVctzf8UgJNvDnV+x9SyfBVRdyKZELuQ2Ppse 4OD+B1fxj5KPU5qQY79IIhMJkN3wVn2JN0/dxp9T99K3fQqo7yrcoFntId7rq5OSehp7 ck1vfdtBVCSN9J26ytfXtD1o8KjR1Qr2unkWAaela9c9v2wRbhhWiP3lR6PbwIS+H8BL WVyF/Yvy32LAZVNr/oIGkm/fIaOkfj1BNjAlejSFLTRhhrFCXy0eDSjlZexXXEiDtnAS Uh+JDZ1qbKUo/1mRZH/NMh045UeBskOH6DmirSpm7TntiT4pYCAN9hHx5GONdgflMf3d PuMA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=nYGL5wwM; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d17si400865edr.514.2020.11.26.04.16.37; Thu, 26 Nov 2020 04:17:00 -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=@gmail.com header.s=20161025 header.b=nYGL5wwM; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732307AbgKZLoz (ORCPT + 99 others); Thu, 26 Nov 2020 06:44:55 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40388 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731379AbgKZLoz (ORCPT ); Thu, 26 Nov 2020 06:44:55 -0500 Received: from mail-pg1-x542.google.com (mail-pg1-x542.google.com [IPv6:2607:f8b0:4864:20::542]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E6415C0613D4; Thu, 26 Nov 2020 03:44:53 -0800 (PST) Received: by mail-pg1-x542.google.com with SMTP id 62so1519150pgg.12; Thu, 26 Nov 2020 03:44:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=UpERwUmn/OuG9/9GiqizbXJDLzVxL1S8PfGCKpa9aUg=; b=nYGL5wwMzInwZKf69/TnCeMo02Cht0pAdcQoAUSgCVe5YzuaNqWcOj9BMSrJG11J2f KNcl4S4BCDyYQZ9xw4Y7s1+6wFphhly5hk8wMuIGqUaPzSzSN98tnParN/VVKeaQNJV1 KhMm0oyRhW/8xPEbWsyFARG/ib75aDcW85H82wQyIIf/H75HSWxzBXzqqRPWQh1WqZcX iPdAS4W+W92oDObcecbFDg5zHufOPtH8/afpKxrogGEW3TTkAY+fxXaJ14gouOOTshdj lDZUplgZzM2IrqxRyA5OetWAyeNjvrdA+uf3NtbZL7nOSM1+RgxdRJ0hsNWi3qqnzHJX thgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=UpERwUmn/OuG9/9GiqizbXJDLzVxL1S8PfGCKpa9aUg=; b=dIdT955rtQoAL64otwwvv/PreNSIo+OCTRiwTTrYytKCmhEVYIFmPBgpKa4li1opUF ENuYDpabXwU+CpJa8j76AojDhJihANjgeZVceyLteDSn0A2OL3jeBR71i+/GCysTpJdv cSIildg/MwpxP0/bdaWNzzrsLj7IptP8YXYX/WljIOyVkx3AssVFjR32d5yQ69anLzLS eQw888ZHd2jjwj1SEGkOk9Pz7njeNkgtrZ6haP9uafdwO2CiP/4xmEwgMN6Mhun0afNe Ubu9t6HEbdhVMDZ7SLEgyrUHddEAezYLcUyHFGyOAz34F7jVbQ+IqGgFhG+hMujl6efv 1brw== X-Gm-Message-State: AOAM531MqtQJ9BV8njN2OMrBbAWzewjpObongyYwvcOxlxWVK4gK5mud HQpfd9ISnT81YQGx5JeLaBk= X-Received: by 2002:a63:62c6:: with SMTP id w189mr2343708pgb.440.1606391093464; Thu, 26 Nov 2020 03:44:53 -0800 (PST) Received: from localhost ([2401:fa00:8f:203:a6ae:11ff:fe11:4b46]) by smtp.gmail.com with ESMTPSA id d15sm6575313pjr.27.2020.11.26.03.44.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Nov 2020 03:44:52 -0800 (PST) Date: Thu, 26 Nov 2020 20:44:50 +0900 From: Sergey Senozhatsky To: Ricardo Ribalda Cc: Marek Szyprowski , Robin Murphy , Christoph Hellwig , Mauro Carvalho Chehab , IOMMU DRIVERS , Joerg Roedel , Linux Doc Mailing List , Linux Kernel Mailing List , Linux Media Mailing List , Tomasz Figa , Sergey Senozhatsky Subject: Re: [PATCH v3 5/6] media: uvcvideo: Use dma_alloc_noncontiguos API Message-ID: <20201126114450.GB3723071@google.com> References: <20201125221917.150463-1-ribalda@chromium.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201125221917.150463-1-ribalda@chromium.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On (20/11/25 23:19), Ricardo Ribalda wrote: [..] > + if (uvc_urb->pages) > + dma_sync_sgtable_for_device(stream_to_dmadev(uvc_urb->stream), > + &uvc_urb->sgt, DMA_FROM_DEVICE); [..] > + if (uvc_urb->pages) > + dma_sync_sgtable_for_cpu(stream_to_dmadev(stream), > + &uvc_urb->sgt, DMA_FROM_DEVICE); [..] > + uvc_urb->pages = dma_alloc_noncontiguous(dma_dev, stream->urb_size, > + &uvc_urb->dma, > + gfp_flags | __GFP_NOWARN, 0); Do we need to pass __GFP_NOWARN? It seems that dma_alloc_noncontiguous() __iommu_dma_alloc_noncontiguous() __iommu_dma_alloc_pages() does this internally. > + if (!uvc_urb->pages) > + return false; > + > + uvc_urb->buffer = vmap(uvc_urb->pages, > + PAGE_ALIGN(stream->urb_size) >> PAGE_SHIFT, > + VM_DMA_COHERENT, PAGE_KERNEL); This is not related to Ricardo's patch, just a side note: I think VM_DMA_COHERENT needs to be renamed. I found it a bit confusing to see DMA_COHERENT mapping being dma_sync-ed. It turned out that the flag has different meaning. -ss