qemu with hax to log dma reads & writes jcs.org/2018/11/12/vfio

docs: update ACPI CPU hotplug spec with new protocol

Add description of new CPU hotplug interface.

To switch from from legacy mode into new mode use fact
that write accesses into CPU present bitmap were never
used before and were ignored by QEMU.
So use it to as a way to switch from legacy mode.
That way pc/q35 machine starts in legacy mode and
QEMU generated ACPI tables will switch to new CPU
hotplug interface during runtime.
In case QEMU is started with legacy BIOS (that doesn't
support QEMU generated ACPI tables), legacy CPU hotplug
will remain active and could be used by BIOS built in
ACPI tables for CPU hotplug.

Signed-off-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>

authored by

Igor Mammedov and committed by
Michael S. Tsirkin
abd49bc2 aa1dd39c

+82 -12
+82 -12
docs/specs/acpi_cpu_hotplug.txt
··· 4 4 QEMU supports CPU hotplug via ACPI. This document 5 5 describes the interface between QEMU and the ACPI BIOS. 6 6 7 - ACPI GPE block (IO ports 0xafe0-0xafe3, byte access): 8 - ----------------------------------------- 9 - 10 - Generic ACPI GPE block. Bit 2 (GPE.2) used to notify CPU 11 - hot-add/remove event to ACPI BIOS, via SCI interrupt. 7 + ACPI BIOS GPE.2 handler is dedicated for notifying OS about CPU hot-add 8 + and hot-remove events. 12 9 10 + ============================================ 11 + Legacy ACPI CPU hotplug interface registers: 12 + -------------------------------------------- 13 13 CPU present bitmap for: 14 14 ICH9-LPC (IO port 0x0cd8-0xcf7, 1-byte access) 15 15 PIIX-PM (IO port 0xaf00-0xaf1f, 1-byte access) 16 + One bit per CPU. Bit position reflects corresponding CPU APIC ID. Read-only. 17 + The first DWORD in bitmap is used in write mode to switch from legacy 18 + to new CPU hotplug interface, write 0 into it to do switch. 16 19 --------------------------------------------------------------- 17 - One bit per CPU. Bit position reflects corresponding CPU APIC ID. 18 - Read-only. 20 + QEMU sets corresponding CPU bit on hot-add event and issues SCI 21 + with GPE.2 event set. CPU present map is read by ACPI BIOS GPE.2 handler 22 + to notify OS about CPU hot-add events. CPU hot-remove isn't supported. 23 + 24 + ===================================== 25 + ACPI CPU hotplug interface registers: 26 + ------------------------------------- 27 + Register block base address: 28 + ICH9-LPC IO port 0x0cd8 29 + PIIX-PM IO port 0xaf00 30 + Register block size: 31 + ACPI_CPU_HOTPLUG_REG_LEN = 12 19 32 20 - CPU hot-add/remove notification: 21 - ----------------------------------------------------- 22 - QEMU sets/clears corresponding CPU bit on hot-add/remove event. 23 - CPU present map read by ACPI BIOS GPE.2 handler to notify OS of CPU 24 - hot-(un)plug events. 33 + read access: 34 + offset: 35 + [0x0-0x3] reserved 36 + [0x4] CPU device status fields: (1 byte access) 37 + bits: 38 + 0: Device is enabled and may be used by guest 39 + 1: Device insert event, used to distinguish device for which 40 + no device check event to OSPM was issued. 41 + It's valid only when bit 0 is set. 42 + 2: Device remove event, used to distinguish device for which 43 + no device eject request to OSPM was issued. 44 + 3-7: reserved and should be ignored by OSPM 45 + [0x5-0x7] reserved 46 + [0x8] Command data: (DWORD access) 47 + in case of error or unsupported command reads is 0xFFFFFFFF 48 + current 'Command field' value: 49 + 0: returns PXM value corresponding to device 50 + 51 + write access: 52 + offset: 53 + [0x0-0x3] CPU selector: (DWORD access) 54 + selects active CPU device. All following accesses to other 55 + registers will read/store data from/to selected CPU. 56 + [0x4] CPU device control fields: (1 byte access) 57 + bits: 58 + 0: reserved, OSPM must clear it before writing to register. 59 + 1: if set to 1 clears device insert event, set by OSPM 60 + after it has emitted device check event for the 61 + selected CPU device 62 + 2: if set to 1 clears device remove event, set by OSPM 63 + after it has emitted device eject request for the 64 + selected CPU device 65 + 3: if set to 1 initiates device eject, set by OSPM when it 66 + triggers CPU device removal and calls _EJ0 method 67 + 4-7: reserved, OSPM must clear them before writing to register 68 + [0x5] Command field: (1 byte access) 69 + value: 70 + 0: selects a CPU device with inserting/removing events and 71 + following reads from 'Command data' register return 72 + selected CPU (CPU selector value). If no CPU with events 73 + found, the current CPU selector doesn't change and 74 + corresponding insert/remove event flags are not set. 75 + 1: following writes to 'Command data' register set OST event 76 + register in QEMU 77 + 2: following writes to 'Command data' register set OST status 78 + register in QEMU 79 + other values: reserved 80 + [0x6-0x7] reserved 81 + [0x8] Command data: (DWORD access) 82 + current 'Command field' value: 83 + 0: OSPM reads value of CPU selector 84 + 1: stores value into OST event register 85 + 2: stores value into OST status register, triggers 86 + ACPI_DEVICE_OST QMP event from QEMU to external applications 87 + with current values of OST event and status registers. 88 + other values: reserved 89 + 90 + Selecting CPU device beyond possible range has no effect on platform: 91 + - write accesses to CPU hot-plug registers not documented above are 92 + ignored 93 + - read accesses to CPU hot-plug registers not documented above return 94 + all bits set to 0.