From: "Andreas Färber" <afaerber@suse.de>
To: "Jason J. Herne" <jjherne@us.ibm.com>
Cc: ehabkost@redhat.com, qemu-devel@nongnu.org, agraf@suse.de,
borntraeger@de.ibm.com, jfrei@linux.vnet.ibm.com,
imammedo@redhat.com
Subject: Re: [Qemu-devel] [PATCH 2/8] [PATCH RFC v3] s390-qemu: cpu hotplug - SCLP CPU Info
Date: Thu, 05 Sep 2013 13:33:31 +0200 [thread overview]
Message-ID: <52286C0B.7080602@suse.de> (raw)
In-Reply-To: <1375366359-11553-3-git-send-email-jjherne@us.ibm.com>
Am 01.08.2013 16:12, schrieb Jason J. Herne:
> From: "Jason J. Herne" <jjherne@us.ibm.com>
>
> Implement the CPU data in SCLP "Read SCP Info". And implement "Read CPU Info"
> SCLP command. This data will be used by the guest to get information about hot
> plugged cpus.
>
> Signed-off-by: Jason J. Herne <jjherne@us.ibm.com>
> ---
> hw/s390x/sclp.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++
> include/hw/s390x/sclp.h | 32 +++++++++++++++++++++++++++++
> 2 files changed, 83 insertions(+)
>
> diff --git a/hw/s390x/sclp.c b/hw/s390x/sclp.c
> index cb53d7e..da8cf7a 100644
> --- a/hw/s390x/sclp.c
> +++ b/hw/s390x/sclp.c
> @@ -15,6 +15,7 @@
> #include "cpu.h"
> #include "sysemu/kvm.h"
> #include "exec/memory.h"
> +#include "sysemu/sysemu.h"
>
> #include "hw/s390x/sclp.h"
>
> @@ -31,7 +32,26 @@ static inline S390SCLPDevice *get_event_facility(void)
> static void read_SCP_info(SCCB *sccb)
> {
> ReadInfo *read_info = (ReadInfo *) sccb;
> + CPUState *cpu;
> int shift = 0;
> + int cpu_count = 0;
> + int i = 0;
> +
> + for (cpu = first_cpu; cpu != NULL; cpu = cpu->next_cpu) {
> + cpu_count++;
> + }
> +
> + /* CPU information */
> + read_info->entries_cpu = cpu_to_be16(cpu_count);
> + read_info->offset_cpu = cpu_to_be16(offsetof(ReadInfo, entries));
> + read_info->highest_cpu = cpu_to_be16(max_cpus);
> +
> + for (i = 0; i < cpu_count; i++) {
> + read_info->entries[i].address = i;
> + read_info->entries[i].type = 0;
> + }
> +
> + read_info->facilities = cpu_to_be64(SCLP_HAS_CPU_INFO);
>
> while ((ram_size >> (20 + shift)) > 65535) {
> shift++;
> @@ -41,6 +61,34 @@ static void read_SCP_info(SCCB *sccb)
> sccb->h.response_code = cpu_to_be16(SCLP_RC_NORMAL_READ_COMPLETION);
> }
>
> +/* Provide information about the CPU */
> +static void sclp_read_cpu_info(SCCB *sccb)
> +{
> + ReadCpuInfo *cpu_info = (ReadCpuInfo *) sccb;
> + CPUState *cpu;
> + int cpu_count = 0;
> + int i = 0;
> +
> + for (cpu = first_cpu; cpu != NULL; cpu = cpu->next_cpu) {
This becomes CPU_FOREACH(cpu) { now.
> + cpu_count++;
> + }
> +
> + cpu_info->nr_configured = cpu_to_be16(cpu_count);
> + cpu_info->offset_configured = cpu_to_be16(offsetof(ReadCpuInfo, entries));
> + cpu_info->nr_standby = cpu_to_be16(0);
> +
> + /* The standby offset is 16-byte for each CPU */
> + cpu_info->offset_standby = cpu_to_be16(cpu_info->offset_configured
> + + cpu_info->nr_configured*sizeof(CpuEntry));
> +
> + for (i = 0; i < cpu_count; i++) {
> + cpu_info->entries[i].address = i;
> + cpu_info->entries[i].type = 0;
> + }
> +
> + sccb->h.response_code = cpu_to_be16(SCLP_RC_NORMAL_READ_COMPLETION);
> +}
> +
> static void sclp_execute(SCCB *sccb, uint64_t code)
> {
> S390SCLPDevice *sdev = get_event_facility();
> @@ -50,6 +98,9 @@ static void sclp_execute(SCCB *sccb, uint64_t code)
> case SCLP_CMDW_READ_SCP_INFO_FORCED:
> read_SCP_info(sccb);
> break;
> + case SCLP_CMDW_READ_CPU_INFO:
> + sclp_read_cpu_info(sccb);
> + break;
> default:
> sdev->sclp_command_handler(sdev->ef, sccb, code);
> break;
> diff --git a/include/hw/s390x/sclp.h b/include/hw/s390x/sclp.h
> index 174097d..89ae7d1 100644
> --- a/include/hw/s390x/sclp.h
> +++ b/include/hw/s390x/sclp.h
> @@ -79,12 +79,44 @@ typedef struct SCCBHeader {
>
> #define SCCB_DATA_LEN (SCCB_SIZE - sizeof(SCCBHeader))
>
> +/* CPU information */
> +typedef struct CpuEntry {
> + uint8_t address;
> + uint8_t reserved0[13];
> + uint8_t type;
> + uint8_t reserved1;
> +} QEMU_PACKED CpuEntry;
Feel free to use CPUEntry capitalization if this is not copied from a
Linux struct of that name - your choice.
Andreas
> +
> typedef struct ReadInfo {
> SCCBHeader h;
> uint16_t rnmax;
> uint8_t rnsize;
> + uint8_t _reserved1[16 - 11]; /* 11-15 */
> + uint16_t entries_cpu; /* 16-17 */
> + uint16_t offset_cpu; /* 18-19 */
> + uint8_t _reserved2[24 - 20]; /* 20-23 */
> + uint8_t loadparm[8]; /* 24-31 */
> + uint8_t _reserved3[48 - 32]; /* 32-47 */
> + uint64_t facilities; /* 48-55 */
> + uint8_t _reserved0[100 - 56];
> + uint32_t rnsize2;
> + uint64_t rnmax2;
> + uint8_t _reserved4[120-112]; /* 112-119 */
> + uint16_t highest_cpu;
> + uint8_t _reserved5[128 - 122]; /* 122-127 */
> + struct CpuEntry entries[0];
> } QEMU_PACKED ReadInfo;
>
> +typedef struct ReadCpuInfo {
> + SCCBHeader h;
> + uint16_t nr_configured; /* 8-9 */
> + uint16_t offset_configured; /* 10-11 */
> + uint16_t nr_standby; /* 12-13 */
> + uint16_t offset_standby; /* 14-15 */
> + uint8_t reserved0[24-16]; /* 16-23 */
> + struct CpuEntry entries[0];
> +} QEMU_PACKED ReadCpuInfo;
> +
> typedef struct SCCB {
> SCCBHeader h;
> char data[SCCB_DATA_LEN];
>
--
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
next prev parent reply other threads:[~2013-09-05 11:33 UTC|newest]
Thread overview: 49+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-08-01 14:12 [Qemu-devel] [PATCH 0/8] [PATCH RFC v3] s390 cpu hotplug Jason J. Herne
2013-08-01 14:12 ` [Qemu-devel] [PATCH 1/8] [PATCH RFC v3] s390-qemu: cpu hotplug - Define New SCLP Codes Jason J. Herne
2013-09-05 11:25 ` Alexander Graf
2013-09-16 13:53 ` Christian Borntraeger
2013-09-16 14:29 ` Jason J. Herne
2013-09-16 14:43 ` Alexander Graf
2013-09-16 14:59 ` Jason J. Herne
2013-09-05 11:29 ` Andreas Färber
2013-08-01 14:12 ` [Qemu-devel] [PATCH 2/8] [PATCH RFC v3] s390-qemu: cpu hotplug - SCLP CPU Info Jason J. Herne
2013-09-05 11:33 ` Andreas Färber [this message]
2013-08-01 14:12 ` [Qemu-devel] [PATCH 3/8] [PATCH RFC v3] s390-qemu: cpu hotplug - SCLP Event integration Jason J. Herne
2013-09-05 11:43 ` Andreas Färber
2013-08-01 14:12 ` [Qemu-devel] [PATCH 4/8] [PATCH RFC v3] s390-qemu: cpu hotplug - Storage key global access Jason J. Herne
2013-09-05 11:46 ` Andreas Färber
2013-09-13 15:11 ` Jason J. Herne
2013-09-05 12:45 ` Alexander Graf
2013-08-01 14:12 ` [Qemu-devel] [PATCH 5/8] [PATCH RFC v3] s390-qemu: cpu hotplug - ipi_states enhancements Jason J. Herne
2013-09-05 12:01 ` Andreas Färber
2013-09-13 15:17 ` Jason J. Herne
2013-09-19 20:19 ` Jason J. Herne
2013-09-20 16:35 ` Michael Mueller
2013-10-02 21:21 ` Jason J. Herne
2013-09-05 12:46 ` Alexander Graf
2013-08-01 14:12 ` [Qemu-devel] [PATCH 6/8] [PATCH RFC v3] s390-qemu: cpu hotplug - s390 cpu init improvements for hotplug Jason J. Herne
2013-09-05 12:28 ` Andreas Färber
2013-09-13 15:24 ` Jason J. Herne
2013-10-02 21:22 ` Jason J. Herne
2013-09-05 12:51 ` Alexander Graf
2013-08-01 14:12 ` [Qemu-devel] [PATCH 7/8] [PATCH RFC v3] s390-qemu: cpu hotplug - Implement hot_add_cpu hook Jason J. Herne
2013-09-05 12:38 ` Andreas Färber
2013-09-13 15:29 ` Jason J. Herne
2013-09-16 16:57 ` Andreas Färber
2013-08-01 14:12 ` [Qemu-devel] [PATCH 8/8] [PATCH RFC v3] qemu-monitor: HMP cpu-add wrapper Jason J. Herne
2013-08-01 16:02 ` Andreas Färber
2013-08-01 17:23 ` Luiz Capitulino
2013-09-04 12:45 ` [Qemu-devel] [PATCH 0/8] [PATCH RFC v3] s390 cpu hotplug Andreas Färber
2013-09-04 12:56 ` Luiz Capitulino
2013-09-04 13:04 ` Andreas Färber
2013-09-04 13:12 ` Luiz Capitulino
2013-09-05 10:40 ` Christian Borntraeger
2013-09-05 11:25 ` Andreas Färber
2013-09-19 20:13 ` Jason J. Herne
2013-09-05 12:54 ` Alexander Graf
2013-09-05 13:05 ` Andreas Färber
2013-09-05 13:10 ` Alexander Graf
2013-09-05 14:06 ` Andreas Färber
2013-09-13 15:01 ` Jason J. Herne
2013-09-13 15:23 ` Andreas Färber
2013-09-16 10:43 ` Michael Mueller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=52286C0B.7080602@suse.de \
--to=afaerber@suse.de \
--cc=agraf@suse.de \
--cc=borntraeger@de.ibm.com \
--cc=ehabkost@redhat.com \
--cc=imammedo@redhat.com \
--cc=jfrei@linux.vnet.ibm.com \
--cc=jjherne@us.ibm.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.