Subject: linux-next: manual merge of the risc-v tree with Linus' tree

From: Stephen Rothwell <[email-masked]>
Date: Fri, 31 Jan 2025 11:39:11 +1100

Hi all,

Today's linux-next merge of the risc-v tree got a conflict in:

  tools/testing/selftests/riscv/vector/vstate_prctl.c

between commit:

  ebdc22c51ace ("tools: selftests: riscv: Add test count for vstate_prctl")

from Linus' tree and commits:

  57d7713af93e ("selftests: riscv: Fix vector tests")
  c384c5d4a2ae ("selftests: riscv: Support xtheadvector in vector tests")

from the risc-v tree.

I fixed it up (see below) and can carry the fix as necessary. This
is now fixed as far as linux-next is concerned, but any non trivial
conflicts should be mentioned to your upstream maintainer when your tree
is submitted for merging.  You may also want to consider cooperating
with the maintainer of the conflicting tree to minimise any particularly
complex conflicts.

-- 
Cheers,
Stephen Rothwell

diff --cc tools/testing/selftests/riscv/vector/vstate_prctl.c
index 40b3bffcbb40,62fbb17a0556..000000000000
--- a/tools/testing/selftests/riscv/vector/vstate_prctl.c
+++ b/tools/testing/selftests/riscv/vector/vstate_prctl.c
@@@ -67,45 -29,44 +29,46 @@@ int test_and_compare_child(long provide
  	return 0;
  }
  
- #define PR_RISCV_V_VSTATE_CTRL_CUR_SHIFT	0
- #define PR_RISCV_V_VSTATE_CTRL_NEXT_SHIFT	2
+ #define PR_RISCV_V_VSTATE_CTRL_CUR_SHIFT 0
+ #define PR_RISCV_V_VSTATE_CTRL_NEXT_SHIFT 2
  
- int main(void)
+ TEST(get_control_no_v)
  {
- 	struct riscv_hwprobe pair;
- 	long flag, expected;
  	long rc;
  
 +	ksft_set_plan(1);
 +
- 	pair.key = RISCV_HWPROBE_KEY_IMA_EXT_0;
- 	rc = riscv_hwprobe(&pair, 1, 0, NULL, 0);
- 	if (rc < 0) {
- 		ksft_test_result_fail("hwprobe() failed with %ld\n", rc);
- 		return -1;
- 	}
+ 	if (is_vector_supported() || is_xtheadvector_supported())
+ 		SKIP(return, "Test expects vector to be not supported");
  
- 	if (pair.key != RISCV_HWPROBE_KEY_IMA_EXT_0) {
- 		ksft_test_result_fail("hwprobe cannot probe RISCV_HWPROBE_KEY_IMA_EXT_0\n");
- 		return -2;
- 	}
+ 	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");
+ }
  
- 	if (!(pair.value & RISCV_HWPROBE_EXT_ZVE32X)) {
- 		rc = prctl(PR_RISCV_V_GET_CONTROL);
- 		if (rc != -1 || errno != EINVAL) {
- 			ksft_test_result_fail("GET_CONTROL should fail on kernel/hw without ZVE32X\n");
- 			return -3;
- 		}
+ TEST(set_control_no_v)
+ {
+ 	long rc;
  
- 		rc = prctl(PR_RISCV_V_SET_CONTROL, PR_RISCV_V_VSTATE_CTRL_ON);
- 		if (rc != -1 || errno != EINVAL) {
- 			ksft_test_result_fail("SET_CONTROL should fail on kernel/hw without ZVE32X\n");
- 			return -4;
- 		}
+ 	if (is_vector_supported() || is_xtheadvector_supported())
+ 		SKIP(return, "Test expects vector to be not supported");
  
- 		ksft_test_result_skip("Vector not supported\n");
- 		return 0;
- 	}
+ 	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);