@@ -30,6 +30,13 @@
#define SNIPPET_HDR_LEN(type, file) \
((uintptr_t)SNIPPET_HDR_END(type, file) - (uintptr_t)SNIPPET_HDR_START(type, file))
+/*
+ * Some of the UV memory needs to be allocated with >31 bit
+ * addresses which means we need a lot more memory than other
+ * tests.
+ */
+#define SNIPPET_PV_MIN_MEM_SIZE (SZ_1M * 2200UL)
+
#define SNIPPET_PV_TWEAK0 0x42UL
#define SNIPPET_PV_TWEAK1 0UL
#define SNIPPET_UNPACK_OFF 0
@@ -7,6 +7,7 @@
bool uv_os_is_guest(void);
bool uv_os_is_host(void);
+bool uv_host_requirement_checks(void);
bool uv_query_test_call(unsigned int nr);
const struct uv_cb_qui *uv_get_query_data(void);
void uv_init(void);
@@ -18,6 +18,7 @@
#include <asm/uv.h>
#include <uv.h>
#include <sie.h>
+#include <snippet.h>
static struct uv_cb_qui uvcb_qui = {
.header.cmd = UVC_CMD_QUI,
@@ -38,6 +39,25 @@ bool uv_os_is_host(void)
return test_facility(158) && uv_query_test_call(BIT_UVC_CMD_INIT_UV);
}
+bool uv_host_requirement_checks(void)
+{
+ if (!test_facility(158)) {
+ report_skip("UV Call facility unavailable");
+ return false;
+ }
+ if (!sclp_facilities.has_sief2) {
+ report_skip("SIEF2 facility unavailable");
+ return false;
+ }
+ if (get_ram_size() < SNIPPET_PV_MIN_MEM_SIZE) {
+ report_skip("Not enough memory. This test needs about %ld MB of memory",
+ SNIPPET_PV_MIN_MEM_SIZE / SZ_1M);
+ return false;
+ }
+
+ return true;
+}
+
bool uv_query_test_call(unsigned int nr)
{
/* Query needs to be called first */
@@ -149,14 +149,8 @@ static void test_diag_yield(void)
int main(void)
{
report_prefix_push("pv-diags");
- if (!test_facility(158)) {
- report_skip("UV Call facility unavailable");
+ if (!uv_host_requirement_checks())
goto done;
- }
- if (!sclp_facilities.has_sief2) {
- report_skip("SIEF2 facility unavailable");
- goto done;
- }
uv_setup_asces();
snippet_setup_guest(&vm, true);