Lines Matching refs:vintf
121 * @vintf: Parent VINTF pointer
133 struct tegra241_vintf *vintf;
221 static inline int vintf_write_config(struct tegra241_vintf *vintf, u32 regval)
225 snprintf(header, 16, "VINTF%u: ", vintf->idx);
226 return tegra241_cmdqv_write_config(vintf->cmdqv,
227 REG_VINTF(vintf, CONFIG),
228 REG_VINTF(vintf, STATUS),
229 regval, header, &vintf->enabled);
236 if (WARN_ON(!vcmdq->vintf))
239 vcmdq->vintf->idx, vcmdq->idx, vcmdq->lidx);
255 static void tegra241_vintf0_handle_error(struct tegra241_vintf *vintf)
260 u64 map = readq_relaxed(REG_VINTF(vintf, LVCMDQ_ERR_MAP_64(i)));
264 struct tegra241_vcmdq *vcmdq = vintf->lvcmdqs[lidx];
267 __arm_smmu_cmdq_skip_err(&vintf->cmdqv->smmu, &vcmdq->cmdq);
323 struct tegra241_vintf *vintf = cmdqv->vintfs[0];
331 if (!READ_ONCE(vintf->enabled))
342 vcmdq = vintf->lvcmdqs[lidx];
407 static void tegra241_vintf_hw_deinit(struct tegra241_vintf *vintf)
411 for (lidx = 0; lidx < vintf->cmdqv->num_lvcmdqs_per_vintf; lidx++)
412 if (vintf->lvcmdqs && vintf->lvcmdqs[lidx])
413 tegra241_vcmdq_hw_deinit(vintf->lvcmdqs[lidx]);
414 vintf_write_config(vintf, 0);
417 static int tegra241_vintf_hw_init(struct tegra241_vintf *vintf, bool hyp_own)
424 tegra241_vintf_hw_deinit(vintf);
433 writel(regval, REG_VINTF(vintf, CONFIG));
435 ret = vintf_write_config(vintf, regval | VINTF_EN);
442 vintf->hyp_own = !!(VINTF_HYP_OWN & readl(REG_VINTF(vintf, CONFIG)));
444 for (lidx = 0; lidx < vintf->cmdqv->num_lvcmdqs_per_vintf; lidx++) {
445 if (vintf->lvcmdqs && vintf->lvcmdqs[lidx]) {
446 ret = tegra241_vcmdq_hw_init(vintf->lvcmdqs[lidx]);
448 tegra241_vintf_hw_deinit(vintf);
528 if (!vcmdq->vintf->hyp_own)
536 static void tegra241_vintf_deinit_lvcmdq(struct tegra241_vintf *vintf, u16 lidx)
538 vintf->lvcmdqs[lidx] = NULL;
541 static int tegra241_vintf_init_lvcmdq(struct tegra241_vintf *vintf, u16 lidx,
544 struct tegra241_cmdqv *cmdqv = vintf->cmdqv;
545 u16 idx = vintf->idx;
550 vcmdq->vintf = vintf;
554 vintf->lvcmdqs[lidx] = vcmdq;
558 static void tegra241_vintf_free_lvcmdq(struct tegra241_vintf *vintf, u16 lidx)
560 struct tegra241_vcmdq *vcmdq = vintf->lvcmdqs[lidx];
564 tegra241_vintf_deinit_lvcmdq(vintf, lidx);
566 dev_dbg(vintf->cmdqv->dev,
572 tegra241_vintf_alloc_lvcmdq(struct tegra241_vintf *vintf, u16 lidx)
574 struct tegra241_cmdqv *cmdqv = vintf->cmdqv;
583 ret = tegra241_vintf_init_lvcmdq(vintf, lidx, vcmdq);
597 tegra241_vintf_deinit_lvcmdq(vintf, lidx);
613 struct tegra241_vintf *vintf)
624 vintf->idx = idx;
625 vintf->cmdqv = cmdqv;
626 vintf->base = cmdqv->base + TEGRA241_VINTF(idx);
628 vintf->lvcmdqs = kcalloc(cmdqv->num_lvcmdqs_per_vintf,
629 sizeof(*vintf->lvcmdqs), GFP_KERNEL);
630 if (!vintf->lvcmdqs) {
635 cmdqv->vintfs[idx] = vintf;
641 static void tegra241_vintf_remove_lvcmdq(struct tegra241_vintf *vintf, u16 lidx)
643 tegra241_vcmdq_hw_deinit(vintf->lvcmdqs[lidx]);
644 tegra241_vintf_free_lvcmdq(vintf, lidx);
649 struct tegra241_vintf *vintf = cmdqv->vintfs[idx];
653 for (lidx = 0; lidx < vintf->cmdqv->num_lvcmdqs_per_vintf; lidx++)
654 if (vintf->lvcmdqs[lidx])
655 tegra241_vintf_remove_lvcmdq(vintf, lidx);
658 tegra241_vintf_hw_deinit(vintf);
660 dev_dbg(cmdqv->dev, "VINTF%u: deallocated\n", vintf->idx);
662 kfree(vintf);
765 struct tegra241_vintf *vintf;
769 vintf = kzalloc(sizeof(*vintf), GFP_KERNEL);
770 if (!vintf)
774 ret = tegra241_cmdqv_init_vintf(cmdqv, 0, vintf);
784 vcmdq = tegra241_vintf_alloc_lvcmdq(vintf, lidx);
795 tegra241_vintf_free_lvcmdq(vintf, lidx);
796 tegra241_cmdqv_deinit_vintf(cmdqv, vintf->idx);
798 kfree(vintf);