lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJhJPsU1eFJ_R1-emENs8T5rrKXUKjvk-cQx9RT2ztTvmOTZug@mail.gmail.com>
Date: Mon, 20 Jan 2025 19:08:55 +0800
From: Keguang Zhang <keguang.zhang@...il.com>
To: Miquel Raynal <miquel.raynal@...tlin.com>
Cc: Keguang Zhang via B4 Relay <devnull+keguang.zhang.gmail.com@...nel.org>, 
	Richard Weinberger <richard@....at>, Vignesh Raghavendra <vigneshr@...com>, Rob Herring <robh@...nel.org>, 
	Krzysztof Kozlowski <krzk+dt@...nel.org>, Conor Dooley <conor+dt@...nel.org>, linux-mtd@...ts.infradead.org, 
	linux-kernel@...r.kernel.org, devicetree@...r.kernel.org, 
	linux-media@...r.kernel.org
Subject: Re: [PATCH v11 2/2] mtd: rawnand: Add Loongson-1 NAND Controller Driver

On Mon, Jan 20, 2025 at 4:10 PM Miquel Raynal <miquel.raynal@...tlin.com> wrote:
>
>
> >> >> Don't you need a dma_addr_t here instead? You shall remap the resource.
> >> >>
> >> > Sorry, I don't quite understand.
> >> > 'dma_base' is already of type dma_addr_t.
> >>
> >> I didn't identify where the dma_base was remapped, but if that's already
> >> done then we're good.
> >
> > Perhaps I misunderstand the usage of dma_map_resource(). dma_base is
> > the physical address and will be written to the DMA controller
> > register at last.
>
> IIUC, yes and no. It is the remapped address of the physical address you
> want to reach, not the physical address itself. The type is dma_addr_t
> and not phys_addr_t and you can get a dma address out of a physical
> address with a call to dma_map_resource(). The numerical value might be
> the same if there is no IO-MMU involved, but the good practice is to
> remap anyway.

Got it. I will keep dma_map_resource() as it is, which is called in
ls1x_nand_probe().

+       res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "nand-dma");
+       host->dma_base = dma_map_resource(dev, res->start, resource_size(res),
+                                         DMA_BIDIRECTIONAL, 0);
+       if (dma_mapping_error(dev, host->dma_base))
+               return -ENXIO;

>
> Thanks,
> Miquèl
>


-- 
Best regards,

Keguang Zhang

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