Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1557138

Re: [PATCH 1/2] dma-mapping: let arch know origin of dma range passed to arch_setup_dma_ops()

Path csiph.com!news.mixmin.net!news.unit0.net!news.panservice.it!bofh.it!news.nic.it!robomod
From Nikita Yushchenko <nikita.yoush@cogentembedded.com>
Newsgroups linux.kernel
Subject Re: [PATCH 1/2] dma-mapping: let arch know origin of dma range passed to arch_setup_dma_ops()
Date Thu, 12 Jan 2017 07:40:02 +0100
Message-ID <sYHdg-CK-5@gated-at.bofh.it> (permalink)
References <sYvYt-1Uj-21@gated-at.bofh.it> <sYvYt-1Uj-23@gated-at.bofh.it> <sYvYu-1Uj-41@gated-at.bofh.it> <sYytj-3x3-9@gated-at.bofh.it> <sYGKe-t5-9@gated-at.bofh.it>
X-Original-To Arnd Bergmann <arnd@arndb.de>
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=cogentembedded-com.20150623.gappssmtp.com; s=20150623; h=subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=O1Sm3RgeYsRyq4GHXYmW8wdAvRA+5mDKFYa/w5X25Qs=; b=NEy8TPjjv4/XaQWUAX7KQr6QYbvPpfqoxvD+51YIi1yDEwT7uqrI/cC3O0cvSF9nRT c5pSfvqMa4ozfK3gdJEteH3t3CQJ9QptQYCtZGEDzBmN0VgFWN1vc7HNuYUCy4xYfk8o 2dQufwvi08DV6vsml6jt4PRNAnwSKLeOmTCf7cakUCFgoTke3xIXHyMDE53vCeV7gqPC tSisUJehB63W3i2TyWWNL0XcnfRgSqfKvgJUvCm0Vt/Cv9EVWsuf96fRgzFZuF1Aua6y qbTl/97i+LEOhDukbY0ECnzAHS51Nv5vcsg3AHhoZ01/+kWhwG9JJpYoGveDXyL+Zutz oFYg==
X-Google-Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=O1Sm3RgeYsRyq4GHXYmW8wdAvRA+5mDKFYa/w5X25Qs=; b=WzLJlC9/iJb/blWaCHOKHdP4X0kWdjbW1cnGgZopGQ8G9aI3EHUmnznRoty1yXb4jV xAPExJbDAnZtsp8y1v1wJctgH8HTJWKCd0kf73x9x8/egJ19abg9WJak2dj4LBE4aTzs YBooOqZ41AdQSu1YIqxiTVNtyIHZgYw/GGKGVgV9XPRDm06WPmMcX8vyCmKHBS3vvFXM TTIBMiEJ2521E3EVRb9i8dBt0mrV+p692QQBWAZXtsAQET+An5twAjiO1C4p9KZKDzen Bn3VD+WbHzf4zUn4TSlt22pUEj1KK0SNeui/8Wz4Hd4fspggKwhPQbgbzNC7dJGOnjoD npsA==
X-Gm-Message-State AIkVDXIWivvFUj9uqq9yoZvxexzXI+m90GXnS2dgcAZIXthPobXoSrZ4Dp83lROQlDcMlQ==
X-Received by 10.46.71.203 with SMTP id u194mr4449121lja.7.1484202814951; Wed, 11 Jan 2017 22:33:34 -0800 (PST)
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Icedove/45.5.1
MIME-Version 1.0
Content-Type text/plain; charset=windows-1252
Content-Transfer-Encoding 7bit
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 55
Organization linux.* mail to news gateway
X-Original-Cc Robin Murphy <robin.murphy@arm.com>, Will Deacon <will.deacon@arm.com>, linux-arm-kernel@lists.infradead.org, linux-renesas-soc@vger.kernel.org, Simon Horman <horms@verge.net.au>, Bjorn Helgaas <bhelgaas@google.com>, fkan@apm.com, linux-kernel@vger.kernel.org, Artemi Ivanov <artemi.ivanov@cogentembedded.com>
X-Original-Date Thu, 12 Jan 2017 09:33:32 +0300
X-Original-Message-ID <7d7dc402-e527-c581-0b1c-37713759db31@cogentembedded.com>
X-Original-References <dca35acf-1adf-aa85-7a0b-d0c6ec702fa1@arm.com> <1484159512-28515-1-git-send-email-nikita.yoush@cogentembedded.com> <1484159512-28515-2-git-send-email-nikita.yoush@cogentembedded.com> <30025121.yS4lyZEDrk@wuerfel> <764334db-3400-58c6-cc4b-3f7ce66daa27@cogentembedded.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1557138

Show key headers only | View raw



