qemu-patch-raspberry4/hw/ppc
Serhii Popovych 3908a24fcb spapr: Fix ibm,max-associativity-domains property number of nodes
Laurent Vivier reported off by one with maximum number of NUMA nodes
provided by qemu-kvm being less by one than required according to
description of "ibm,max-associativity-domains" property in LoPAPR.

It appears that I incorrectly treated LoPAPR description of this
property assuming it provides last valid domain (NUMA node here)
instead of maximum number of domains.

  ### Before hot-add

  (qemu) info numa
  3 nodes
  node 0 cpus: 0
  node 0 size: 0 MB
  node 0 plugged: 0 MB
  node 1 cpus:
  node 1 size: 1024 MB
  node 1 plugged: 0 MB
  node 2 cpus:
  node 2 size: 0 MB
  node 2 plugged: 0 MB

  $ numactl -H
  available: 2 nodes (0-1)
  node 0 cpus: 0
  node 0 size: 0 MB
  node 0 free: 0 MB
  node 1 cpus:
  node 1 size: 999 MB
  node 1 free: 658 MB
  node distances:
  node   0   1
    0:  10  40
    1:  40  10

  ### Hot-add

  (qemu) object_add memory-backend-ram,id=mem0,size=1G
  (qemu) device_add pc-dimm,id=dimm1,memdev=mem0,node=2
  (qemu) [   87.704898] pseries-hotplug-mem: Attempting to hot-add 4 ...
  <there is no "Initmem setup node 2 [mem 0xHEX-0xHEX]">
  [   87.705128] lpar: Attempting to resize HPT to shift 21
  ... <HPT resize messages>

  ### After hot-add

  (qemu) info numa
  3 nodes
  node 0 cpus: 0
  node 0 size: 0 MB
  node 0 plugged: 0 MB
  node 1 cpus:
  node 1 size: 1024 MB
  node 1 plugged: 0 MB
  node 2 cpus:
  node 2 size: 1024 MB
  node 2 plugged: 1024 MB

  $ numactl -H
  available: 2 nodes (0-1)
  ^^^^^^^^^^^^^^^^^^^^^^^^
             Still only two nodes (and memory hot-added to node 0 below)
  node 0 cpus: 0
  node 0 size: 1024 MB
  node 0 free: 1021 MB
  node 1 cpus:
  node 1 size: 999 MB
  node 1 free: 658 MB
  node distances:
  node   0   1
    0:  10  40
    1:  40  10

After fix applied numactl(8) reports 3 nodes available and memory
plugged into node 2 as expected.

From David Gibson:
------------------
  Qemu makes a distinction between "non NUMA" (nb_numa_nodes == 0) and
  "NUMA with one node" (nb_numa_nodes == 1).  But from a PAPR guests's
  point of view these are equivalent.  I don't want to present two
  different cases to the guest when we don't need to, so even though the
  guest can handle it, I'd prefer we put a '1' here for both the
  nb_numa_nodes == 0 and nb_numa_nodes == 1 case.

This consolidates everything discussed previously on mailing list.

