From: Alexander Graf <agraf@suse.de>
To: Cornelia Huck <cornelia.huck@de.ibm.com>, qemu-devel@nongnu.org
Cc: mdroth@linux.vnet.ibm.com, armbru@redhat.com,
borntraeger@de.ibm.com, jfrei@linux.vnet.ibm.com,
Xu Wang <gesaint@linux.vnet.ibm.com>,
lcapitulino@redhat.com
Subject: Re: [Qemu-devel] [PATCH 3/6] s390/kvm: diag288 instruction interception and handling
Date: Tue, 21 Apr 2015 21:09:05 +0200 [thread overview]
Message-ID: <5536A051.9000901@suse.de> (raw)
In-Reply-To: <1429257161-29597-4-git-send-email-cornelia.huck@de.ibm.com>
On 04/17/2015 09:52 AM, Cornelia Huck wrote:
> From: Xu Wang <gesaint@linux.vnet.ibm.com>
>
> Intercept the diag288 requests from kvm guests, and hand the
> requested command to the diag288 watchdog device for further
> handling.
>
> Signed-off-by: Xu Wang <gesaint@linux.vnet.ibm.com>
> Reviewed-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
> Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
We're getting a lot of random devices allocating diag intercepts. Can't
we make this an actual interface, similar to the hypercall registration
on sPAPR?
Alex
> ---
> target-s390x/cpu.h | 1 +
> target-s390x/kvm.c | 18 ++++++++++++++++++
> target-s390x/misc_helper.c | 33 +++++++++++++++++++++++++++++++++
> 3 files changed, 52 insertions(+)
>
> diff --git a/target-s390x/cpu.h b/target-s390x/cpu.h
> index ba7d250..f5cafc3 100644
> --- a/target-s390x/cpu.h
> +++ b/target-s390x/cpu.h
> @@ -1059,6 +1059,7 @@ uint32_t set_cc_nz_f128(float128 v);
>
> /* misc_helper.c */
> #ifndef CONFIG_USER_ONLY
> +int handle_diag_288(CPUS390XState *env, uint64_t r1, uint64_t r3);
> void handle_diag_308(CPUS390XState *env, uint64_t r1, uint64_t r3);
> #endif
> void program_interrupt(CPUS390XState *env, uint32_t code, int ilen);
> diff --git a/target-s390x/kvm.c b/target-s390x/kvm.c
> index b8703b8..32ed4ab 100644
> --- a/target-s390x/kvm.c
> +++ b/target-s390x/kvm.c
> @@ -97,6 +97,7 @@
> #define PRIV_E3_MPCIFC 0xd0
> #define PRIV_E3_STPCIFC 0xd4
>
> +#define DIAG_TIMEREVENT 0x288
> #define DIAG_IPL 0x308
> #define DIAG_KVM_HYPERCALL 0x500
> #define DIAG_KVM_BREAKPOINT 0x501
> @@ -1215,6 +1216,20 @@ static int handle_hypercall(S390CPU *cpu, struct kvm_run *run)
> return ret;
> }
>
> +static void kvm_handle_diag_288(S390CPU *cpu, struct kvm_run *run)
> +{
> + uint64_t r1, r3;
> + int rc;
> +
> + cpu_synchronize_state(CPU(cpu));
> + r1 = (run->s390_sieic.ipa & 0x00f0) >> 4;
> + r3 = run->s390_sieic.ipa & 0x000f;
> + rc = handle_diag_288(&cpu->env, r1, r3);
> + if (rc == -1) {
> + enter_pgmcheck(cpu, PGM_SPECIFICATION);
> + }
> +}
> +
> static void kvm_handle_diag_308(S390CPU *cpu, struct kvm_run *run)
> {
> uint64_t r1, r3;
> @@ -1254,6 +1269,9 @@ static int handle_diag(S390CPU *cpu, struct kvm_run *run, uint32_t ipb)
> */
> func_code = decode_basedisp_rs(&cpu->env, ipb, NULL) & DIAG_KVM_CODE_MASK;
> switch (func_code) {
> + case DIAG_TIMEREVENT:
> + kvm_handle_diag_288(cpu, run);
> + break;
> case DIAG_IPL:
> kvm_handle_diag_308(cpu, run);
> break;
> diff --git a/target-s390x/misc_helper.c b/target-s390x/misc_helper.c
> index e1007fa..88d96bf 100644
> --- a/target-s390x/misc_helper.c
> +++ b/target-s390x/misc_helper.c
> @@ -30,6 +30,7 @@
> #include <linux/kvm.h>
> #endif
> #include "exec/cpu_ldst.h"
> +#include "hw/watchdog/wdt_diag288.h"
>
> #if !defined(CONFIG_USER_ONLY)
> #include "sysemu/cpus.h"
> @@ -153,6 +154,38 @@ static int load_normal_reset(S390CPU *cpu)
> return 0;
> }
>
> +int handle_diag_288(CPUS390XState *env, uint64_t r1, uint64_t r3)
> +{
> + uint64_t func = env->regs[r1];
> + uint64_t timeout = env->regs[r1 + 1];
> + uint64_t action = env->regs[r3];
> + Object *obj;
> + DIAG288State *diag288;
> + DIAG288Class *diag288_class;
> +
> + if (r1 % 2) {
> + return -1;
> + }
> +
> + if (action != 0) {
> + return -1;
> + }
> +
> + /* Timeout must be more than 15 seconds except for timer deletion */
> + if (func != WDT_DIAG288_CANCEL && timeout < 15) {
> + return -1;
> + }
> +
> + obj = object_resolve_path_type("", TYPE_WDT_DIAG288, NULL);
> + if (!obj) {
> + return -1;
> + }
> +
> + diag288 = DIAG288(obj);
> + diag288_class = DIAG288_GET_CLASS(diag288);
> + return diag288_class->handle_timer(diag288, func, timeout);
> +}
> +
> #define DIAG_308_RC_OK 0x0001
> #define DIAG_308_RC_NO_CONF 0x0102
> #define DIAG_308_RC_INVALID 0x0402
next prev parent reply other threads:[~2015-04-21 19:10 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-17 7:52 [Qemu-devel] [PATCH 0/6] s390x: support diag288 watchdog Cornelia Huck
2015-04-17 7:52 ` [Qemu-devel] [PATCH 1/6] s390x/virtio-ccw: enable has_dynamic_sysbus Cornelia Huck
2015-04-21 19:06 ` Alexander Graf
2015-04-22 8:25 ` Cornelia Huck
2015-04-22 9:14 ` Alexander Graf
2015-04-22 11:40 ` Cornelia Huck
2015-04-22 12:21 ` Alexander Graf
2015-04-24 9:07 ` Cornelia Huck
2015-04-27 13:57 ` Alexander Graf
2015-04-27 14:19 ` Cornelia Huck
2015-04-27 15:15 ` Andreas Färber
2015-04-27 17:02 ` Cornelia Huck
2015-04-27 15:28 ` Alexander Graf
2015-04-27 16:56 ` Cornelia Huck
2015-04-28 6:50 ` Markus Armbruster
2015-04-17 7:52 ` [Qemu-devel] [PATCH 2/6] watchdog: Add watchdog device diag288 to the sysbus Cornelia Huck
2015-04-29 12:43 ` Markus Armbruster
2015-04-29 14:58 ` Cornelia Huck
2015-05-08 9:16 ` Cornelia Huck
2015-04-17 7:52 ` [Qemu-devel] [PATCH 3/6] s390/kvm: diag288 instruction interception and handling Cornelia Huck
2015-04-21 19:09 ` Alexander Graf [this message]
2015-04-22 8:32 ` Cornelia Huck
2015-04-22 9:16 ` Alexander Graf
2015-04-22 11:37 ` Cornelia Huck
2015-04-17 7:52 ` [Qemu-devel] [PATCH 4/6] watchdog: Add migration support to diag288 watchdog device Cornelia Huck
2015-04-17 7:52 ` [Qemu-devel] [PATCH 5/6] nmi: Implement inject_nmi() for non-monitor context use Cornelia Huck
2015-04-17 7:52 ` [Qemu-devel] [PATCH 6/6] watchdog: Add new Virtual Watchdog action INJECT-NMI Cornelia Huck
2015-04-17 12:28 ` Eric Blake
2015-04-20 15:23 ` Cornelia Huck
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=5536A051.9000901@suse.de \
--to=agraf@suse.de \
--cc=armbru@redhat.com \
--cc=borntraeger@de.ibm.com \
--cc=cornelia.huck@de.ibm.com \
--cc=gesaint@linux.vnet.ibm.com \
--cc=jfrei@linux.vnet.ibm.com \
--cc=lcapitulino@redhat.com \
--cc=mdroth@linux.vnet.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.