s390: fixes

Some fixes all over the place:
 - ccw bios and gcc 5.1 (avoid floating point ops)
 - properly print vector registers
 - sclp and sclp-event-facility no longer hang on object_unref(object_new(T))
 - better name for io_subsystem_reset
 
 One feature
 - the gdb server now exposes several virtualization specific register
 -----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.14 (GNU/Linux)
 
 iQIcBAABAgAGBQJWE6BoAAoJEBF7vIC1phx89zUP/RohjexrA9GZ93mKlP8SdmUO
 FP4MmsaInv7PTIfZeUnG1sa0n9CbodwiPypnzlvOedbibQagnZwI+pnpa/W/SxJQ
 M6Wh+vamUFEfXcNC4/6zOJJvKUQUBYMDVgbUuDxTgCne4V9yCgVzs8NPWBIfFCVC
 3bzUxinzG+mTD6eQLNNrpTa7KSuKhNS1g0hsIId92XAr7iQ3H2SSDCr9w+HOR3eN
 Gqr3JdCOVOwqNcrsyfpJK3NYaooqcSbAlIpfNoGaxrc3DldEjBTfr20LLHKoPhcM
 ibEAOUi1dtdBlZofo8/OBvHeeR0MPHmCjV9CTxymmgABPWhpIIxEG16vgy8ijZ5R
 QcA6D4QlALvE+kDwXGtHfEOZ0rHMHmzD9RUtzLL5ALG4UWM06qrwqtMeHUuAxInU
 lRPaEV9J+1fXzQzH708DjRAncOOdTCVUv0SfoYa3VR4wo0ZMx6W/K/FXc/h4q4Jm
 6CztpK03HSly+gCkd6gcdZ908Se3OcaB0DTScVvUdVKCUdvM53Uo7L5jI9wk399a
 xj/+W4XO9lkLEFnZKAKopS4ea7cgV8oIqUuMpCuZnCiOQCCKpZgrUgJAxvaLomnv
 4he7fbiScmMEhUGVI0AvMmbMYCbGd4gVoHm5/kMvslV5w5o898uIVlTrvNf3Z6Fv
 9jZSLDLVoHeU+ESOjJy+
 =STtO
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/borntraeger/tags/s390x-20151006' into staging

s390: fixes

Some fixes all over the place:
- ccw bios and gcc 5.1 (avoid floating point ops)
- properly print vector registers
- sclp and sclp-event-facility no longer hang on object_unref(object_new(T))
- better name for io_subsystem_reset

One feature
- the gdb server now exposes several virtualization specific register

# gpg: Signature made Tue 06 Oct 2015 11:20:24 BST using RSA key ID B5A61C7C
# gpg: Good signature from "Christian Borntraeger (IBM) <borntraeger@de.ibm.com>"

* remotes/borntraeger/tags/s390x-20151006:
  s390x: rename io_subsystem_reset -> subsystem_reset
  s390x/info registers: print vector registers properly
  s390x: set missing parent for hotplug and quiesce events
  s390x/gdb: expose virtualization specific registers
  pc-bios/s390-ccw: avoid floating point operations

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2015-10-06 16:32:16 +01:00
commit eed2df6785
9 changed files with 118 additions and 17 deletions

2
configure vendored
View File

@ -5457,7 +5457,7 @@ case "$target_name" in
echo "TARGET_ABI32=y" >> $config_target_mak
;;
s390x)
gdb_xml_files="s390x-core64.xml s390-acr.xml s390-fpr.xml s390-vx.xml s390-cr.xml"
gdb_xml_files="s390x-core64.xml s390-acr.xml s390-fpr.xml s390-vx.xml s390-cr.xml s390-virt.xml"
;;
tilegx)
;;

18
gdb-xml/s390-virt.xml Normal file
View File

@ -0,0 +1,18 @@
<?xml version="1.0"?>
<!-- Copyright 2015 IBM Corp.
This work is licensed under the terms of the GNU GPL, version 2 or
(at your option) any later version. See the COPYING file in the
top-level directory. -->
<!DOCTYPE feature SYSTEM "gdb-target.dtd">
<feature name="org.gnu.gdb.s390.virt">
<reg name="ckc" bitsize="64" type="uint64" group="system"/>
<reg name="cputm" bitsize="64" type="uint64" group="system"/>
<reg name="last_break" bitsize="64" type="code_ptr" group="system"/>
<reg name="prefix" bitsize="64" type="data_ptr" group="system"/>
<reg name="pp" bitsize="64" type="uint64" group="system"/>
<reg name="pfault_token" bitsize="64" type="uint64" group="system"/>
<reg name="pfault_select" bitsize="64" type="uint64" group="system"/>
<reg name="pfault_compare" bitsize="64" type="uint64" group="system"/>
</feature>

