[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 14/15] s390x: protvirt: Disable address checks for PV guest IO em
From: |
Janosch Frank |
Subject: |
[PATCH 14/15] s390x: protvirt: Disable address checks for PV guest IO emulation |
Date: |
Wed, 20 Nov 2019 06:43:33 -0500 |
IO instruction data is routed through SIDAD for protected guests, so
adresses do not need to be checked, as this is kernel memory.
Signed-off-by: Janosch Frank <address@hidden>
---
target/s390x/ioinst.c | 46 +++++++++++++++++++++++++++----------------
1 file changed, 29 insertions(+), 17 deletions(-)
diff --git a/target/s390x/ioinst.c b/target/s390x/ioinst.c
index c437a1d8c6..d3bd422ddd 100644
--- a/target/s390x/ioinst.c
+++ b/target/s390x/ioinst.c
@@ -110,11 +110,13 @@ void ioinst_handle_msch(S390CPU *cpu, uint64_t reg1,
uint32_t ipb, uintptr_t ra)
int cssid, ssid, schid, m;
SubchDev *sch;
SCHIB schib;
- uint64_t addr;
+ uint64_t addr = 0;
CPUS390XState *env = &cpu->env;
- uint8_t ar;
+ uint8_t ar = 0;
- addr = decode_basedisp_s(env, ipb, &ar);
+ if (!env->pv) {
+ addr = decode_basedisp_s(env, ipb, &ar);
+ }
if (addr & 3) {
s390_program_interrupt(env, PGM_SPECIFICATION, ra);
return;
@@ -167,11 +169,13 @@ void ioinst_handle_ssch(S390CPU *cpu, uint64_t reg1,
uint32_t ipb, uintptr_t ra)
int cssid, ssid, schid, m;
SubchDev *sch;
ORB orig_orb, orb;
- uint64_t addr;
+ uint64_t addr = 0;
CPUS390XState *env = &cpu->env;
- uint8_t ar;
+ uint8_t ar = 0;
- addr = decode_basedisp_s(env, ipb, &ar);
+ if (!env->pv) {
+ addr = decode_basedisp_s(env, ipb, &ar);
+ }
if (addr & 3) {
s390_program_interrupt(env, PGM_SPECIFICATION, ra);
return;
@@ -198,12 +202,14 @@ void ioinst_handle_ssch(S390CPU *cpu, uint64_t reg1,
uint32_t ipb, uintptr_t ra)
void ioinst_handle_stcrw(S390CPU *cpu, uint32_t ipb, uintptr_t ra)
{
CRW crw;
- uint64_t addr;
+ uint64_t addr = 0;
int cc;
CPUS390XState *env = &cpu->env;
- uint8_t ar;
+ uint8_t ar = 0;
- addr = decode_basedisp_s(env, ipb, &ar);
+ if (!env->pv) {
+ addr = decode_basedisp_s(env, ipb, &ar);
+ }
if (addr & 3) {
s390_program_interrupt(env, PGM_SPECIFICATION, ra);
return;
@@ -228,13 +234,15 @@ void ioinst_handle_stsch(S390CPU *cpu, uint64_t reg1,
uint32_t ipb,
{
int cssid, ssid, schid, m;
SubchDev *sch;
- uint64_t addr;
+ uint64_t addr = 0;
int cc;
SCHIB schib;
CPUS390XState *env = &cpu->env;
- uint8_t ar;
+ uint8_t ar = 0;
- addr = decode_basedisp_s(env, ipb, &ar);
+ if (!env->pv) {
+ addr = decode_basedisp_s(env, ipb, &ar);
+ }
if (addr & 3) {
s390_program_interrupt(env, PGM_SPECIFICATION, ra);
return;
@@ -294,16 +302,18 @@ int ioinst_handle_tsch(S390CPU *cpu, uint64_t reg1,
uint32_t ipb, uintptr_t ra)
int cssid, ssid, schid, m;
SubchDev *sch;
IRB irb;
- uint64_t addr;
+ uint64_t addr = 0;
int cc, irb_len;
- uint8_t ar;
+ uint8_t ar = 0;
if (ioinst_disassemble_sch_ident(reg1, &m, &cssid, &ssid, &schid)) {
s390_program_interrupt(env, PGM_OPERAND, ra);
return -EIO;
}
trace_ioinst_sch_id("tsch", cssid, ssid, schid);
- addr = decode_basedisp_s(env, ipb, &ar);
+ if (!env->pv) {
+ addr = decode_basedisp_s(env, ipb, &ar);
+ }
if (addr & 3) {
s390_program_interrupt(env, PGM_SPECIFICATION, ra);
return -EIO;
@@ -601,7 +611,7 @@ void ioinst_handle_chsc(S390CPU *cpu, uint32_t ipb,
uintptr_t ra)
{
ChscReq *req;
ChscResp *res;
- uint64_t addr;
+ uint64_t addr = 0;
int reg;
uint16_t len;
uint16_t command;
@@ -610,7 +620,9 @@ void ioinst_handle_chsc(S390CPU *cpu, uint32_t ipb,
uintptr_t ra)
trace_ioinst("chsc");
reg = (ipb >> 20) & 0x00f;
- addr = env->regs[reg];
+ if (!env->pv) {
+ addr = env->regs[reg];
+ }
/* Page boundary? */
if (addr & 0xfff) {
s390_program_interrupt(env, PGM_SPECIFICATION, ra);
--
2.20.1
- Re: [PATCH 06/15] s390x: protvirt: Support unpack facility, (continued)
- [PATCH 12/15] s390x: protvirt: Set guest IPL PSW, Janosch Frank, 2019/11/20
- [PATCH 14/15] s390x: protvirt: Disable address checks for PV guest IO emulation,
Janosch Frank <=
[PATCH 10/15] s390x: protvirt: Add new VCPU reset functions, Janosch Frank, 2019/11/20
[PATCH 13/15] s390x: protvirt: Move diag 308 data over SIDAD, Janosch Frank, 2019/11/20