MESSAGE
DATE | 2015-03-29 |
FROM | Ruben Safir
|
SUBJECT | Subject: [LIU Comp Sci] Fwd: usage of dma_common_mmap
|
From owner-learn-outgoing-at-mrbrklyn.com Sun Mar 29 01:27:18 2015 Return-Path: X-Original-To: archive-at-mrbrklyn.com Delivered-To: archive-at-mrbrklyn.com Received: by mrbrklyn.com (Postfix) id E2EB3161297; Sun, 29 Mar 2015 01:27:17 -0400 (EDT) Delivered-To: learn-outgoing-at-mrbrklyn.com Received: by mrbrklyn.com (Postfix, from userid 28) id D17711612E3; Sun, 29 Mar 2015 01:27:17 -0400 (EDT) Delivered-To: learn-at-nylxs.com Received: from mailbackend.panix.com (mailbackend.panix.com [166.84.1.89]) by mrbrklyn.com (Postfix) with ESMTP id C3C17161297 for ; Sun, 29 Mar 2015 01:26:51 -0400 (EDT) Received: from [10.0.0.19] (unknown [96.57.23.82]) by mailbackend.panix.com (Postfix) with ESMTPSA id 1C7FB12A65 for ; Sun, 29 Mar 2015 01:26:51 -0400 (EDT) Message-ID: <55178D1A.9020507-at-panix.com> Date: Sun, 29 Mar 2015 01:26:50 -0400 From: Ruben Safir User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.3.0 MIME-Version: 1.0 To: learn-at-nylxs.com Subject: [LIU Comp Sci] Fwd: usage of dma_common_mmap References: <55177F59.2080406-at-postgrad.manchester.ac.uk> In-Reply-To: <55177F59.2080406-at-postgrad.manchester.ac.uk> X-Forwarded-Message-Id: <55177F59.2080406-at-postgrad.manchester.ac.uk> Content-Type: multipart/mixed; boundary="------------070807020400070500020505" Sender: owner-learn-at-mrbrklyn.com Precedence: bulk Reply-To: learn-at-mrbrklyn.com
This is a multi-part message in MIME format. --------------070807020400070500020505 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit
-------- Forwarded Message -------- Subject: usage of dma_common_mmap Date: Sun, 29 Mar 2015 05:28:09 +0100 From: Malte Vesper To: kernelnewbies
Hello,
I am trying to use dma_mmap_attrs . However I keep getting the following error:
mmap:6420 map pfn RAM range req uncached-minus for [mem 0xfd0000000-0xfd0000fff], got write-back
Assuming that dma_common_map is used (http://lxr.free-electrons.com/source/drivers/base/dma-mapping.c#L246) I tracked the error source to be comming from: remap_pfn_range After struding the codeflow I think that this macro is the culprit:
12 #define pgprot_noncached(prot) \ 13 ((boot_cpu_data.x86 > 3) \ 14 ? (__pgprot(pgprot_val(prot) | \ 15 cachemode2protval(_PAGE_CACHE_MODE_UC_MINUS))) \ 16 : (prot))
since the "got write-back" is calculated from the memory address I assume I can not change that bit. Could anyone explain to me, why the page protection depends on boot_cpu_data?
Googling turned up further hints http://comments.gmane.org/gmane.linux.kernel.mm/125059. Is this a Bug or am I missing something? How do I correctly use dma_mmap_attrs? Currently I try:
mmap function:
return dma_mmap_attrs(&pcidev->dev, vma, buffer->memoryAddress, buffer->dmaAddress, BUF_SIZE, 0);
testfile:
char* fpath = "/proc/myDevice"; uint64_t* buffer; int filepointer = open(fpath, O_RDWR);
if(filepointer < 0) { printf("Could not open %s.\n", fpath); return -1; }
buffer = (uint64_t*) mmap(0, 4096, PROT_READ | PROT_WRITE, MAP_PRIVATE, filepointer, 0);
Thanks for any help, Malte
--------------070807020400070500020505 Content-Type: text/plain; charset=UTF-8; name="Attached Message Part" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="Attached Message Part"
_______________________________________________ Kernelnewbies mailing list Kernelnewbies-at-kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
--------------070807020400070500020505--
|
|