Message ID | 1573007750-16611-6-git-send-email-yoshihiro.shimoda.uh@renesas.com (mailing list archive) |
---|---|
State | Mainlined |
Commit | 3667c9978b2911dc1ded77f5971df477885409c4 |
Delegated to: | Geert Uytterhoeven |
Headers | show |
Series | iommu/ipmmu-vmsa: minor updates | expand |
Hi Shimoda-san, Thanks for your work, On 2019-11-06 11:35:49 +0900, Yoshihiro Shimoda wrote: > Since we will have changed memory mapping of the IPMMU in the future, > This patch adds helper functions ipmmu_utlb_reg() and > ipmmu_imu{asid,ctr}_write() for "uTLB" registers. No behavior change. > > Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> > Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> > --- > drivers/iommu/ipmmu-vmsa.c | 26 +++++++++++++++++++++----- > 1 file changed, 21 insertions(+), 5 deletions(-) > > diff --git a/drivers/iommu/ipmmu-vmsa.c b/drivers/iommu/ipmmu-vmsa.c > index 8e2ca1c..82da486 100644 > --- a/drivers/iommu/ipmmu-vmsa.c > +++ b/drivers/iommu/ipmmu-vmsa.c > @@ -230,6 +230,23 @@ static void ipmmu_ctx_write_all(struct ipmmu_vmsa_domain *domain, > ipmmu_ctx_write(domain->mmu->root, domain->context_id, reg, data); > } > > +static u32 ipmmu_utlb_reg(struct ipmmu_vmsa_device *mmu, unsigned int reg) > +{ > + return reg; > +} > + > +static void ipmmu_imuasid_write(struct ipmmu_vmsa_device *mmu, > + unsigned int utlb, u32 data) > +{ > + ipmmu_write(mmu, ipmmu_utlb_reg(mmu, IMUASID(utlb)), data); > +} > + > +static void ipmmu_imuctr_write(struct ipmmu_vmsa_device *mmu, > + unsigned int utlb, u32 data) > +{ > + ipmmu_write(mmu, ipmmu_utlb_reg(mmu, IMUCTR(utlb)), data); > +} > + > /* ----------------------------------------------------------------------------- > * TLB and microTLB Management > */ > @@ -275,11 +292,10 @@ static void ipmmu_utlb_enable(struct ipmmu_vmsa_domain *domain, > */ > > /* TODO: What should we set the ASID to ? */ > - ipmmu_write(mmu, IMUASID(utlb), 0); > + ipmmu_imuasid_write(mmu, utlb, 0); > /* TODO: Do we need to flush the microTLB ? */ > - ipmmu_write(mmu, IMUCTR(utlb), > - IMUCTR_TTSEL_MMU(domain->context_id) | IMUCTR_FLUSH | > - IMUCTR_MMUEN); > + ipmmu_imuctr_write(mmu, utlb, IMUCTR_TTSEL_MMU(domain->context_id) | > + IMUCTR_FLUSH | IMUCTR_MMUEN); > mmu->utlb_ctx[utlb] = domain->context_id; > } > > @@ -291,7 +307,7 @@ static void ipmmu_utlb_disable(struct ipmmu_vmsa_domain *domain, > { > struct ipmmu_vmsa_device *mmu = domain->mmu; > > - ipmmu_write(mmu, IMUCTR(utlb), 0); > + ipmmu_imuctr_write(mmu, utlb, 0); > mmu->utlb_ctx[utlb] = IPMMU_CTX_INVALID; > } > > -- > 2.7.4 >
diff --git a/drivers/iommu/ipmmu-vmsa.c b/drivers/iommu/ipmmu-vmsa.c index 8e2ca1c..82da486 100644 --- a/drivers/iommu/ipmmu-vmsa.c +++ b/drivers/iommu/ipmmu-vmsa.c @@ -230,6 +230,23 @@ static void ipmmu_ctx_write_all(struct ipmmu_vmsa_domain *domain, ipmmu_ctx_write(domain->mmu->root, domain->context_id, reg, data); } +static u32 ipmmu_utlb_reg(struct ipmmu_vmsa_device *mmu, unsigned int reg) +{ + return reg; +} + +static void ipmmu_imuasid_write(struct ipmmu_vmsa_device *mmu, + unsigned int utlb, u32 data) +{ + ipmmu_write(mmu, ipmmu_utlb_reg(mmu, IMUASID(utlb)), data); +} + +static void ipmmu_imuctr_write(struct ipmmu_vmsa_device *mmu, + unsigned int utlb, u32 data) +{ + ipmmu_write(mmu, ipmmu_utlb_reg(mmu, IMUCTR(utlb)), data); +} + /* ----------------------------------------------------------------------------- * TLB and microTLB Management */ @@ -275,11 +292,10 @@ static void ipmmu_utlb_enable(struct ipmmu_vmsa_domain *domain, */ /* TODO: What should we set the ASID to ? */ - ipmmu_write(mmu, IMUASID(utlb), 0); + ipmmu_imuasid_write(mmu, utlb, 0); /* TODO: Do we need to flush the microTLB ? */ - ipmmu_write(mmu, IMUCTR(utlb), - IMUCTR_TTSEL_MMU(domain->context_id) | IMUCTR_FLUSH | - IMUCTR_MMUEN); + ipmmu_imuctr_write(mmu, utlb, IMUCTR_TTSEL_MMU(domain->context_id) | + IMUCTR_FLUSH | IMUCTR_MMUEN); mmu->utlb_ctx[utlb] = domain->context_id; } @@ -291,7 +307,7 @@ static void ipmmu_utlb_disable(struct ipmmu_vmsa_domain *domain, { struct ipmmu_vmsa_device *mmu = domain->mmu; - ipmmu_write(mmu, IMUCTR(utlb), 0); + ipmmu_imuctr_write(mmu, utlb, 0); mmu->utlb_ctx[utlb] = IPMMU_CTX_INVALID; }