On 12/04/19 18:05, Igor Mammedov wrote: > Document work-flows for > * finding a CPU with pending 'insert/remove' event > * enumerating present and possible CPUs > > Signed-off-by: Igor Mammedov <imamm...@redhat.com> > --- > docs/specs/acpi_cpu_hotplug.txt | 29 +++++++++++++++++++++++++++++ > 1 file changed, 29 insertions(+) > > diff --git a/docs/specs/acpi_cpu_hotplug.txt b/docs/specs/acpi_cpu_hotplug.txt > index f3c552d..58c16c6 100644 > --- a/docs/specs/acpi_cpu_hotplug.txt > +++ b/docs/specs/acpi_cpu_hotplug.txt > @@ -64,6 +64,7 @@ write access: > [0x0-0x3] CPU selector: (DWORD access) > selects active CPU device. All following accesses to other > registers will read/store data from/to selected CPU. > + Valid values: [0 .. max_cpus) > [0x4] CPU device control fields: (1 byte access) > bits: > 0: reserved, OSPM must clear it before writing to register. > @@ -96,3 +97,31 @@ write access: > ACPI_DEVICE_OST QMP event from QEMU to external applications > with current values of OST event and status registers. > other values: reserved > + > + Typical usecases: > + - Get a cpu with pending event > + 1. Store 0x0 to the 'CPU selector' register. > + 2. Store 0x0 to the 'Command field' register. > + 3. Read the 'CPU device status fields' register. > + 4. If both bit#1 and bit#2 are clear in the value read, there is > no CPU > + with a pending event and selected CPU remains unchanged. > + 5. Otherwise, read the 'Command data' register. The value read is > the > + selector of the CPU with the pending event (which is already > + selected). > + > + - Enumerate CPUs present/non present CPUs > + 01. Set the present CPU count to 0. > + 02. Set the iterator to 0. > + 03. Store 0x0 to the 'CPU selector' register, to ensure that it's > in > + a valid state and that access to other registers won't be > ignored. > + 04. Store 0x0 to the 'Command field' register to make 'Command > data' > + register return 'CPU selector' value of selected CPU > + 05. Read the 'CPU device status fields' register. > + 06. If bit#0 is set, increment the present CPU count. > + 07. Increment the iterator. > + 08. Store the iterator to the 'CPU selector' register. > + 09. Read the 'Command data' register. > + 10. If the value read is not zero, goto 05. > + 11. Otherwise store 0x0 to the 'CPU selector' register, to put it > + into a valid state and exit. > + The iterator at this point equals "max_cpus". >
Nice! I suggest unindenting the entire new text, to the leftmost column (column#0) in the text file. Otherwise "Typical usecases" falls under the scope of "write access". With that: Reviewed-by: Laszlo Ersek <ler...@redhat.com> Thanks! Laszlo