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]
Date:   Fri, 17 Sep 2021 14:40:38 +0800
From:   Huacai Chen <chenhuacai@...il.com>
To:     Christoph Hellwig <hch@...radead.org>
Cc:     Huacai Chen <chenhuacai@...ngson.cn>,
        Arnd Bergmann <arnd@...db.de>,
        Andy Lutomirski <luto@...nel.org>,
        Thomas Gleixner <tglx@...utronix.de>,
        Peter Zijlstra <peterz@...radead.org>,
        Andrew Morton <akpm@...ux-foundation.org>,
        David Airlie <airlied@...ux.ie>,
        Jonathan Corbet <corbet@....net>,
        Linus Torvalds <torvalds@...ux-foundation.org>,
        linux-arch <linux-arch@...r.kernel.org>,
        linux-doc@...r.kernel.org, LKML <linux-kernel@...r.kernel.org>,
        Xuefeng Li <lixuefeng@...ngson.cn>,
        Yanteng Si <siyanteng@...ngson.cn>,
        Jiaxun Yang <jiaxun.yang@...goat.com>
Subject: Re: [PATCH V3 21/22] LoongArch: Add Non-Uniform Memory Access (NUMA) support

Hi, Christoph,

On Fri, Sep 17, 2021 at 2:17 PM Christoph Hellwig <hch@...radead.org> wrote:
>
> > +/*
> > + * We extract 4bit node id (bit 44~47) from Loongson-3's
> > + * 48bit physical address space and embed it into 40bit.
> > + */
> > +
> > +static int node_id_offset;
> > +
> > +static dma_addr_t loongson_phys_to_dma(struct device *dev, phys_addr_t paddr)
> > +{
> > +     long nid = (paddr >> 44) & 0xf;
> > +
> > +     return ((nid << 44) ^ paddr) | (nid << node_id_offset);
> > +}
> > +
> > +static phys_addr_t loongson_dma_to_phys(struct device *dev, dma_addr_t daddr)
> > +{
> > +     long nid = (daddr >> node_id_offset) & 0xf;
> > +
> > +     return ((nid << node_id_offset) ^ daddr) | (nid << 44);
> > +}
> > +
> > +static struct loongson_addr_xlate_ops {
> > +     dma_addr_t (*phys_to_dma)(struct device *dev, phys_addr_t paddr);
> > +     phys_addr_t (*dma_to_phys)(struct device *dev, dma_addr_t daddr);
> > +} xlate_ops;
> > +
> > +dma_addr_t phys_to_dma(struct device *dev, phys_addr_t paddr)
> > +{
> > +     return xlate_ops.phys_to_dma(dev, paddr);
> > +}
> > +
> > +phys_addr_t dma_to_phys(struct device *dev, dma_addr_t daddr)
> > +{
> > +     return xlate_ops.dma_to_phys(dev, daddr);
> > +}
>
> Please don't add unused indirections.  Also please just use the generic
> translations
OK, I will simplify thi by removing indirections.

Huacai
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