Received: from eggs.gnu.org ([2001:4830:134:3::10]:54487) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WktlJ-0005cG-3J for qemu-devel@nongnu.org; Thu, 15 May 2014 07:23:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wktl4-0003dP-Uu for qemu-devel@nongnu.org; Thu, 15 May 2014 07:23:45 -0400 Received: from e23smtp05.au.ibm.com ([202.81.31.147]:51727) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wktl4-0003cP-5l for qemu-devel@nongnu.org; Thu, 15 May 2014 07:23:30 -0400 Received: from /spool/local by e23smtp05.au.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 15 May 2014 21:23:25 +1000 From: Alexey Kardashevskiy Date: Thu, 15 May 2014 21:23:14 +1000 Message-Id: <1400152994-20365-1-git-send-email-aik@ozlabs.ru> Subject: [Qemu-devel] [PATCH v2] spapr: Add ibm, chip-id property in device tree List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Alexey Kardashevskiy , qemu-ppc@nongnu.org, Alexander Graf This adds a "ibm,chip-id" property for CPU nodes which should be the same for all cores in the same CPU socket. The recent guest kernels use this information to associate threads with sockets. Refer to the kernel commit 256f2d4b463d3030ebc8d2b54f427543814a2bdc for more details. Signed-off-by: Alexey Kardashevskiy --- Changes: v2: * always put ibm,chip to the device tree * removed from migration as it is the user's responsibility to run QEMU on both sides with the same CPU configuration --- hw/ppc/spapr.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c index b898a39..166c1c6 100644 --- a/hw/ppc/spapr.c +++ b/hw/ppc/spapr.c @@ -313,6 +313,9 @@ static void *spapr_create_fdt_skel(hwaddr initrd_base, uint32_t interrupt_server_ranges_prop[] = {0, cpu_to_be32(smp_cpus)}; int i, smt = kvmppc_smt_threads(); unsigned char vec5[] = {0x0, 0x0, 0x0, 0x0, 0x0, 0x80}; + QemuOpts *opts = qemu_opts_find(qemu_find_opts("smp-opts"), NULL); + unsigned sockets = opts ? qemu_opt_get_number(opts, "sockets", 0) : 0; + uint32_t cpus_per_socket = sockets ? (smp_cpus / sockets) : 1; fdt = g_malloc0(FDT_MAX_SIZE); _FDT((fdt_create(fdt, FDT_MAX_SIZE))); @@ -470,6 +473,9 @@ static void *spapr_create_fdt_skel(hwaddr initrd_base, page_sizes_prop, page_sizes_prop_size))); } + _FDT((fdt_property_cell(fdt, "ibm,chip-id", + cs->cpu_index / cpus_per_socket))); + _FDT((fdt_end_node(fdt))); } -- 1.9.rc0