Deleted Added
full compact
31c31
< __FBSDID("$FreeBSD: head/sys/x86/iommu/intel_idpgtbl.c 257251 2013-10-28 13:33:29Z kib $");
---
> __FBSDID("$FreeBSD: stable/10/sys/x86/iommu/intel_idpgtbl.c 259512 2013-12-17 13:49:35Z kib $");
70,71d69
< static void ctx_flush_iotlb(struct dmar_ctx *ctx, dmar_gaddr_t base,
< dmar_gaddr_t size, int flags);
171a170,171
> leaf = 0; /* silence gcc */
>
415d414
< struct dmar_unit *unit;
485,495d483
< DMAR_CTX_PGUNLOCK(ctx);
< unit = ctx->dmar;
< if ((unit->hw_cap & DMAR_CAP_CM) != 0)
< ctx_flush_iotlb(ctx, base1, size1, flags);
< else if ((unit->hw_cap & DMAR_CAP_RWBF) != 0) {
< /* See 11.1 Write Buffer Flushing. */
< DMAR_LOCK(unit);
< dmar_flush_write_bufs(unit);
< DMAR_UNLOCK(unit);
< }
<
503a492,493
> struct dmar_unit *unit;
> int error;
504a495,496
> unit = ctx->dmar;
>
530c522
< (ctx->dmar->hw_ecap & DMAR_ECAP_SC) != 0,
---
> (unit->hw_ecap & DMAR_ECAP_SC) != 0,
534c526
< (ctx->dmar->hw_ecap & DMAR_ECAP_DI) != 0,
---
> (unit->hw_ecap & DMAR_ECAP_DI) != 0,
540c532,545
< return (ctx_map_buf_locked(ctx, base, size, ma, pflags, flags));
---
> error = ctx_map_buf_locked(ctx, base, size, ma, pflags, flags);
> DMAR_CTX_PGUNLOCK(ctx);
> if (error != 0)
> return (error);
>
> if ((unit->hw_cap & DMAR_CAP_CM) != 0)
> ctx_flush_iotlb_sync(ctx, base, size);
> else if ((unit->hw_cap & DMAR_CAP_RWBF) != 0) {
> /* See 11.1 Write Buffer Flushing. */
> DMAR_LOCK(unit);
> dmar_flush_write_bufs(unit);
> DMAR_UNLOCK(unit);
> }
> return (0);
618a624
> pg_sz = 0; /* silence gcc */
649,650d654
< DMAR_CTX_PGUNLOCK(ctx);
< ctx_flush_iotlb(ctx, base1, size1, flags);
663a668
> int error;
666c671,673
< return (ctx_unmap_buf_locked(ctx, base, size, flags));
---
> error = ctx_unmap_buf_locked(ctx, base, size, flags);
> DMAR_CTX_PGUNLOCK(ctx);
> return (error);
733,739c740,741
< /*
< * flags is only intended for PGF_WAITOK, to disallow queued
< * invalidation.
< */
< static void
< ctx_flush_iotlb(struct dmar_ctx *ctx, dmar_gaddr_t base, dmar_gaddr_t size,
< int flags)
---
> void
> ctx_flush_iotlb_sync(struct dmar_ctx *ctx, dmar_gaddr_t base, dmar_gaddr_t size)
747,760c749,750
< #if 0
< if ((unit->hw_ecap & DMAR_ECAP_QI) != 0 &&
< (flags & DMAR_PGF_WAITOK) != 0) {
< /*
< * XXXKIB: There, a queued invalidation interface
< * could be used. But since queued and registered
< * interfaces cannot be used simultaneously, and we
< * must use sleep-less (i.e. register) interface when
< * DMAR_PGF_WAITOK is not specified, only register
< * interface is suitable.
< */
< return;
< }
< #endif
---
> KASSERT(!unit->qi_enabled, ("dmar%d: sync iotlb flush call",
> unit->unit));
772,778c762
< for (am = DMAR_CAP_MAMV(unit->hw_cap);; am--) {
< isize = 1ULL << (am + DMAR_PAGE_SHIFT);
< if ((base & (isize - 1)) == 0 && size >= isize)
< break;
< if (am == 0)
< break;
< }
---
> am = calc_am(unit, base, size, &isize);