* [Qemu-devel] [PATCH] spapr: add ibm, chip-id property in device tree
@ 2014-03-13 6:29 Alexey Kardashevskiy
2014-04-11 16:29 ` Alexander Graf
0 siblings, 1 reply; 3+ messages in thread
From: Alexey Kardashevskiy @ 2014-03-13 6:29 UTC (permalink / raw)
To: qemu-devel
Cc: Alexey Kardashevskiy, qemu-ppc, Alexander Graf,
Andreas Färber
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 <aik@ozlabs.ru>
---
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)));
+ }
+
_FDT((fdt_end_node(fdt)));
}
--
1.8.4.rc4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] spapr: add ibm, chip-id property in device tree
2014-03-13 6:29 [Qemu-devel] [PATCH] spapr: add ibm, chip-id property in device tree Alexey Kardashevskiy
@ 2014-04-11 16:29 ` Alexander Graf
2014-04-11 16:41 ` Alexey Kardashevskiy
0 siblings, 1 reply; 3+ messages in thread
From: Alexander Graf @ 2014-04-11 16:29 UTC (permalink / raw)
To: Alexey Kardashevskiy, qemu-devel; +Cc: qemu-ppc, Andreas Färber
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 <aik@ozlabs.ru>
> ---
> 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? Also, I don't see
why we should omit the chip-id when we don't define sockets.
Alex
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PATCH] spapr: add ibm, chip-id property in device tree
2014-04-11 16:29 ` Alexander Graf
@ 2014-04-11 16:41 ` Alexey Kardashevskiy
0 siblings, 0 replies; 3+ messages in thread
From: Alexey Kardashevskiy @ 2014-04-11 16:41 UTC (permalink / raw)
To: Alexander Graf, qemu-devel; +Cc: qemu-ppc, Andreas Färber
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 <aik@ozlabs.ru>
>> ---
>> 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
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-04-11 16:42 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-13 6:29 [Qemu-devel] [PATCH] spapr: add ibm, chip-id property in device tree Alexey Kardashevskiy
2014-04-11 16:29 ` Alexander Graf
2014-04-11 16:41 ` Alexey Kardashevskiy
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).