Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp146749imm; Thu, 30 Aug 2018 10:22:23 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZIwgE1PSD8EWdUZ/+WVEG+vWEzrbvJbcJTu7YrtA1LwY4S9lP74i2T4qtVCY+Le1IzR8wB X-Received: by 2002:a17:902:6b05:: with SMTP id o5-v6mr11217572plk.338.1535649743230; Thu, 30 Aug 2018 10:22:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535649743; cv=none; d=google.com; s=arc-20160816; b=Cw4znIRhH6CaldwKLWUPgKE+Q5FubqvwwtZd7j5hsLYByqTgyrkU1TaqXg1emROeoy A86+QZdmYDHsc/pGVcYZJafnAAzFY84FnFxaR6K+2FzmdspCRC9A+RE32bKVCQQ3ZOz0 VEKZl7o/VX7r4H/XMZporhr7SS8155I6YA63+6J53H1XTkUqbAeDzRx/bqazB1dL3Uu5 eaagxLZftYa0aTgZq3++c4z3tRxRsa2lDdGES3LcVJh5ibSGJn5bIr7ZswCCWD1y7nmu dAe6vexwpmAgpLNu+LqoBCU/beoh4UezpFxTBKotaNh8Zg9iA/H4idhZBfKi6JbLUM+m 6+NQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=ZjmPZWA2tcZh7gubEUApBpckBhPqN6I1iAS9wy9JUBE=; b=dAeJwt7atwYhuUMHnsSvyQP+HrMLSdiUx8XyLCQEXpbHpCCh0ozCkPok3WbpNeVSV9 5kHlVzZARB/tamyPnyYo5xEwVMToPriogfK5ujwyAILmI+YIoJzSz2tkdDJjFTScJJ66 cr9O4xg5XhTrL7zpLmaq7V/NN14M4ooYxoCozvt2PHXvRv65nU4+1xtWc2DVU4ngbB+E 6V6GMekOXS1nCi5Nyl1CDy7yTxKB7nCZKXMHawrCVrjmHmJw9JASlAeW6qSBUT2kc/b9 7FqEFjyRxKDOvo24JcJmq6JdzEcJtg16uOHx8KESFnjZBbzFU00k6NGvFjkZGF1qcjFP UnnQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s36-v6si7262695pld.8.2018.08.30.10.22.08; Thu, 30 Aug 2018 10:22:23 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727346AbeH3VYO (ORCPT + 99 others); Thu, 30 Aug 2018 17:24:14 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:38046 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727233AbeH3VYO (ORCPT ); Thu, 30 Aug 2018 17:24:14 -0400 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: ezequiel) with ESMTPSA id BD5EB27D4B4 From: Ezequiel Garcia To: linux-media@vger.kernel.org, linux-usb@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Laurent Pinchart , Tomasz Figa , "Matwey V . Kornilov" , Alan Stern , kernel@collabora.com, Keiichi Watanabe , Ezequiel Garcia Subject: [RFC 1/3] HACK: ARM: dma-mapping: Get writeback memory for non-consistent mappings Date: Thu, 30 Aug 2018 14:20:28 -0300 Message-Id: <20180830172030.23344-2-ezequiel@collabora.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180830172030.23344-1-ezequiel@collabora.com> References: <20180830172030.23344-1-ezequiel@collabora.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This is obviously a hack. Signed-off-by: Ezequiel Garcia --- arch/arm/include/asm/pgtable.h | 3 +++ arch/arm/mm/dma-mapping.c | 9 ++++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/arch/arm/include/asm/pgtable.h b/arch/arm/include/asm/pgtable.h index a757401129f9..37ddd0d73434 100644 --- a/arch/arm/include/asm/pgtable.h +++ b/arch/arm/include/asm/pgtable.h @@ -122,6 +122,9 @@ extern pgprot_t pgprot_s2_device; #define pgprot_writecombine(prot) \ __pgprot_modify(prot, L_PTE_MT_MASK, L_PTE_MT_BUFFERABLE) +#define pgprot_writeback(prot) \ + __pgprot_modify(prot, L_PTE_MT_MASK, L_PTE_MT_WRITEBACK) + #define pgprot_stronglyordered(prot) \ __pgprot_modify(prot, L_PTE_MT_MASK, L_PTE_MT_UNCACHED) diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c index 66566472c153..11cca7bbb0a8 100644 --- a/arch/arm/mm/dma-mapping.c +++ b/arch/arm/mm/dma-mapping.c @@ -633,9 +633,12 @@ static void __free_from_contiguous(struct device *dev, struct page *page, static inline pgprot_t __get_dma_pgprot(unsigned long attrs, pgprot_t prot) { - prot = (attrs & DMA_ATTR_WRITE_COMBINE) ? - pgprot_writecombine(prot) : - pgprot_dmacoherent(prot); + if (attrs & DMA_ATTR_WRITE_COMBINE) + prot = pgprot_writecombine(prot); + else if (attrs & DMA_ATTR_NON_CONSISTENT) + prot = pgprot_writeback(prot); + else + prot = pgprot_dmacoherent(prot); return prot; } -- 2.18.0