| 329 | } |
| 330 | |
| 331 | void |
| 332 | pmap_force_invalidate_cache_range(vm_offset_t sva, vm_offset_t eva) |
| 333 | { |
| 334 | |
| 335 | sva &= ~(vm_offset_t)(cpu_clflush_line_size - 1); |
| 336 | if (eva - sva >= PMAP_CLFLUSH_THRESHOLD) { |
| 337 | /* |
| 338 | * The supplied range is bigger than 2MB. |
| 339 | * Globally invalidate cache. |
| 340 | */ |
| 341 | pmap_invalidate_cache(); |
| 342 | return; |
| 343 | } |
| 344 | |
| 345 | #ifdef DEV_APIC |
| 346 | /* |
| 347 | * XXX: Some CPUs fault, hang, or trash the local APIC |
| 348 | * registers if we use CLFLUSH on the local APIC |
| 349 | * range. The local APIC is always uncached, so we |
| 350 | * don't need to flush for that range anyway. |
| 351 | */ |
| 352 | if (pmap_kextract(sva) == lapic_paddr) |
| 353 | return; |
| 354 | #endif |
| 355 | |
| 356 | if ((cpu_stdext_feature & CPUID_STDEXT_CLFLUSHOPT) != 0) { |
| 357 | /* |
| 358 | * Do per-cache line flush. Use the sfence |
| 359 | * instruction to insure that previous stores are |
| 360 | * included in the write-back. The processor |
| 361 | * propagates flush to other processors in the cache |
| 362 | * coherence domain. |
| 363 | */ |
| 364 | sfence(); |
| 365 | for (; sva < eva; sva += cpu_clflush_line_size) |
| 366 | clflushopt(sva); |
| 367 | sfence(); |
| 368 | } else { |
| 369 | /* |
| 370 | * Writes are ordered by CLFLUSH on Intel CPUs. |
| 371 | */ |
| 372 | if (cpu_vendor_id != CPU_VENDOR_INTEL) |
| 373 | mfence(); |
| 374 | for (; sva < eva; sva += cpu_clflush_line_size) |
| 375 | clflush(sva); |
| 376 | if (cpu_vendor_id != CPU_VENDOR_INTEL) |
| 377 | mfence(); |
| 378 | } |
| 379 | } |
| 380 | |
| 381 | static void |
| 382 | pmap_invalidate_cache_range_all(vm_offset_t sva, vm_offset_t eva) |
nothing calls this directly
no test coverage detected