Fixes: da9f80fbad ("spapr: Add ibm,max-associativity-domains property")
Reported-by: Laurent Vivier <lvivier@redhat.com>
Signed-off-by: Serhii Popovych <spopovyc@redhat.com>

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Greg Kurz <groug@kaod.org>
Reviewed-by: Laurent Vivier <lvivier@redhat.com>
2018-12-21 09:24:23 +11:00
..
e500-ccsr.h ppc: do not use ../ in include files 2013-03-01 13:57:33 +01:00
e500.c Drop "qemu:" prefix from error_report() arguments 2018-09-24 17:13:07 +02:00
e500.h platform-bus-device: use device plug callback instead of machine_done notifier 2018-05-10 18:10:56 +01:00
e500plat.c hw/ppc: Use the IEC binary prefix definitions 2018-07-02 15:41:16 +02:00
fdt.c target/ppc: Split page size information into a separate allocation 2018-04-27 18:05:22 +10:00
mac.h macio: move MACIOIDEState type declarations to macio.h 2018-08-30 10:42:18 +10:00
mac_newworld.c hw/ppc/mac_newworld, mac_oldworld: Don't use load_image() 2018-12-14 13:30:50 +00:00
mac_oldworld.c hw/ppc/mac_newworld, mac_oldworld: Don't use load_image() 2018-12-14 13:30:50 +00:00
Makefile.objs hw/ppc/spapr_rng: Introduce CONFIG_SPAPR_RNG switch for spapr_rng.c 2018-11-08 12:04:40 +11:00
mpc8544_guts.c shutdown: Add source information to SHUTDOWN and RESET 2017-05-23 13:28:17 +02:00
mpc8544ds.c ppc: e500: switch E500 based machines to full machine definition 2018-04-27 18:05:23 +10:00
pnv.c hw: Directly use "qemu/units.h" instead of "qemu/cutils.h" 2018-07-02 15:41:12 +02:00
pnv_bmc.c Include qapi/error.h exactly where needed 2018-02-09 13:50:17 +01:00
pnv_core.c error: Fix use of error_prepend() with &error_fatal, &error_abort 2018-10-19 14:51:34 +02:00
pnv_lpc.c ppc/pnv: check size before data buffer access 2018-11-08 12:04:40 +11:00
pnv_occ.c ppc/pnv: Add OCC model stub with interrupt support 2017-04-26 12:00:42 +10:00
pnv_psi.c ppc/pnv: change powernv_ prefix to pnv_ for overall naming consistency 2018-01-10 12:53:00 +11:00
pnv_xscom.c Include qapi/error.h exactly where needed 2018-02-09 13:50:17 +01:00
ppc.c Include qapi/error.h exactly where needed 2018-02-09 13:50:17 +01:00
ppc4xx_devs.c hw/ppc: Use the IEC binary prefix definitions 2018-07-02 15:41:16 +02:00
ppc4xx_pci.c ppc4xx_pci: convert SysBus init method to a realize method 2018-11-08 12:04:40 +11:00
ppc405.h ppc4xx: Export ECB and PLB emulation 2017-09-08 09:30:55 +10:00
ppc405_boards.c hw/ppc/ppc405_boards: Don't use load_image() 2018-12-14 13:30:50 +00:00
ppc405_uc.c hw/ppc/ppc405_uc: Convert away from old_mmio 2018-08-21 14:28:45 +10:00
ppc440.h ppc440_uc: Basic emulation of PPC440 DMA controller 2018-07-03 09:56:52 +10:00
ppc440_bamboo.c ppc: Remove deprecated ppcemb target 2018-08-28 11:31:23 +10:00
ppc440_pcix.c ppc440_pcix: convert SysBus init method to a realize method 2018-11-08 12:04:40 +11:00
ppc440_uc.c hw/ppc/ppc440_uc: Remove dead code in sdram_size() 2018-11-08 12:04:40 +11:00
ppc_booke.c ppc_booke: drop useless assignment 2017-05-07 09:57:51 +03:00
ppce500_spin.c hw/ppc: Use the IEC binary prefix definitions 2018-07-02 15:41:16 +02:00
prep.c 40p: add fixed IRQ routing for LSI SCSI device 2018-09-25 11:12:25 +10:00
prep_systemio.c prep: add PReP System I/O 2017-01-31 10:10:13 +11:00
rs6000_mc.c hw/ppc: Use the IEC binary prefix definitions 2018-07-02 15:41:16 +02:00
sam460ex.c Error reporting & miscellaneous patches for 2018-09-24 2018-09-25 11:37:39 +01:00
spapr.c spapr: Fix ibm,max-associativity-domains property number of nodes 2018-12-21 09:24:23 +11:00
spapr_caps.c ppc/spapr_caps: Add SPAPR_CAP_NESTED_KVM_HV 2018-11-08 13:08:35 +11:00
spapr_cpu_core.c target/ppc/kvm: set vcpu as online/offline 2018-09-05 16:06:19 +10:00
spapr_drc.c hw/ppc/spapr_drc: Replace error_setg(&error_abort) by error_report() + abort() 2018-06-12 09:33:52 +10:00
spapr_events.c spapr: introduce a fixed IRQ number space 2018-08-21 14:28:45 +10:00
spapr_hcall.c target/ppc, spapr: Move VPA information to machine_data 2018-06-16 16:32:50 +10:00
spapr_iommu.c iommu: Add IOMMU index argument to translate method 2018-06-15 15:23:34 +01:00
spapr_irq.c spapr: increase the size of the IRQ number space 2018-09-25 11:12:25 +10:00
spapr_ovec.c Purge uses of banned g_assert_FOO() 2018-06-13 13:47:35 +02:00
spapr_pci.c spapr_pci: convert g_malloc() to g_new() 2018-11-08 12:04:40 +11:00
spapr_pci_vfio.c Include qapi/error.h exactly where needed 2018-02-09 13:50:17 +01:00
spapr_rng.c hw/ppc/spapr_rng: Introduce CONFIG_SPAPR_RNG switch for spapr_rng.c 2018-11-08 12:04:40 +11:00
spapr_rtas.c target/ppc/kvm: set vcpu as online/offline 2018-09-05 16:06:19 +10:00
spapr_rtas_ddw.c machine: rename MemoryHotplugState to DeviceMemoryState 2018-05-07 10:00:02 -03:00
spapr_rtc.c qapi: Drop qapi_event_send_FOO()'s Error ** argument 2018-08-28 18:21:38 +02:00
spapr_vio.c spapr: introduce a fixed IRQ number space 2018-08-21 14:28:45 +10:00
trace-events uninorth: create new uninorth device 2018-05-04 15:00:37 +10:00
virtex_ml507.c ppc: Remove deprecated ppcemb target 2018-08-28 11:31:23 +10:00