if (is_vector_supported() || is_xtheadvector_supported())
SKIP(return, "Test expects vector to be not supported");
rc = prctl(PR_RISCV_V_GET_CONTROL);
EXPECT_EQ(-1, rc)
TH_LOG("GET_CONTROL should fail on kernel/hw without ZVE32X");
EXPECT_EQ(EINVAL, errno)
TH_LOG("GET_CONTROL should fail on kernel/hw without ZVE32X");
}
TEST(set_control_no_v)
{ long rc;
if (is_vector_supported() || is_xtheadvector_supported())
SKIP(return, "Test expects vector to be not supported");
rc = prctl(PR_RISCV_V_SET_CONTROL, PR_RISCV_V_VSTATE_CTRL_ON);
EXPECT_EQ(-1, rc)
TH_LOG("SET_CONTROL should fail on kernel/hw without ZVE32X");
EXPECT_EQ(EINVAL, errno)
TH_LOG("SET_CONTROL should fail on kernel/hw without ZVE32X");
}
TEST(vstate_on_current)
{ long flag; long rc;
if (!is_vector_supported() && !is_xtheadvector_supported())
SKIP(return, "Vector not supported");
flag = PR_RISCV_V_VSTATE_CTRL_ON;
rc = prctl(PR_RISCV_V_SET_CONTROL, flag);
EXPECT_EQ(0, rc) TH_LOG("Enabling V for current should always succeed");
}
TEST(vstate_off_eperm)
{ long flag; long rc;
if (!is_vector_supported() && !is_xtheadvector_supported())
SKIP(return, "Vector not supported");
flag = PR_RISCV_V_VSTATE_CTRL_OFF;
rc = prctl(PR_RISCV_V_SET_CONTROL, flag);
EXPECT_EQ(EPERM, errno)
TH_LOG("Disabling V in current thread with V enabled must fail with EPERM(%d)", errno);
EXPECT_EQ(-1, rc)
TH_LOG("Disabling V in current thread with V enabled must fail with EPERM(%d)", errno);
}
TEST(vstate_on_no_nesting)
{ long flag; int xtheadvector = 0;
if (!is_vector_supported()) { if (is_xtheadvector_supported())
xtheadvector = 1; else
SKIP(return, "Vector not supported");
}
/* Turn on next's vector explicitly and test */
flag = PR_RISCV_V_VSTATE_CTRL_ON << PR_RISCV_V_VSTATE_CTRL_NEXT_SHIFT;
TEST(vstate_on_inherit_no_nesting)
{ long flag, expected; int xtheadvector = 0;
if (!is_vector_supported()) { if (is_xtheadvector_supported())
xtheadvector = 1; else
SKIP(return, "Vector not supported");
}
/* Turn on next's vector explicitly and test no inherit */
flag = PR_RISCV_V_VSTATE_CTRL_ON << PR_RISCV_V_VSTATE_CTRL_NEXT_SHIFT;
flag |= PR_RISCV_V_VSTATE_CTRL_INHERIT;
expected = flag | PR_RISCV_V_VSTATE_CTRL_ON;
TEST(vstate_on_inherit)
{ long flag, expected; int xtheadvector = 0;
if (!is_vector_supported()) { if (is_xtheadvector_supported())
xtheadvector = 1; else
SKIP(return, "Vector not supported");
}
/* Turn on next's vector explicitly and test inherit */
flag = PR_RISCV_V_VSTATE_CTRL_ON << PR_RISCV_V_VSTATE_CTRL_NEXT_SHIFT;
flag |= PR_RISCV_V_VSTATE_CTRL_INHERIT;
expected = flag | PR_RISCV_V_VSTATE_CTRL_ON;
TEST(vstate_off_inherit_no_nesting)
{ long flag, expected; int xtheadvector = 0;
if (!is_vector_supported()) { if (is_xtheadvector_supported())
xtheadvector = 1; else
SKIP(return, "Vector not supported");
} /* Turn off next's vector explicitly and test no inherit */
flag = PR_RISCV_V_VSTATE_CTRL_OFF << PR_RISCV_V_VSTATE_CTRL_NEXT_SHIFT;
flag |= PR_RISCV_V_VSTATE_CTRL_INHERIT;
expected = flag | PR_RISCV_V_VSTATE_CTRL_OFF;
TEST(vstate_off_inherit)
{ long flag, expected; int xtheadvector = 0;
if (!is_vector_supported()) { if (is_xtheadvector_supported())
xtheadvector = 1; else
SKIP(return, "Vector not supported");
}
/* Turn off next's vector explicitly and test inherit */
flag = PR_RISCV_V_VSTATE_CTRL_OFF << PR_RISCV_V_VSTATE_CTRL_NEXT_SHIFT;
flag |= PR_RISCV_V_VSTATE_CTRL_INHERIT;
expected = flag | PR_RISCV_V_VSTATE_CTRL_OFF;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.