mirror of
https://github.com/torvalds/linux.git
synced 2026-09-13 15:40:03 +02:00
iommu/riscv: Add command queue lock
Add a raw spinlock to the RISC-V IOMMU queue state so command queue
publishing can be serialized by a later change.
Fixes: 856c0cfe5c ("iommu/riscv: Command and fault queue support")
Signed-off-by: Fangyu Yu <fangyu.yu@linux.alibaba.com>
Reviewed-by: Nutty Liu <nutty.liu@hotmail.com>
Signed-off-by: Joerg Roedel <joerg.roedel@amd.com>
This commit is contained in:
parent
df2908090c
commit
d5bcf9ccaa
|
|
@ -1560,6 +1560,7 @@ int riscv_iommu_init(struct riscv_iommu_device *iommu)
|
|||
int rc;
|
||||
|
||||
RISCV_IOMMU_QUEUE_INIT(&iommu->cmdq, CQ);
|
||||
raw_spin_lock_init(&iommu->cmdq.lock);
|
||||
RISCV_IOMMU_QUEUE_INIT(&iommu->fltq, FQ);
|
||||
|
||||
rc = riscv_iommu_init_check(iommu);
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@
|
|||
#define _RISCV_IOMMU_H_
|
||||
|
||||
#include <linux/iommu.h>
|
||||
#include <linux/spinlock.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/iopoll.h>
|
||||
|
||||
|
|
@ -23,6 +24,7 @@ struct riscv_iommu_queue {
|
|||
atomic_t prod; /* unbounded producer allocation index */
|
||||
atomic_t head; /* unbounded shadow ring buffer consumer index */
|
||||
atomic_t tail; /* unbounded shadow ring buffer producer index */
|
||||
raw_spinlock_t lock; /* serialize queue publishing */
|
||||
unsigned int mask; /* index mask, queue length - 1 */
|
||||
unsigned int irq; /* allocated interrupt number */
|
||||
struct riscv_iommu_device *iommu; /* iommu device handling the queue when active */
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user