xen/apic: Provide an 'apic_xen' to set the override the apic->[read|write] for all cases.
When we bootup we call 'set_xen_basic_apic_ops' which
sets apic->read to xen_apic_read. The default 'apic' is set to
apic_flat, so in essence we change apic_flat->read from native_apic_read
to xen_apic_read.
During bootup, the default_acpi_madt_oem_check is run which
runs through all of the apic_probe[] array, on which the last
one is is apic_physflat. And apic_physflat->probe() returns true
on this IBM Summit box (and ES7000 boxs, and whatever has FADT
set to ACPI_FADT_APIC_PHYSICAL) so we set apic now to apic_physflat
and the apic->read ends up being native_apic_read.
2.6.38 fixes this by allowing in acpi_register_lapic_address, the
the set_fixmap_nocache(FIX_APIC_BASE, address) to be called and we
can provide it with a dummy page and native_apic_read can happily
read from that fake page.
However, the 2.6.38 is not that applicable here as it crashes
the case for non-IBM machines. The patch:
"xen/ioapic: Allow set_fixmap to set FIX_APIC_BASE to dummy mapping."
(
7cb068cf1ba90425e12f3a7b3caed9d018fa9b8c) tried this and while it
worked for IBM Summit machines it broke all other. Moving the
memset to other areas of the code did not help. The author
thinks that there must be some extra back-ports involved to use that
mechanism.
This fix adds a 'struct apic' that is Xen specific. This 'apic_xen'
is the first item on the apic_probe[i] for both 32 and 64-bit systems.
As the the first on the list, if it detects that it is running under Xen
it will short-circuit the iteration through the apic_probe[] hence not
allowing us to set it to apic_flat (or bigsmp on 32). We populate the
'apic_xen' with the default values from the 'apic' and set the members
with the Xen specific functions.
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>