From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58555) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WYeWu-0002gG-GL for qemu-devel@nongnu.org; Fri, 11 Apr 2014 12:42:22 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WYeWo-0007dM-9L for qemu-devel@nongnu.org; Fri, 11 Apr 2014 12:42:16 -0400 Received: from mail-pa0-f42.google.com ([209.85.220.42]:38654) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WYeWo-0007dB-3f for qemu-devel@nongnu.org; Fri, 11 Apr 2014 12:42:10 -0400 Received: by mail-pa0-f42.google.com with SMTP id fb1so5671451pad.1 for ; Fri, 11 Apr 2014 09:42:09 -0700 (PDT) Message-ID: <53481B4B.6010805@ozlabs.ru> Date: Sat, 12 Apr 2014 02:41:47 +1000 From: Alexey Kardashevskiy MIME-Version: 1.0 References: <1394692166-19408-1-git-send-email-aik@ozlabs.ru> <53481879.5090007@suse.de> In-Reply-To: <53481879.5090007@suse.de> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] spapr: add ibm, chip-id property in device tree List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexander Graf , qemu-devel@nongnu.org Cc: qemu-ppc@nongnu.org, =?UTF-8?B?QW5kcmVhcyBGw6RyYmVy?= On 04/12/2014 02:29 AM, Alexander Graf wrote: > > On 13.03.14 07:29, Alexey Kardashevskiy wrote: >> 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 >> --- >> hw/ppc/spapr.c | 9 +++++++++ >> 1 file changed, 9 insertions(+) >> >> diff --git a/hw/ppc/spapr.c b/hw/ppc/spapr.c >> index bf46c38..6366230 100644 >> --- a/hw/ppc/spapr.c >> +++ b/hw/ppc/spapr.c >> @@ -308,6 +308,8 @@ 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; >> fdt = g_malloc0(FDT_MAX_SIZE); >> _FDT((fdt_create(fdt, FDT_MAX_SIZE))); >> @@ -465,6 +467,13 @@ static void *spapr_create_fdt_skel(hwaddr initrd_base, >> page_sizes_prop, page_sizes_prop_size))); >> } >> + if (sockets) { >> + int cpus_per_socket = smp_cpus / sockets; >> + uint32_t chip_id = cs->cpu_index / cpus_per_socket; >> + >> + _FDT((fdt_property_cell(fdt, "ibm,chip-id", chip_id))); >> + } > > Have you verified this works correctly with threads? Sorry, do not follow you. -smp X,sockets=Y,threads=Z - what combination of XYZ is suspicious? > Also, I don't see why > we should omit the chip-id when we don't define sockets. Why should we pollute device tree... -- Alexey