perf_counter, x86: Implement generalized cache event types, add AMD support