@@ -15,12 +15,14 @@
#include <sclp.h>
#include <smp.h>
#include <uv.h>
+#include <mmu.h>
#include <asm/page.h>
#include <asm/sigp.h>
#include <asm/pgtable.h>
#include <asm/asm-offsets.h>
#include <asm/interrupt.h>
#include <asm/facility.h>
+#include <asm/pgtable.h>
#include <asm/uv.h>
#include <asm-generic/barrier.h>
@@ -150,6 +152,54 @@ static void test_uv_uninitialized(void)
report_prefix_pop();
}
+static void test_access(void)
+{
+ struct uv_cb_header *uvcb;
+ void *pages = alloc_pages(1);
+ uint16_t pgm;
+ int i;
+
+ /* Put UVCB on second page which we will protect later */
+ uvcb = pages + PAGE_SIZE;
+
+ report_prefix_push("access");
+
+ report_prefix_push("non-crossing");
+ protect_page(uvcb, PAGE_ENTRY_I);
+ for (i = 0; cmds[i].name; i++) {
+ expect_pgm_int();
+ mb();
+ uv_call_once(0, (uint64_t)uvcb);
+ pgm = clear_pgm_int();
+ report(pgm == PGM_INT_CODE_PAGE_TRANSLATION, "%s", cmds[i].name);
+ }
+ report_prefix_pop();
+
+ report_prefix_push("crossing");
+ /*
+ * Put the header into the readable page 1, everything after
+ * the header will be on the second, invalid page.
+ */
+ uvcb -= 1;
+ for (i = 0; cmds[i].name; i++) {
+ uvcb->cmd = cmds[i].cmd;
+ uvcb->len = cmds[i].len;
+
+ expect_pgm_int();
+ mb();
+ uv_call_once(0, (uint64_t)uvcb);
+ pgm = clear_pgm_int();
+ report(pgm == PGM_INT_CODE_PAGE_TRANSLATION, "%s", cmds[i].name);
+ }
+ report_prefix_pop();
+
+ uvcb += 1;
+ unprotect_page(uvcb, PAGE_ENTRY_I);
+
+ free_pages(pages);
+ report_prefix_pop();
+}
+
static void test_config_destroy(void)
{
int rc;
@@ -615,6 +665,8 @@ int main(void)
test_init();
setup_vmem();
+ test_access();
+
test_config_create();
test_cpu_create();
test_cpu_destroy();