View File

@ -27,8 +27,6 @@ typedef struct SCLPEventsBus {
struct SCLPEventFacility {
SysBusDevice parent_obj;
SCLPEventsBus sbus;
SCLPEvent quiesce_event;
SCLPEvent cpu_hotplug_event;
/* guest' receive mask */
unsigned int receive_mask;
};
@ -347,19 +345,21 @@ static void init_event_facility(Object *obj)
{
SCLPEventFacility *event_facility = EVENT_FACILITY(obj);
DeviceState *sdev = DEVICE(obj);
Object *new;
/* Spawn a new bus for SCLP events */
qbus_create_inplace(&event_facility->sbus, sizeof(event_facility->sbus),
TYPE_SCLP_EVENTS_BUS, sdev, NULL);
object_initialize(&event_facility->quiesce_event, sizeof(SCLPEvent),
TYPE_SCLP_QUIESCE);
qdev_set_parent_bus(DEVICE(&event_facility->quiesce_event),
&event_facility->sbus.qbus);
object_initialize(&event_facility->cpu_hotplug_event, sizeof(SCLPEvent),
TYPE_SCLP_CPU_HOTPLUG);
qdev_set_parent_bus(DEVICE(&event_facility->cpu_hotplug_event),
&event_facility->sbus.qbus);
new = object_new(TYPE_SCLP_QUIESCE);
object_property_add_child(obj, TYPE_SCLP_QUIESCE, new, NULL);
object_unref(new);
qdev_set_parent_bus(DEVICE(new), &event_facility->sbus.qbus);
new = object_new(TYPE_SCLP_CPU_HOTPLUG);
object_property_add_child(obj, TYPE_SCLP_CPU_HOTPLUG, new, NULL);
object_unref(new);
qdev_set_parent_bus(DEVICE(new), &event_facility->sbus.qbus);
/* the facility will automatically realize the devices via the bus */
}

View File

@ -35,7 +35,7 @@ typedef struct S390CcwMachineState {
bool dea_key_wrap;
} S390CcwMachineState;
void io_subsystem_reset(void)
void subsystem_reset(void)
{
DeviceState *css, *sclp, *flic, *diag288;

View File

@ -10,7 +10,8 @@ $(call set-vpath, $(SRC_PATH)/pc-bios/s390-ccw)
.PHONY : all clean build-all
OBJECTS = start.o main.o bootmap.o sclp-ascii.o virtio.o
CFLAGS += -fPIE -fno-stack-protector -ffreestanding -fno-delete-null-pointer-checks
CFLAGS += -fPIE -fno-stack-protector -ffreestanding
CFLAGS += -fno-delete-null-pointer-checks -msoft-float
LDFLAGS += -Wl,-pie -nostdlib
build-all: s390-ccw.img

View File

@ -568,7 +568,7 @@ void cpu_unlock(void);
typedef struct SubchDev SubchDev;
#ifndef CONFIG_USER_ONLY
extern void io_subsystem_reset(void);
extern void subsystem_reset(void);
SubchDev *css_find_subch(uint8_t m, uint8_t cssid, uint8_t ssid,
uint16_t schid);
bool css_subch_visible(SubchDev *sch);

View File

@ -205,6 +205,82 @@ static int cpu_write_c_reg(CPUS390XState *env, uint8_t *mem_buf, int n)
return 0;
}
}
/* the values represent the positions in s390-virt.xml */
#define S390_VIRT_CKC_REGNUM 0
#define S390_VIRT_CPUTM_REGNUM 1
#define S390_VIRT_BEA_REGNUM 2
#define S390_VIRT_PREFIX_REGNUM 3
#define S390_VIRT_PP_REGNUM 4
#define S390_VIRT_PFT_REGNUM 5
#define S390_VIRT_PFS_REGNUM 6
#define S390_VIRT_PFC_REGNUM 7
/* total number of registers in s390-virt.xml */
#define S390_NUM_VIRT_REGS 8
static int cpu_read_virt_reg(CPUS390XState *env, uint8_t *mem_buf, int n)
{
switch (n) {
case S390_VIRT_CKC_REGNUM:
return gdb_get_regl(mem_buf, env->ckc);
case S390_VIRT_CPUTM_REGNUM:
return gdb_get_regl(mem_buf, env->cputm);
case S390_VIRT_BEA_REGNUM:
return gdb_get_regl(mem_buf, env->gbea);
case S390_VIRT_PREFIX_REGNUM:
return gdb_get_regl(mem_buf, env->psa);
case S390_VIRT_PP_REGNUM:
return gdb_get_regl(mem_buf, env->pp);
case S390_VIRT_PFT_REGNUM:
return gdb_get_regl(mem_buf, env->pfault_token);
case S390_VIRT_PFS_REGNUM:
return gdb_get_regl(mem_buf, env->pfault_select);
case S390_VIRT_PFC_REGNUM:
return gdb_get_regl(mem_buf, env->pfault_compare);
default:
return 0;
}
}
static int cpu_write_virt_reg(CPUS390XState *env, uint8_t *mem_buf, int n)
{
switch (n) {
case S390_VIRT_CKC_REGNUM:
env->ckc = ldtul_p(mem_buf);
cpu_synchronize_post_init(ENV_GET_CPU(env));
return 8;
case S390_VIRT_CPUTM_REGNUM:
env->cputm = ldtul_p(mem_buf);
cpu_synchronize_post_init(ENV_GET_CPU(env));
return 8;
case S390_VIRT_BEA_REGNUM:
env->gbea = ldtul_p(mem_buf);
cpu_synchronize_post_init(ENV_GET_CPU(env));
return 8;
case S390_VIRT_PREFIX_REGNUM:
env->psa = ldtul_p(mem_buf);
cpu_synchronize_post_init(ENV_GET_CPU(env));
return 8;
case S390_VIRT_PP_REGNUM:
env->pp = ldtul_p(mem_buf);
cpu_synchronize_post_init(ENV_GET_CPU(env));
return 8;
case S390_VIRT_PFT_REGNUM:
env->pfault_token = ldtul_p(mem_buf);
cpu_synchronize_post_init(ENV_GET_CPU(env));
return 8;
case S390_VIRT_PFS_REGNUM:
env->pfault_select = ldtul_p(mem_buf);
cpu_synchronize_post_init(ENV_GET_CPU(env));
return 8;
case S390_VIRT_PFC_REGNUM:
env->pfault_compare = ldtul_p(mem_buf);
cpu_synchronize_post_init(ENV_GET_CPU(env));
return 8;
default:
return 0;
}
}
#endif
void s390_cpu_gdb_init(CPUState *cs)
@ -225,5 +301,11 @@ void s390_cpu_gdb_init(CPUState *cs)
gdb_register_coprocessor(cs, cpu_read_c_reg,
cpu_write_c_reg,
S390_NUM_C_REGS, "s390-cr.xml", 0);
if (kvm_enabled()) {
gdb_register_coprocessor(cs, cpu_read_virt_reg,
cpu_write_virt_reg,
S390_NUM_VIRT_REGS, "s390-virt.xml", 0);
}
#endif
}

