linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nicolin Chen <nicoleotsuka@gmail.com>
To: hch@lst.de, m.szyprowski@samsung.com, robin.murphy@arm.com,
	tony@atomide.com
Cc: vdumpa@nvidia.com, iommu@lists.linux-foundation.org,
	linux-kernel@vger.kernel.org, tomi.valkeinen@ti.com,
	laurent.pinchart@ideasonboard.com, sre@kernel.org,
	linux-arm-kernel@lists.infradead.org, linux-omap@vger.kernel.org,
	dri-devel@lists.freedesktop.org
Subject: [PATCH] Revert "dma-contiguous: do not allocate a single page from CMA area"
Date: Tue, 26 Feb 2019 12:23:27 -0800	[thread overview]
Message-ID: <20190226202327.5349-1-nicoleotsuka@gmail.com> (raw)

This reverts commit d222e42e88168fd67e6d131984b86477af1fc256.

The original change breaks omap dss:
    omapdss_dispc 58001000.dispc:
        dispc_errata_i734_wa_init: dma_alloc_writecombine failed

Let's revert it first and then find a safer solution instead.

Reported-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
---
Tony,
	
Would you please test and verify? Thanks!

 kernel/dma/contiguous.c | 22 +++-------------------
 1 file changed, 3 insertions(+), 19 deletions(-)

diff --git a/kernel/dma/contiguous.c b/kernel/dma/contiguous.c
index 09074bd04793..b2a87905846d 100644
--- a/kernel/dma/contiguous.c
+++ b/kernel/dma/contiguous.c
@@ -186,32 +186,16 @@ int __init dma_contiguous_reserve_area(phys_addr_t size, phys_addr_t base,
  *
  * This function allocates memory buffer for specified device. It uses
  * device specific contiguous memory area if available or the default
- * global one.
- *
- * However, it skips one-page size of allocations from the global area.
- * As the addresses within one page are always contiguous, so there is
- * no need to waste CMA pages for that kind; it also helps reduce the
- * fragmentations in the CMA area. So a caller should be the rebounder
- * in such case to allocate a normal page upon NULL return value.
- *
- * Requires architecture specific dev_get_cma_area() helper function.
+ * global one. Requires architecture specific dev_get_cma_area() helper
+ * function.
  */
 struct page *dma_alloc_from_contiguous(struct device *dev, size_t count,
 				       unsigned int align, bool no_warn)
 {
-	struct cma *cma;
-
 	if (align > CONFIG_CMA_ALIGNMENT)
 		align = CONFIG_CMA_ALIGNMENT;
 
-	if (dev && dev->cma_area)
-		cma = dev->cma_area;
-	else if (count > 1)
-		cma = dma_contiguous_default_area;
-	else
-		return NULL;
-
-	return cma_alloc(cma, count, align, no_warn);
+	return cma_alloc(dev_get_cma_area(dev), count, align, no_warn);
 }
 
 /**
-- 
2.17.1


             reply	other threads:[~2019-02-26 20:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-26 20:23 Nicolin Chen [this message]
2019-02-26 23:35 ` [PATCH] Revert "dma-contiguous: do not allocate a single page from CMA area" Robin Murphy
2019-02-27  0:42   ` Tony Lindgren
2019-02-27  0:48   ` Nicolin Chen
2019-02-27  8:46 ` Krzysztof Kozlowski
2019-02-27 14:04 ` Jon Hunter

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=20190226202327.5349-1-nicoleotsuka@gmail.com \
    --to=nicoleotsuka@gmail.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=hch@lst.de \
    --cc=iommu@lists.linux-foundation.org \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=m.szyprowski@samsung.com \
    --cc=robin.murphy@arm.com \
    --cc=sre@kernel.org \
    --cc=tomi.valkeinen@ti.com \
    --cc=tony@atomide.com \
    --cc=vdumpa@nvidia.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).