kvm/apic: use QOM style

Change apic and kvm/apic to use QOM interface.

Includes:
1. APICCommonState now use QOM realizefn
2. Remove DO_UPCAST() for APICCommonState
3. Use type constant
4. Change DeviceState pointers from 'd' to 'dev', sounds better?

this is my first qemu patch, if there is a problem, please let me konw ;-)