From: Pierre Morel <pmorel@linux.ibm.com>
To: qemu-s390x@nongnu.org
Cc: thuth@redhat.com, mjrosato@linux.ibm.com, david@redhat.com,
farman@linux.ibm.com, cohuck@redhat.com,
richard.henderson@linaro.org, qemu-devel@nongnu.org,
pasic@linux.ibm.com, borntraeger@de.ibm.com
Subject: [PATCH 1/1] s390x:clp: implementing CLP immediate commands
Date: Fri, 17 Sep 2021 14:06:53 +0200 [thread overview]
Message-ID: <1631880413-20655-2-git-send-email-pmorel@linux.ibm.com> (raw)
In-Reply-To: <1631880413-20655-1-git-send-email-pmorel@linux.ibm.com>
CLP immediate commands allow to query the Logical Processor
available on the machine and to check for a specific one.
Let's add these commands.
Signed-off-by: Pierre Morel <pmorel@linux.ibm.com>
---
hw/s390x/s390-pci-inst.c | 33 ++++++++++++++++++++++++++++++++
include/hw/s390x/s390-pci-inst.h | 5 +++++
target/s390x/kvm/kvm.c | 6 ++++++
3 files changed, 44 insertions(+)
diff --git a/hw/s390x/s390-pci-inst.c b/hw/s390x/s390-pci-inst.c
index 1c8ad91175..9fd0669591 100644
--- a/hw/s390x/s390-pci-inst.c
+++ b/hw/s390x/s390-pci-inst.c
@@ -156,6 +156,39 @@ out:
return rc;
}
+int clp_immediate_cmd(S390CPU *cpu, uint8_t r1, uint8_t r2, uint8_t i3,
+ uintptr_t ra)
+{
+ CPUS390XState *env = &cpu->env;
+
+ switch (r2) {
+ case 0: /* Command Check */
+ switch (i3 & 0x07) {
+ case CLP_LPS_PCI: /* PCI */
+ if (!s390_has_feat(S390_FEAT_ZPCI)) {
+ setcc(cpu, 3);
+ return 0;
+ }
+ /* fallthrough */
+ case CLP_LPS_BASE: /* Base LP */
+ setcc(cpu, 0);
+ return 0;
+ }
+ setcc(cpu, 3);
+ return 0;
+ case 1: /* Command Query */
+ env->regs[r1] = CLP_QUERY_LP_BASE;
+ if (s390_has_feat(S390_FEAT_ZPCI)) {
+ env->regs[r1] |= CLP_QUERY_LP_BASE >> CLP_LPS_PCI;
+ }
+ setcc(cpu, 0);
+ return 0;
+ }
+
+ s390_program_interrupt(env, PGM_SPECIFICATION, ra);
+ return 0;
+}
+
int clp_service_call(S390CPU *cpu, uint8_t r2, uintptr_t ra)
{
ClpReqHdr *reqh;
diff --git a/include/hw/s390x/s390-pci-inst.h b/include/hw/s390x/s390-pci-inst.h
index a55c448aad..07721b08da 100644
--- a/include/hw/s390x/s390-pci-inst.h
+++ b/include/hw/s390x/s390-pci-inst.h
@@ -101,6 +101,11 @@ typedef struct ZpciFib {
int pci_dereg_irqs(S390PCIBusDevice *pbdev);
void pci_dereg_ioat(S390PCIIOMMU *iommu);
int clp_service_call(S390CPU *cpu, uint8_t r2, uintptr_t ra);
+#define CLP_LPS_BASE 0
+#define CLP_LPS_PCI 2
+#define CLP_QUERY_LP_BASE (1UL << 63)
+int clp_immediate_cmd(S390CPU *cpu, uint8_t r1, uint8_t r2, uint8_t i3,
+ uintptr_t ra);
int pcilg_service_call(S390CPU *cpu, uint8_t r1, uint8_t r2, uintptr_t ra);
int pcistg_service_call(S390CPU *cpu, uint8_t r1, uint8_t r2, uintptr_t ra);
int rpcit_service_call(S390CPU *cpu, uint8_t r1, uint8_t r2, uintptr_t ra);
diff --git a/target/s390x/kvm/kvm.c b/target/s390x/kvm/kvm.c
index 0a5f2aced2..af1316372d 100644
--- a/target/s390x/kvm/kvm.c
+++ b/target/s390x/kvm/kvm.c
@@ -1345,7 +1345,13 @@ static uint64_t get_base_disp_rsy(S390CPU *cpu, struct kvm_run *run,
static int kvm_clp_service_call(S390CPU *cpu, struct kvm_run *run)
{
+ uint8_t r1 = (run->s390_sieic.ipb & 0x00f00000) >> 20;
uint8_t r2 = (run->s390_sieic.ipb & 0x000f0000) >> 16;
+ uint8_t i3 = (run->s390_sieic.ipb & 0xff000000) >> 24;
+
+ if (i3 & 0x80) {
+ return clp_immediate_cmd(cpu, r1, r2, i3, RA_IGNORED);
+ }
if (s390_has_feat(S390_FEAT_ZPCI)) {
return clp_service_call(cpu, r2, RA_IGNORED);
--
2.25.1
next prev parent reply other threads:[~2021-09-17 12:08 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-17 12:06 [PATCH 0/1] s390x:clp: implementing CLP immediate commands Pierre Morel
2021-09-17 12:06 ` Pierre Morel [this message]
2021-09-17 13:55 ` [PATCH 1/1] " Matthew Rosato
2021-10-12 7:27 ` Thomas Huth
2021-10-12 14:26 ` Pierre Morel
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=1631880413-20655-2-git-send-email-pmorel@linux.ibm.com \
--to=pmorel@linux.ibm.com \
--cc=borntraeger@de.ibm.com \
--cc=cohuck@redhat.com \
--cc=david@redhat.com \
--cc=farman@linux.ibm.com \
--cc=mjrosato@linux.ibm.com \
--cc=pasic@linux.ibm.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-s390x@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 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).