All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: qemu-devel@nongnu.org
Cc: thuth@redhat.com, cohuck@redhat.com,
	Christian Borntraeger <borntraeger@de.ibm.com>,
	Alexander Graf <agraf@suse.de>,
	Richard Henderson <richard.henderson@linaro.org>,
	David Hildenbrand <david@redhat.com>
Subject: [Qemu-devel] [PATCH v2 19/30] s390x/tcg: implement SIGP SENSE RUNNING STATUS
Date: Thu, 28 Sep 2017 22:36:57 +0200	[thread overview]
Message-ID: <20170928203708.9376-20-david@redhat.com> (raw)
In-Reply-To: <20170928203708.9376-1-david@redhat.com>

Preparation for TCG, for KVM is this is completely handled in the
kernel.

Signed-off-by: David Hildenbrand <david@redhat.com>
---
 target/s390x/cpu.h  |  2 ++
 target/s390x/sigp.c | 25 +++++++++++++++++++++++++
 2 files changed, 27 insertions(+)

diff --git a/target/s390x/cpu.h b/target/s390x/cpu.h
index f94d7f96e0..6b92b0751a 100644
--- a/target/s390x/cpu.h
+++ b/target/s390x/cpu.h
@@ -590,6 +590,7 @@ struct sysib_322 {
 #define SIGP_SET_PREFIX        0x0d
 #define SIGP_STORE_STATUS_ADDR 0x0e
 #define SIGP_SET_ARCH          0x12
+#define SIGP_SENSE_RUNNING     0x15
 #define SIGP_STORE_ADTL_STATUS 0x17
 
 /* SIGP condition codes */
@@ -600,6 +601,7 @@ struct sysib_322 {
 
 /* SIGP status bits */
 #define SIGP_STAT_EQUIPMENT_CHECK   0x80000000UL
+#define SIGP_STAT_NOT_RUNNING       0x00000400UL
 #define SIGP_STAT_INCORRECT_STATE   0x00000200UL
 #define SIGP_STAT_INVALID_PARAMETER 0x00000100UL
 #define SIGP_STAT_EXT_CALL_PENDING  0x00000080UL
diff --git a/target/s390x/sigp.c b/target/s390x/sigp.c
index 9587c3d319..c57312b743 100644
--- a/target/s390x/sigp.c
+++ b/target/s390x/sigp.c
@@ -234,6 +234,28 @@ static void sigp_set_prefix(CPUState *cs, run_on_cpu_data arg)
     si->cc = SIGP_CC_ORDER_CODE_ACCEPTED;
 }
 
+static void sigp_sense_running(S390CPU *dst_cpu, SigpInfo *si)
+{
+    if (!tcg_enabled()) {
+        /* handled in KVM */
+        set_sigp_status(si, SIGP_STAT_INVALID_ORDER);
+        return;
+    }
+
+    /* sensing without locks is racy, but it's the same for real hw */
+    if (!s390_has_feat(S390_FEAT_SENSE_RUNNING_STATUS)) {
+        set_sigp_status(si, SIGP_STAT_INVALID_ORDER);
+        return;
+    }
+
+    /* If halted (which includes also STOPPED), it is not running */
+    if (CPU(dst_cpu)->halted) {
+        si->cc = SIGP_CC_ORDER_CODE_ACCEPTED;
+    } else {
+        set_sigp_status(si, SIGP_STAT_NOT_RUNNING);
+    }
+}
+
 static int handle_sigp_single_dst(S390CPU *dst_cpu, uint8_t order,
                                   uint64_t param, uint64_t *status_reg)
 {
@@ -282,6 +304,9 @@ static int handle_sigp_single_dst(S390CPU *dst_cpu, uint8_t order,
     case SIGP_CPU_RESET:
         run_on_cpu(CPU(dst_cpu), sigp_cpu_reset, RUN_ON_CPU_HOST_PTR(&si));
         break;
+    case SIGP_SENSE_RUNNING:
+        sigp_sense_running(dst_cpu, &si);
+        break;
     default:
         set_sigp_status(&si, SIGP_STAT_INVALID_ORDER);
     }
-- 
2.13.5

  parent reply	other threads:[~2017-09-28 20:38 UTC|newest]

Thread overview: 65+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-28 20:36 [Qemu-devel] [PATCH v2 00/30] s390x: SMP for TCG David Hildenbrand
2017-09-28 20:36 ` [Qemu-devel] [PATCH v2 01/30] s390x/tcg: turn INTERRUPT_EXT into a mask David Hildenbrand
2017-10-06  7:08   ` Thomas Huth
2017-10-10 14:20     ` Cornelia Huck
2017-10-10 16:49       ` Richard Henderson
2017-09-28 20:36 ` [Qemu-devel] [PATCH v2 02/30] s390x/tcg: cleanup service interrupt injection David Hildenbrand
2017-10-06 13:17   ` Richard Henderson
2017-10-10 14:23   ` Cornelia Huck
2017-09-28 20:36 ` [Qemu-devel] [PATCH v2 03/30] s390x/tcg: injection of emergency signals and external calls David Hildenbrand
2017-10-06 13:18   ` Richard Henderson
2017-09-28 20:36 ` [Qemu-devel] [PATCH v2 04/30] s390x/tcg: rework checking for deliverable interrupts David Hildenbrand
2017-10-06 13:31   ` Richard Henderson
2017-09-28 20:36 ` [Qemu-devel] [PATCH v2 05/30] s390x/tcg: take care of external interrupt subclasses David Hildenbrand
2017-10-06 13:34   ` Richard Henderson
2017-09-28 20:36 ` [Qemu-devel] [PATCH v2 06/30] s390x/tcg: STOPPED cpus can never wake up David Hildenbrand
2017-09-28 20:36 ` [Qemu-devel] [PATCH v2 07/30] s390x/tcg: a CPU cannot switch state due to an interrupt David Hildenbrand
2017-09-28 20:36 ` [Qemu-devel] [PATCH v2 08/30] target/s390x: factor out handling of WAIT PSW into s390_handle_wait() David Hildenbrand
2017-09-28 20:36 ` [Qemu-devel] [PATCH v2 09/30] s390x/tcg: handle WAIT PSWs during interrupt injection David Hildenbrand
2017-10-06 13:37   ` Richard Henderson
2017-09-28 20:36 ` [Qemu-devel] [PATCH v2 10/30] target/s390x: interpret PSW_MASK_WAIT only for TCG David Hildenbrand
2017-10-06 13:37   ` Richard Henderson
2017-10-11  8:05   ` Cornelia Huck
2017-09-28 20:36 ` [Qemu-devel] [PATCH v2 11/30] s390x/kvm: pass ipb directly into handle_sigp() David Hildenbrand
2017-09-28 20:36 ` [Qemu-devel] [PATCH v2 12/30] s390x/kvm: generalize SIGP stop and restart interrupt injection David Hildenbrand
2017-09-28 20:36 ` [Qemu-devel] [PATCH v2 13/30] s390x/kvm: factor out storing of CPU status David Hildenbrand
2017-10-06 13:39   ` Richard Henderson
2017-09-28 20:36 ` [Qemu-devel] [PATCH v2 14/30] s390x/kvm: factor out storing of adtl " David Hildenbrand
2017-09-28 20:36 ` [Qemu-devel] [PATCH v2 15/30] s390x/kvm: drop two debug prints David Hildenbrand
2017-09-28 20:36 ` [Qemu-devel] [PATCH v2 16/30] s390x/kvm: factor out SIGP code into sigp.c David Hildenbrand
2017-10-11  8:27   ` Cornelia Huck
2017-09-28 20:36 ` [Qemu-devel] [PATCH v2 17/30] MAINTAINERS: use s390 KVM maintainers for target/s390x/sigp.c David Hildenbrand
2017-10-06 13:40   ` Richard Henderson
2017-10-06 14:09     ` Cornelia Huck
2017-09-28 20:36 ` [Qemu-devel] [PATCH v2 18/30] s390x/kvm: factor out actual handling of STOP interrupts David Hildenbrand
2017-10-06 13:42   ` Richard Henderson
2017-09-28 20:36 ` David Hildenbrand [this message]
2017-10-06 13:44   ` [Qemu-devel] [PATCH v2 19/30] s390x/tcg: implement SIGP SENSE RUNNING STATUS Richard Henderson
2017-09-28 20:36 ` [Qemu-devel] [PATCH v2 20/30] s390x/tcg: implement SIGP SENSE David Hildenbrand
2017-10-06 13:45   ` Richard Henderson
2017-10-11  8:34   ` Cornelia Huck
2017-09-28 20:36 ` [Qemu-devel] [PATCH v2 21/30] s390x/tcg: implement SIGP EXTERNAL CALL David Hildenbrand
2017-10-06 13:46   ` Richard Henderson
2017-09-28 20:37 ` [Qemu-devel] [PATCH v2 22/30] s390x/tcg: implement SIGP EMERGENCY SIGNAL David Hildenbrand
2017-10-06 13:47   ` Richard Henderson
2017-09-28 20:37 ` [Qemu-devel] [PATCH v2 23/30] s390x/tcg: implement SIGP CONDITIONAL " David Hildenbrand
2017-10-06 13:49   ` Richard Henderson
2017-09-28 20:37 ` [Qemu-devel] [PATCH v2 24/30] s390x/tcg: implement STOP and RESET interrupts for TCG David Hildenbrand
2017-10-06 13:59   ` Richard Henderson
2017-10-11  8:45   ` Cornelia Huck
2017-09-28 20:37 ` [Qemu-devel] [PATCH v2 25/30] s390x/tcg: flush the tlb on SIGP SET PREFIX David Hildenbrand
2017-10-06 13:59   ` Richard Henderson
2017-09-28 20:37 ` [Qemu-devel] [PATCH v2 26/30] s390x/tcg: switch to new SIGP handling code David Hildenbrand
2017-10-06 14:02   ` Richard Henderson
2017-10-11  8:50     ` Cornelia Huck
2017-09-28 20:37 ` [Qemu-devel] [PATCH v2 27/30] s390x/cpumodel: allow to enable SENSE RUNNING STATUS for qemu David Hildenbrand
2017-10-06 14:03   ` Richard Henderson
2017-09-28 20:37 ` [Qemu-devel] [PATCH v2 28/30] s390x/tcg: unlock NMI David Hildenbrand
2017-10-06 14:04   ` Richard Henderson
2017-10-11  9:00   ` Cornelia Huck
2017-09-28 20:37 ` [Qemu-devel] [PATCH v2 29/30] s390x/tcg: refactor stfl(e) to use s390_get_feat_block() David Hildenbrand
2017-10-06 14:07   ` Richard Henderson
2017-09-28 20:37 ` [Qemu-devel] [PATCH v2 30/30] target/s390x: special handling when starting a CPU with WAIT PSW David Hildenbrand
2017-10-06 14:10   ` Richard Henderson
2017-10-11 12:07 ` [Qemu-devel] [PATCH v2 00/30] s390x: SMP for TCG Cornelia Huck
2017-10-16  7:14   ` David Hildenbrand

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=20170928203708.9376-20-david@redhat.com \
    --to=david@redhat.com \
    --cc=agraf@suse.de \
    --cc=borntraeger@de.ibm.com \
    --cc=cohuck@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.org \
    --cc=thuth@redhat.com \
    /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.