View File

@ -128,7 +128,7 @@ static int modified_clear_reset(S390CPU *cpu)
run_on_cpu(t, s390_do_cpu_full_reset, t);
}
cmma_reset(cpu);
io_subsystem_reset();
subsystem_reset();
scc->load_normal(CPU(cpu));
cpu_synchronize_all_post_reset();
resume_all_vcpus();
@ -146,7 +146,7 @@ static int load_normal_reset(S390CPU *cpu)
run_on_cpu(t, s390_do_cpu_reset, t);
}
cmma_reset(cpu);
io_subsystem_reset();
subsystem_reset();
scc->initial_cpu_reset(CPU(cpu));
scc->load_normal(CPU(cpu));
cpu_synchronize_all_post_reset();

View File

@ -124,7 +124,7 @@ void s390_cpu_dump_state(CPUState *cs, FILE *f, fprintf_function cpu_fprintf,
for (i = 0; i < 32; i++) {
cpu_fprintf(f, "V%02d=%016" PRIx64 "%016" PRIx64, i,
env->vregs[i][0].ll, env->vregs[i][1].ll);
cpu_fprintf(f, (i % 2) ? " " : "\n");
cpu_fprintf(f, (i % 2) ? "\n" : " ");
}
#ifndef CONFIG_USER_ONLY