[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <162164277035.261970.14322823489384216890.stgit@djiang5-desk3.ch.intel.com>
Date: Fri, 21 May 2021 17:19:30 -0700
From: Dave Jiang <dave.jiang@...el.com>
To: alex.williamson@...hat.com, kwankhede@...dia.com,
tglx@...utronix.de, vkoul@...nel.org, jgg@...lanox.com
Cc: megha.dey@...el.com, jacob.jun.pan@...el.com, ashok.raj@...el.com,
yi.l.liu@...el.com, baolu.lu@...el.com, kevin.tian@...el.com,
sanjay.k.kumar@...el.com, tony.luck@...el.com,
dan.j.williams@...el.com, eric.auger@...hat.com,
pbonzini@...hat.com, dmaengine@...r.kernel.org,
linux-kernel@...r.kernel.org, kvm@...r.kernel.org
Subject: [PATCH v6 04/20] dmaengine: idxd: add portal offset for IMS portals
Device portal offsets are 4k apart laid out in the order of unlimited
MSIX portal, limited MSIX portal, unlimited IMS portal, limited IMS
portal. Add an additional parameter to calculate the IMS portal
offsets.
Signed-off-by: Dave Jiang <dave.jiang@...el.com>
---
drivers/dma/idxd/cdev.c | 4 ++--
drivers/dma/idxd/device.c | 2 +-
drivers/dma/idxd/idxd.h | 11 +++--------
3 files changed, 6 insertions(+), 11 deletions(-)
diff --git a/drivers/dma/idxd/cdev.c b/drivers/dma/idxd/cdev.c
index e3d29244f752..62a53123fd58 100644
--- a/drivers/dma/idxd/cdev.c
+++ b/drivers/dma/idxd/cdev.c
@@ -202,8 +202,8 @@ static int idxd_cdev_mmap(struct file *filp, struct vm_area_struct *vma)
return rc;
vma->vm_flags |= VM_DONTCOPY;
- pfn = (base + idxd_get_wq_portal_full_offset(wq->id,
- IDXD_PORTAL_LIMITED)) >> PAGE_SHIFT;
+ pfn = (base + idxd_get_wq_portal_offset(wq->id, IDXD_PORTAL_LIMITED,
+ IDXD_IRQ_MSIX)) >> PAGE_SHIFT;
vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
vma->vm_private_data = ctx;
diff --git a/drivers/dma/idxd/device.c b/drivers/dma/idxd/device.c
index 3549a73fc7db..02e9a050b5bb 100644
--- a/drivers/dma/idxd/device.c
+++ b/drivers/dma/idxd/device.c
@@ -300,7 +300,7 @@ int idxd_wq_map_portal(struct idxd_wq *wq)
resource_size_t start;
start = pci_resource_start(pdev, IDXD_WQ_BAR);
- start += idxd_get_wq_portal_full_offset(wq->id, IDXD_PORTAL_LIMITED);
+ start += idxd_get_wq_portal_offset(wq->id, IDXD_PORTAL_LIMITED, IDXD_IRQ_MSIX);
wq->portal = devm_ioremap(dev, start, IDXD_PORTAL_SIZE);
if (!wq->portal)
diff --git a/drivers/dma/idxd/idxd.h b/drivers/dma/idxd/idxd.h
index 288e3fe15b3e..e5b90e6970aa 100644
--- a/drivers/dma/idxd/idxd.h
+++ b/drivers/dma/idxd/idxd.h
@@ -459,15 +459,10 @@ enum idxd_interrupt_type {
IDXD_IRQ_IMS,
};
-static inline int idxd_get_wq_portal_offset(enum idxd_portal_prot prot)
+static inline int idxd_get_wq_portal_offset(int wq_id, enum idxd_portal_prot prot,
+ enum idxd_interrupt_type irq_type)
{
- return prot * 0x1000;
-}
-
-static inline int idxd_get_wq_portal_full_offset(int wq_id,
- enum idxd_portal_prot prot)
-{
- return ((wq_id * 4) << PAGE_SHIFT) + idxd_get_wq_portal_offset(prot);
+ return ((wq_id * 4) << PAGE_SHIFT) + prot * 0x1000 + irq_type * 0x2000;
}
static inline void idxd_wq_get(struct idxd_wq *wq)
Powered by blists - more mailing lists