From: Srinath Mannam <srinath.mannam@broadcom.com>
To: Alex Williamson <alex.williamson@redhat.com>
Cc: ray.jui@broadcom.com, vikram.prakash@broadcom.com,
scott.branden@broadcom.com, kvm@vger.kernel.org,
bcm-kernel-feedback-list@broadcom.com,
linux-kernel@vger.kernel.org,
Srinath Mannam <srinath.mannam@broadcom.com>
Subject: [RFC PATCH] vfio/pci: map prefetchble bars as writecombine
Date: Fri, 13 Jul 2018 10:26:17 +0530 [thread overview]
Message-ID: <1531457777-11825-1-git-send-email-srinath.mannam@broadcom.com> (raw)
By default all BARs map with VMA access permissions
as pgprot_noncached.
In ARM64 pgprot_noncached is MT_DEVICE_nGnRnE which
is strongly ordered and allows aligned access.
This type of mapping works for NON-PREFETCHABLE bars
containing EP controller registers.
But it restricts PREFETCHABLE bars from doing
unaligned access.
In CMB NVMe drives PREFETCHABLE bars are required to
map as MT_NORMAL_NC to do unaligned access.
Signed-off-by: Srinath Mannam <srinath.mannam@broadcom.com>
Reviewed-by: Ray Jui <ray.jui@broadcom.com>
Reviewed-by: Vikram Prakash <vikram.prakash@broadcom.com>
---
drivers/vfio/pci/vfio_pci.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/vfio/pci/vfio_pci.c b/drivers/vfio/pci/vfio_pci.c
index b423a30..eff6b65 100644
--- a/drivers/vfio/pci/vfio_pci.c
+++ b/drivers/vfio/pci/vfio_pci.c
@@ -1142,7 +1142,10 @@ static int vfio_pci_mmap(void *device_data, struct vm_area_struct *vma)
}
vma->vm_private_data = vdev;
- vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
+ if (pci_resource_flags(pdev, index) & IORESOURCE_PREFETCH)
+ vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot);
+ else
+ vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
vma->vm_pgoff = (pci_resource_start(pdev, index) >> PAGE_SHIFT) + pgoff;
return remap_pfn_range(vma, vma->vm_start, vma->vm_pgoff,
--
2.7.4
next reply other threads:[~2018-07-13 4:58 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-13 4:56 Srinath Mannam [this message]
2018-07-17 15:22 ` [RFC PATCH] vfio/pci: map prefetchble bars as writecombine Alex Williamson
2018-07-18 18:35 ` Srinath Mannam
2018-07-18 21:25 ` Alex Williamson
2018-07-19 14:47 ` Srinath Mannam
2018-07-19 15:12 ` Alex Williamson
2018-07-19 16:19 ` Srinath Mannam
2018-07-20 20:27 ` Alex Williamson
2018-07-23 8:33 ` Srinath Mannam
2018-08-01 17:58 ` Srinath Mannam
2018-08-01 19:38 ` Alex Williamson
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=1531457777-11825-1-git-send-email-srinath.mannam@broadcom.com \
--to=srinath.mannam@broadcom.com \
--cc=alex.williamson@redhat.com \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ray.jui@broadcom.com \
--cc=scott.branden@broadcom.com \
--cc=vikram.prakash@broadcom.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).