> > Do users need to know how to compute the raw event value from @select > > and @umask? > > Yes, because it's also a unified calculation. AMD and Intel have > differences in bits for supported select field, but this calculation > (which follows from the KVM code) makes both compatible. > > > If yes, is C code the best way? Sorry, I missed this line. In this patch, there's macro: +#define X86_PMU_RAW_EVENT(eventsel, umask) (((eventsel & 0xf00UL) << 24) | \ + ((eventsel) & 0xff) | \ + ((umask) & 0xff) << 8) So could I said something like the following? +## +# @KVMPMUX86SelectUmaskEvent: +# +# x86 PMU event encoding with select and umask. Using the X86_PMU_RAW_EVENT +# macro, the select and umask fields will be encoded into raw foramt and +# delivered to KVM. +# +# @select: x86 PMU event select field, which is a 12-bit unsigned +# number. +# +# @umask: x86 PMU event umask field. +# +# Since 10.0 +## +{ 'struct': 'KVMPMUX86DefalutEvent', + 'data': { 'select': 'uint16', + 'umask': 'uint8' } } + Thanks very much! > > Here's another way: > > > > bits 0..7 : bits 0..7 of @select > > bits 8..15: @umask > > bits 24..27: bits 8..11 of @select > > all other bits: zero > > > > Thank you! This is what I want. > > >