@@ -16,6 +16,7 @@
#include <asm/arch_def.h>
#include <alloc_page.h>
#include <alloc.h>
+#include <sclp.h>
#include <malloc_io.h>
#include <css.h>
@@ -34,6 +35,12 @@ static struct senseid *senseid;
struct ccw1 *ccw;
struct orb *orb;
+phys_addr_t ram_size;
+#define ADDR_1G 0x40000000
+#define ADDR_1_5G 0x60000000
+#define ADDR_3G 0xc0000000
+
+
static void test_enumerate(void)
{
test_device_sid = css_enumerate();
@@ -123,10 +130,80 @@ static void ssch_orb_alignment(void)
free_pages(p - 2);
}
+static void ssch_data_access(void)
+{
+ uint32_t tmp;
+
+ if (ram_size > ADDR_1G) {
+ report_skip("Test with more than 1G available memory");
+ return;
+ }
+
+ tmp = ccw->data_address;
+ ccw->data_address = ADDR_1_5G;
+
+ ssch(test_device_sid, orb);
+ tsch(test_device_sid, &irb);
+ report(check_io_errors(test_device_sid, 0, SCSW_SCHS_PRG_CHK), "expecting Program check");
+
+ ccw->data_address = tmp;
+}
+
+static void ssch_ccw_access(void)
+{
+ uint32_t tmp;
+
+ if (ram_size > ADDR_1G) {
+ report_skip("Test with more than 1G available memory");
+ return;
+ }
+
+ tmp = orb->cpa;
+ orb->cpa = ADDR_1_5G;
+
+ ssch(test_device_sid, orb);
+ tsch(test_device_sid, &irb);
+ report(check_io_errors(test_device_sid, 0, SCSW_SCHS_PRG_CHK), "expecting Program check");
+
+ orb->cpa = tmp;
+}
+
+static void ssch_ccw_dma31(void)
+{
+ uint32_t tmp;
+ struct ccw1 *ccw_high;
+
+ if (ram_size < ADDR_3G) {
+ report_skip("Test with less than 3G available memory");
+ return;
+ }
+
+ ccw_high = alloc_pages_flags(0, AREA_NORMAL);
+ assert(ccw_high);
+ ccw_high->code = CCW_CMD_SENSE_ID;
+ ccw_high->flags = CCW_F_SLI;
+ ccw_high->count = sizeof(*senseid);
+ ccw_high->data_address = (long)senseid;
+
+ tmp = orb->cpa;
+ report_info("ccw_high: %p", ccw_high);
+ orb->cpa = (long)ccw_high;
+
+ expect_pgm_int();
+ ssch(test_device_sid, orb);
+ check_pgm_int_code(PGM_INT_CODE_OPERAND);
+
+ orb->cpa = tmp;
+ free_pages(ccw_high);
+}
+
static struct tests ssh_tests[] = {
{ "privilege", ssch_privilege },
{ "orb cpa zero", ssch_orb_cpa_zero },
{ "orb alignment", ssch_orb_alignment },
+ { "data access", ssch_data_access },
+ { "CCW access", ssch_ccw_access },
+ { "CCW in DMA31", ssch_ccw_dma31 },
{ NULL, NULL }
};
@@ -136,6 +213,7 @@ static void test_ssch(void)
orb_alloc();
assert(css_enable(test_device_sid, 0) == 0);
+ ram_size = get_ram_size();
for (i = 0; ssh_tests[i].name; i++) {
report_prefix_push(ssh_tests[i].name);
@@ -144,6 +222,7 @@ static void test_ssch(void)
}
orb_free();
+ css_enable(test_device_sid, 0);
}
/*
@@ -86,9 +86,13 @@ extra_params = -m 1G
file = sclp.elf
extra_params = -m 3G
-[css]
+[css-1g]
file = css.elf
-extra_params = -device virtio-net-ccw
+extra_params = -m 1G -device virtio-net-ccw
+
+[css-3g]
+file = css.elf
+extra_params = -m 3G -device virtio-net-ccw
[skrf]
file = skrf.elf
We check ORB CPA and CCW address for being inside limits and existing. Signed-off-by: Pierre Morel <pmorel@linux.ibm.com> --- s390x/css.c | 79 +++++++++++++++++++++++++++++++++++++++++++++ s390x/unittests.cfg | 8 +++-- 2 files changed, 85 insertions(+), 2 deletions(-)