12.01.2017 08:52, Nikita Yushchenko wrote:
>>> diff --git a/drivers/staging/fsl-mc/bus/fsl-mc-bus.c b/drivers/staging/fsl-mc/bus/fsl-mc-bus.c
>>> index 5ac373c..480b644 100644
>>> --- a/drivers/staging/fsl-mc/bus/fsl-mc-bus.c
>>> +++ b/drivers/staging/fsl-mc/bus/fsl-mc-bus.c
>>> @@ -540,7 +540,7 @@ int fsl_mc_device_add(struct dprc_obj_desc *obj_desc,
>>>  
>>>  	/* Objects are coherent, unless 'no shareability' flag set. */
>>>  	if (!(obj_desc->flags & DPRC_OBJ_FLAG_NO_MEM_SHAREABILITY))
>>> -		arch_setup_dma_ops(&mc_dev->dev, 0, 0, NULL, true);
>>> +		arch_setup_dma_ops(&mc_dev->dev, 0, 0, false, NULL, true);
>>>  
>>>  	/*
>>>  	 * The device-specific probe callback will get invoked by device_add()
>>
>> Why are these actually calling arch_setup_dma_ops() here in the first
>> place? Are these all devices that are DMA masters without an OF node?
> 
> I don't know, but that's a different topic. This patch just adds
> argument and sets it to false everywhere but in the location when range
> should be definitely enforced.
> 
>>> @@ -126,6 +127,8 @@ void of_dma_configure(struct device *dev, struct device_node *np)
>>>  			return;
>>>  		}
>>>  		dev_dbg(dev, "dma_pfn_offset(%#08lx)\n", offset);
>>> +
>>> +		enforce_range = true;
>>>  	}
>>>  
>>>  	dev->dma_pfn_offset = offset;
>>
>> Hmm, I think when the dma-ranges are missing, we should either enforce
>> a 32-bit mask, or disallow DMA completely. It's probably too late for
>> the latter, I wish we had done this earlier in order to force everyone
>> on ARM64 to have a valid dma-ranges property for any DMA master.
> 
> This can be done over time.
> 
> However the very idea of this version of patch is - keep working pieces
> as-is, thus for now setting enforce_range to false in case of no defined
> dma-ranges is intentional.

What we can do is - check bus width (as it is defined in DT) and set
enforce_range to true if bus is 32-bit

> What I should re-check is - does rcar dtsi set dma-ranges, and add it if
> it does not.

It does not, will have to add.

In DT bus is defined as 64-bit. But looks like physically it is 32-bit.
Maybe DT needs fixing.

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/2] arm64: fix handling of DMA masks wider than bus supports Nikita Yushchenko <nikita.yoush@cogentembedded.com> - 2017-01-11 19:40 +0100
  [PATCH 1/2] dma-mapping: let arch know origin of dma range passed to arch_setup_dma_ops() Nikita Yushchenko <nikita.yoush@cogentembedded.com> - 2017-01-11 19:40 +0100
    Re: [PATCH 1/2] dma-mapping: let arch know origin of dma range passed to arch_setup_dma_ops() Arnd Bergmann <arnd@arndb.de> - 2017-01-11 22:20 +0100
      Re: [PATCH 1/2] dma-mapping: let arch know origin of dma range passed  to arch_setup_dma_ops() Nikita Yushchenko <nikita.yoush@cogentembedded.com> - 2017-01-12 07:10 +0100
        Re: [PATCH 1/2] dma-mapping: let arch know origin of dma range passed  to arch_setup_dma_ops() Nikita Yushchenko <nikita.yoush@cogentembedded.com> - 2017-01-12 07:40 +0100
          Re: [PATCH 1/2] dma-mapping: let arch know origin of dma range passed to arch_setup_dma_ops() Arnd Bergmann <arnd@arndb.de> - 2017-01-12 14:30 +0100
            Re: [PATCH 1/2] dma-mapping: let arch know origin of dma range passed  to arch_setup_dma_ops() Nikita Yushchenko <nikita.yoush@cogentembedded.com> - 2017-01-12 14:50 +0100
        Re: [PATCH 1/2] dma-mapping: let arch know origin of dma range  passed to arch_setup_dma_ops() Will Deacon <will.deacon@arm.com> - 2017-01-12 13:20 +0100
          Re: [PATCH 1/2] dma-mapping: let arch know origin of dma range passed to arch_setup_dma_ops() Arnd Bergmann <arnd@arndb.de> - 2017-01-12 14:30 +0100
            Re: [PATCH 1/2] dma-mapping: let arch know origin of dma range passed  to arch_setup_dma_ops() Robin Murphy <robin.murphy@arm.com> - 2017-01-12 14:50 +0100
    Re: [PATCH 1/2] dma-mapping: let arch know origin of dma range  passed to arch_setup_dma_ops() kbuild test robot <lkp@intel.com> - 2017-01-13 11:50 +0100

csiph-web