All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: Robin Murphy <robin.murphy@arm.com>
Cc: Christoph Hellwig <hch@lst.de>, Jonas Bonn <jonas@southpole.se>,
	Stefan Kristiansson <stefan.kristiansson@saunalahti.fi>,
	Stafford Horne <shorne@gmail.com>,
	Marek Szyprowski <m.szyprowski@samsung.com>,
	Will Deacon <will@kernel.org>,
	Mark Rutland <mark.rutland@arm.com>,
	openrisc@lists.librecores.org, iommu@lists.linux-foundation.org,
	linux-arm-kernel@lists.infradead.org, linux-arch@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] dma-mapping: support setting memory uncached in place
Date: Fri, 21 Feb 2020 15:16:56 +0100	[thread overview]
Message-ID: <20200221141656.GF6968@lst.de> (raw)
In-Reply-To: <502fa745-ddad-f91b-52bc-52edecf8fdbc@arm.com>

On Thu, Feb 20, 2020 at 05:21:35PM +0000, Robin Murphy wrote:
>> @@ -196,10 +192,15 @@ void *dma_direct_alloc_pages(struct device *dev, size_t size,
>>     	memset(ret, 0, size);
>>   -	if (IS_ENABLED(CONFIG_ARCH_HAS_UNCACHED_SEGMENT) &&
>> -	    dma_alloc_need_uncached(dev, attrs)) {
>> +	if (dma_alloc_need_uncached(dev, attrs)) {
>>   		arch_dma_prep_coherent(page, size);
>> -		ret = uncached_kernel_address(ret);
>> +
>> +		if (IS_ENABLED(CONFIG_ARCH_HAS_DMA_SET_UNCACHED)) {
>> +			if (!arch_dma_set_uncached(ret, size))
>> +				goto out_free_pages;
>> +		} else if (IS_ENABLED(CONFIG_ARCH_HAS_UNCACHED_SEGMENT)) {
>> +			ret = uncached_kernel_address(ret);
>
> Hmm, would we actually need to keep ARCH_HAS_UNCACHED_SEGMENT? If 
> arch_dma_set_uncached() returned void*/ERR_PTR instead, then it could work 
> for both cases (with arch_dma_clear_uncached() being a no-op for segments).

Yes, I think so.  I was a little worried about what to do with
cached_kernel_address() in that scheme, but it turns out with the recent
round of dma-direct cleanup that is actually entirely unused now.

WARNING: multiple messages have this Message-ID (diff)
From: Christoph Hellwig <hch@lst.de>
To: Robin Murphy <robin.murphy@arm.com>
Cc: Jonas Bonn <jonas@southpole.se>,
	Mark Rutland <mark.rutland@arm.com>,
	linux-kernel@vger.kernel.org,
	Stefan Kristiansson <stefan.kristiansson@saunalahti.fi>,
	iommu@lists.linux-foundation.org, openrisc@lists.librecores.org,
	linux-arch@vger.kernel.org, Stafford Horne <shorne@gmail.com>,
	Will Deacon <will@kernel.org>, Christoph Hellwig <hch@lst.de>,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 1/2] dma-mapping: support setting memory uncached in place
Date: Fri, 21 Feb 2020 15:16:56 +0100	[thread overview]
Message-ID: <20200221141656.GF6968@lst.de> (raw)
In-Reply-To: <502fa745-ddad-f91b-52bc-52edecf8fdbc@arm.com>

On Thu, Feb 20, 2020 at 05:21:35PM +0000, Robin Murphy wrote:
>> @@ -196,10 +192,15 @@ void *dma_direct_alloc_pages(struct device *dev, size_t size,
>>     	memset(ret, 0, size);
>>   -	if (IS_ENABLED(CONFIG_ARCH_HAS_UNCACHED_SEGMENT) &&
>> -	    dma_alloc_need_uncached(dev, attrs)) {
>> +	if (dma_alloc_need_uncached(dev, attrs)) {
>>   		arch_dma_prep_coherent(page, size);
>> -		ret = uncached_kernel_address(ret);
>> +
>> +		if (IS_ENABLED(CONFIG_ARCH_HAS_DMA_SET_UNCACHED)) {
>> +			if (!arch_dma_set_uncached(ret, size))
>> +				goto out_free_pages;
>> +		} else if (IS_ENABLED(CONFIG_ARCH_HAS_UNCACHED_SEGMENT)) {
>> +			ret = uncached_kernel_address(ret);
>
> Hmm, would we actually need to keep ARCH_HAS_UNCACHED_SEGMENT? If 
> arch_dma_set_uncached() returned void*/ERR_PTR instead, then it could work 
> for both cases (with arch_dma_clear_uncached() being a no-op for segments).

Yes, I think so.  I was a little worried about what to do with
cached_kernel_address() in that scheme, but it turns out with the recent
round of dma-direct cleanup that is actually entirely unused now.
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

WARNING: multiple messages have this Message-ID (diff)
From: Christoph Hellwig <hch@lst.de>
To: Robin Murphy <robin.murphy@arm.com>
Cc: Jonas Bonn <jonas@southpole.se>,
	Mark Rutland <mark.rutland@arm.com>,
	linux-kernel@vger.kernel.org,
	Stefan Kristiansson <stefan.kristiansson@saunalahti.fi>,
	iommu@lists.linux-foundation.org, openrisc@lists.librecores.org,
	linux-arch@vger.kernel.org, Stafford Horne <shorne@gmail.com>,
	Will Deacon <will@kernel.org>, Christoph Hellwig <hch@lst.de>,
	linux-arm-kernel@lists.infradead.org,
	Marek Szyprowski <m.szyprowski@samsung.com>
Subject: Re: [PATCH 1/2] dma-mapping: support setting memory uncached in place
Date: Fri, 21 Feb 2020 15:16:56 +0100	[thread overview]
Message-ID: <20200221141656.GF6968@lst.de> (raw)
In-Reply-To: <502fa745-ddad-f91b-52bc-52edecf8fdbc@arm.com>

On Thu, Feb 20, 2020 at 05:21:35PM +0000, Robin Murphy wrote:
>> @@ -196,10 +192,15 @@ void *dma_direct_alloc_pages(struct device *dev, size_t size,
>>     	memset(ret, 0, size);
>>   -	if (IS_ENABLED(CONFIG_ARCH_HAS_UNCACHED_SEGMENT) &&
>> -	    dma_alloc_need_uncached(dev, attrs)) {
>> +	if (dma_alloc_need_uncached(dev, attrs)) {
>>   		arch_dma_prep_coherent(page, size);
>> -		ret = uncached_kernel_address(ret);
>> +
>> +		if (IS_ENABLED(CONFIG_ARCH_HAS_DMA_SET_UNCACHED)) {
>> +			if (!arch_dma_set_uncached(ret, size))
>> +				goto out_free_pages;
>> +		} else if (IS_ENABLED(CONFIG_ARCH_HAS_UNCACHED_SEGMENT)) {
>> +			ret = uncached_kernel_address(ret);
>
> Hmm, would we actually need to keep ARCH_HAS_UNCACHED_SEGMENT? If 
> arch_dma_set_uncached() returned void*/ERR_PTR instead, then it could work 
> for both cases (with arch_dma_clear_uncached() being a no-op for segments).

Yes, I think so.  I was a little worried about what to do with
cached_kernel_address() in that scheme, but it turns out with the recent
round of dma-direct cleanup that is actually entirely unused now.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

WARNING: multiple messages have this Message-ID (diff)
From: Christoph Hellwig <hch@lst.de>
To: openrisc@lists.librecores.org
Subject: [OpenRISC] [PATCH 1/2] dma-mapping: support setting memory uncached in place
Date: Fri, 21 Feb 2020 15:16:56 +0100	[thread overview]
Message-ID: <20200221141656.GF6968@lst.de> (raw)
In-Reply-To: <502fa745-ddad-f91b-52bc-52edecf8fdbc@arm.com>

On Thu, Feb 20, 2020 at 05:21:35PM +0000, Robin Murphy wrote:
>> @@ -196,10 +192,15 @@ void *dma_direct_alloc_pages(struct device *dev, size_t size,
>>     	memset(ret, 0, size);
>>   -	if (IS_ENABLED(CONFIG_ARCH_HAS_UNCACHED_SEGMENT) &&
>> -	    dma_alloc_need_uncached(dev, attrs)) {
>> +	if (dma_alloc_need_uncached(dev, attrs)) {
>>   		arch_dma_prep_coherent(page, size);
>> -		ret = uncached_kernel_address(ret);
>> +
>> +		if (IS_ENABLED(CONFIG_ARCH_HAS_DMA_SET_UNCACHED)) {
>> +			if (!arch_dma_set_uncached(ret, size))
>> +				goto out_free_pages;
>> +		} else if (IS_ENABLED(CONFIG_ARCH_HAS_UNCACHED_SEGMENT)) {
>> +			ret = uncached_kernel_address(ret);
>
> Hmm, would we actually need to keep ARCH_HAS_UNCACHED_SEGMENT? If 
> arch_dma_set_uncached() returned void*/ERR_PTR instead, then it could work 
> for both cases (with arch_dma_clear_uncached() being a no-op for segments).

Yes, I think so.  I was a little worried about what to do with
cached_kernel_address() in that scheme, but it turns out with the recent
round of dma-direct cleanup that is actually entirely unused now.

  reply	other threads:[~2020-02-21 14:17 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-20 17:01 provide in-place uncached remapping for dma-direct (resend) Christoph Hellwig
2020-02-20 17:01 ` [OpenRISC] " Christoph Hellwig
2020-02-20 17:01 ` Christoph Hellwig
2020-02-20 17:01 ` Christoph Hellwig
2020-02-20 17:01 ` [PATCH 1/2] dma-mapping: support setting memory uncached in place Christoph Hellwig
2020-02-20 17:01   ` [OpenRISC] " Christoph Hellwig
2020-02-20 17:01   ` Christoph Hellwig
2020-02-20 17:01   ` Christoph Hellwig
2020-02-20 17:01   ` Christoph Hellwig
2020-02-20 17:21   ` Robin Murphy
2020-02-20 17:21     ` [OpenRISC] " Robin Murphy
2020-02-20 17:21     ` Robin Murphy
2020-02-20 17:21     ` Robin Murphy
2020-02-21 14:16     ` Christoph Hellwig [this message]
2020-02-21 14:16       ` [OpenRISC] " Christoph Hellwig
2020-02-21 14:16       ` Christoph Hellwig
2020-02-21 14:16       ` Christoph Hellwig
2020-02-20 17:01 ` [PATCH 2/2] openrisc: use the generic in-place uncached DMA allocator Christoph Hellwig
2020-02-20 17:01   ` [OpenRISC] " Christoph Hellwig
2020-02-20 17:01   ` Christoph Hellwig
2020-02-20 17:01   ` Christoph Hellwig
2020-02-20 17:01   ` Christoph Hellwig
2020-02-21 22:14   ` Stafford Horne
2020-02-21 22:14     ` [OpenRISC] " Stafford Horne
2020-02-21 22:14     ` Stafford Horne
2020-02-21 22:14     ` Stafford Horne
2020-02-24 19:45     ` Christoph Hellwig
2020-02-24 19:45       ` [OpenRISC] " Christoph Hellwig
2020-02-24 19:45       ` Christoph Hellwig
2020-02-24 19:45       ` Christoph Hellwig
2020-02-25 10:10       ` Stafford Horne
2020-02-25 10:10         ` [OpenRISC] " Stafford Horne
2020-02-25 10:10         ` Stafford Horne
2020-02-25 10:10         ` Stafford Horne
  -- strict thread matches above, loose matches on Subject: below --
2019-11-07 17:40 provide in-place uncached remapping for dma-direct Christoph Hellwig
2019-11-07 17:40 ` [PATCH 1/2] dma-mapping: support setting memory uncached in place Christoph Hellwig
2019-11-07 17:40   ` Christoph Hellwig
2019-11-07 17:40   ` Christoph Hellwig
2019-11-07 17:40   ` Christoph Hellwig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200221141656.GF6968@lst.de \
    --to=hch@lst.de \
    --cc=iommu@lists.linux-foundation.org \
    --cc=jonas@southpole.se \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=mark.rutland@arm.com \
    --cc=openrisc@lists.librecores.org \
    --cc=robin.murphy@arm.com \
    --cc=shorne@gmail.com \
    --cc=stefan.kristiansson@saunalahti.fi \
    --cc=will@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.