From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A9738C433EB for ; Tue, 28 Jul 2020 18:36:21 +0000 (UTC) Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 82BE820786 for ; Tue, 28 Jul 2020 18:36:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="PvUUgnaj" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 82BE820786 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=broadcom.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=driverdev-devel-bounces@linuxdriverproject.org Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 101FE2079C; Tue, 28 Jul 2020 18:36:21 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id aNgvmeRG9D4z; Tue, 28 Jul 2020 18:36:19 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by silver.osuosl.org (Postfix) with ESMTP id 1CFBE204DC; Tue, 28 Jul 2020 18:36:19 +0000 (UTC) Received: from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137]) by ash.osuosl.org (Postfix) with ESMTP id 4BF401BF28E for ; Tue, 28 Jul 2020 18:36:17 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by fraxinus.osuosl.org (Postfix) with ESMTP id 47E9A84E7C for ; Tue, 28 Jul 2020 18:36:17 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from fraxinus.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 4wpbkbJ6z4K4 for ; Tue, 28 Jul 2020 18:36:16 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-wr1-f65.google.com (mail-wr1-f65.google.com [209.85.221.65]) by fraxinus.osuosl.org (Postfix) with ESMTPS id 7098B849B7 for ; Tue, 28 Jul 2020 18:36:16 +0000 (UTC) Received: by mail-wr1-f65.google.com with SMTP id a15so19240075wrh.10 for ; Tue, 28 Jul 2020 11:36:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Ag+56VHWa4UupCVslbddFog8v3QbAb1GzSUnW5D8pYk=; b=PvUUgnajTgVqHh7tBRuZtFIB7BDtmLfblYvw2jEF15/d3+GlAPeqDzU78CSy/v0pSc lRFq6ogjsZSCDNnqZvDLYvmrGBsDuGWMguwsPfef44qQP0JhMGjYegJNcQNw7zqiNRbQ oPe6Iyj4j4DGdTKv7Om6t5OoeejJ16+aTcAjU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Ag+56VHWa4UupCVslbddFog8v3QbAb1GzSUnW5D8pYk=; b=ZbLnJWTfIG3/JKh27J0Qs2WBde+xgj2SOBga3kSf0nrGCpTynvEYX3eVwD8y7nBsyR Fp0VOUOvy/pZtB37y48HxIjlyLldnDQtrjVeDOJQtCSInllnszP8Mh1FhvS8BUwS3DAu dXpgvIld6mCoKcaGNK/TCDQjQeGkWvw9qHpQAMjYZ6gLaO+F1y8cJv/RAUwH/5cz6hcD JsgylLJznHf0iM31qQJjYxa4WpHnuMxWKq1pqAGAH3yQKnLbC9AiEnT7lI4qSZrJ1/5Y 8a/dPkWtlAGe/e5YjvY6ilj8e9P5ENaDKz6tRdpfoNKxmPq+bKpVHM92cxAKqZ4gHIbu 2iYw== X-Gm-Message-State: AOAM530zMCgDjnTFJJ3pECU23o3+M3IGTEeaZR+GL2yUjGFhM9CswfjU iRkaKfNLQDqfM94LHzSstgI4wXBOiZFL5rWLtfn+mA== X-Google-Smtp-Source: ABdhPJyyeHCQpGWv2ZVhb8OOYQVNDOYREJTG68F/E7l3B030xqT3Xde6PnTY6nzIbRmhmBAEDqIr9CfuhXn3sEs6Cd4= X-Received: by 2002:adf:ebc5:: with SMTP id v5mr22136755wrn.100.1595961374761; Tue, 28 Jul 2020 11:36:14 -0700 (PDT) MIME-Version: 1.0 References: <20200724203407.16972-1-james.quinlan@broadcom.com> <20200724203407.16972-9-james.quinlan@broadcom.com> <20200728123343.GA3939@lst.de> In-Reply-To: <20200728123343.GA3939@lst.de> From: Jim Quinlan Date: Tue, 28 Jul 2020 14:36:02 -0400 Message-ID: Subject: Re: [PATCH v9 08/12] device core: Introduce DMA range map, supplanting dma_pfn_offset To: Christoph Hellwig X-BeenThere: driverdev-devel@linuxdriverproject.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Driver Project Developer List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Rich Felker , "open list:SUPERH" , David Airlie , "open list:PCI NATIVE HOST BRIDGE AND ENDPOINT DRIVERS" , Hanjun Guo , "open list:REMOTE PROCESSOR \(REMOTEPROC\) SUBSYSTEM" , Andy Shevchenko , Bjorn Andersson , Julien Grall , Heikki Krogerus , "H. Peter Anvin" , Will Deacon , Marek Szyprowski , "open list:STAGING SUBSYSTEM" , Jean-Philippe Brucker , Lorenzo Pieralisi , Yoshinori Sato , Frank Rowand , Joerg Roedel , "maintainer:X86 ARCHITECTURE \(32-BIT AND 64-BIT\)" , Russell King , "open list:ACPI FOR ARM64 \(ACPI/arm64\)" , Chen-Yu Tsai , Ingo Molnar , "maintainer:BROADCOM BCM7XXX ARM ARCHITECTURE" , Alan Stern , Len Brown , Ohad Ben-Cohen , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE" , Philipp Zabel , Arnd Bergmann , Suzuki K Poulose , Maxime Ripard , Rob Herring , Borislav Petkov , "open list:DRM DRIVERS FOR ALLWINNER A10" , Yong Deng , Santosh Shilimkar , Bjorn Helgaas , Florian Fainelli , Thomas Gleixner , Mauro Carvalho Chehab , "moderated list:ARM PORT" , Saravana Kannan , Greg Kroah-Hartman , Oliver Neukum , "Rafael J. Wysocki" , open list , Paul Kocialkowski , "open list:IOMMU DRIVERS" , "open list:USB SUBSYSTEM" , Stefano Stabellini , Daniel Vetter , Sudeep Holla , "open list:ALLWINNER A10 CSI DRIVER" , Robin Murphy , Nicolas Saenz Julienne , "moderated list:BROADCOM BCM2711/BCM2835 ARM ARCHITECTURE" Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: driverdev-devel-bounces@linuxdriverproject.org Sender: "devel" Hi Christoph, On Tue, Jul 28, 2020 at 8:33 AM Christoph Hellwig wrote: > > A few tiny nitpicks: > > The subject should have the dma-mapping prefix, this doesn't > really touch the device core. > > > - rc = of_dma_get_range(np, &dma_addr, &paddr, &size); > > + rc = of_dma_get_range(np, &map); > > + rc = PTR_ERR_OR_ZERO(map); > > I don't think you need the PTR_ERR_OR_ZERO line here, of_dma_get_range > returns the error. Yes, that link needs to be deleted. > > > +int dma_set_offset_range(struct device *dev, phys_addr_t cpu_start, > > + dma_addr_t dma_start, u64 size)hh > > +{ > > + struct bus_dma_region *map; > > + u64 offset = (u64)cpu_start - (u64)dma_start; > > + > > + if (!dev) > > + return -ENODEV; > > I don't think we need the NULL protection here, all DMA API calls > expect a device. Yes, your review-patch removed it but left the comment about the function returning -ENODEV. So I wasn't sure to leave it in or not. > > > + if (!offset) > > + return 0; > > + > > + /* > > + * See if a map already exists and we already encompass the new range: > > + */ > > + if (dev->dma_range_map) { > > + if (dma_range_overlaps(dev, cpu_start, dma_start, size, offset)) > > + return 0; > > + dev_err(dev, "attempt to add conflicting DMA range to existing map\n"); > > + return -EINVAL; > > + } > > And here why do we need the overlap check at all? I'd be tempted to > always return an error for this case. I believe the overlap check was your suggestion or at least in your review-patch? I'm fine with just returning an error. > > What is the plan to merge this? Do you want all this to go into one > tree, or get as many bits into the applicable trees for 5.9 and then > finish up for 5.10? If the former I can apply it to the dma-mapping > tree and just fix up the nitpicks. Whatever you think is best -- I would be quite happy if you could accept at least the "dma_range_map" commit. Of course I'd be most happy if the entire patchset were accepted, but perhaps you can just apply the "dma_range_map" commit, and I will continue to bang away at getting the N-1 PCIe-related commits ack'd and accepted. Thanks much! Jim Quinlan Broadcom STB _______________________________________________ devel mailing list devel@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel