From: Barry Song <21cnbao@gmail.com>
To: liangwenpeng@huawei.com
Cc: jgg@nvidia.com, leon@kernel.org, linux-rdma@vger.kernel.org,
linuxarm@huawei.com
Subject: Re: [PATCH v5 for-next 1/1] RDMA/hns: Support direct wqe of userspace'
Date: Fri, 3 Dec 2021 18:18:55 +0800 [thread overview]
Message-ID: <20211203101855.12598-1-21cnbao@gmail.com> (raw)
In-Reply-To: <20211130135740.4559-2-liangwenpeng@huawei.com>
> + switch (entry->mmap_type) {
> + case HNS_ROCE_MMAP_TYPE_DB:
> + prot = pgprot_noncached(vma->vm_page_prot);
> + break;
> + case HNS_ROCE_MMAP_TYPE_TPTR:
> + prot = vma->vm_page_prot;
> + break;
> + /*
> + * The BAR region of direct WQE supports Early Write Ack,
> + * so pgprot_device is used to improve performance.
> + */
> + case HNS_ROCE_MMAP_TYPE_DWQE:
> + prot = pgprot_device(vma->vm_page_prot);
> + break;
> + default:
> + return -EINVAL;
> + }
i am still not convinced why HNS_ROCE_MMAP_TYPE_DB needs nocache and HNS_ROCE_MMAP_TYPE_DWQE needs
device. generally people use ioremap() to map pci bar spaces in pci device drivers, and ioremap()
is pretty much nGnRE:
#define ioremap(addr, size) __ioremap((addr), (size), __pgprot(PROT_DEVICE_nGnRE))
#define ioremap_np(addr, size) __ioremap((addr), (size), __pgprot(PROT_DEVICE_nGnRnE))
i am only seeing four places which are using nE in kernel:
# line filename / context / line
1 866 drivers/of/address.c <<of_iomap>>
return ioremap_np(res.start, resource_size(&res));
2 901 drivers/of/address.c <<of_io_request_and_map>>
mem = ioremap_np(res.start, resource_size(&res));
3 89 include/linux/io.h <<pci_remap_cfgspace>>
return ioremap_np(offset, size) ?: ioremap(offset, size);
4 47 lib/devres.c <<__devm_ioremap>>
addr = ioremap_np(offset, size);
so i guess nGnRE is quite safe for pci device bar spaces. for config space, it is a different story
though which is the 3rd one in the above list:
#ifdef CONFIG_PCI
/*
* The PCI specifications (Rev 3.0, 3.2.5 "Transaction Ordering and
* Posting") mandate non-posted configuration transactions. This default
* implementation attempts to use the ioremap_np() API to provide this
* on arches that support it, and falls back to ioremap() on those that
* don't. Overriding this function is deprecated; arches that properly
* support non-posted accesses should implement ioremap_np() instead, which
* this default implementation can then use to return mappings compliant with
* the PCI specification.
*/
#ifndef pci_remap_cfgspace
#define pci_remap_cfgspace pci_remap_cfgspace
static inline void __iomem *pci_remap_cfgspace(phys_addr_t offset,
size_t size)
{
return ioremap_np(offset, size) ?: ioremap(offset, size);
}
#endif
#endif
Thanks
Barry
next prev parent reply other threads:[~2021-12-03 10:19 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-30 13:57 [PATCH v5 for-next 0/1] RDMA/hns: Support direct WQE of userspace Wenpeng Liang
2021-11-30 13:57 ` [PATCH v5 for-next 1/1] RDMA/hns: Support direct wqe " Wenpeng Liang
2021-12-01 9:01 ` Leon Romanovsky
2021-12-03 10:18 ` Barry Song [this message]
2021-12-06 13:34 ` [PATCH v5 for-next 1/1] RDMA/hns: Support direct wqe of userspace' Wenpeng Liang
2021-12-06 15:30 ` Jason Gunthorpe
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=20211203101855.12598-1-21cnbao@gmail.com \
--to=21cnbao@gmail.com \
--cc=jgg@nvidia.com \
--cc=leon@kernel.org \
--cc=liangwenpeng@huawei.com \
--cc=linux-rdma@vger.kernel.org \
--cc=linuxarm@huawei.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.