Commit 6468a66f authored by Wu Liliu's avatar Wu Liliu Committed by guzitao
Browse files

sw64: add junzhang_v1/2/3_key

Sunway inclusion
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/IB73UR



--------------------------------

Add junzhang_v1_key/junzhang_v2_key/junzhang_v3_key to identify
firmware junzhang/junzhang_v2/junzhang_v3.

Signed-off-by: default avatarWu Liliu <wuliliu@wxiat.com>
Reviewed-by: default avatarHe Sheng <hesheng@wxiat.com>
Signed-off-by: default avatarGu Zitao <guzitao@wxiat.com>
parent b2cebaeb
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -51,10 +51,16 @@ DECLARE_STATIC_KEY_FALSE(run_mode_guest_key);
DECLARE_STATIC_KEY_FALSE(run_mode_emul_key);

DECLARE_STATIC_KEY_FALSE(hw_una_enabled);
DECLARE_STATIC_KEY_FALSE(junzhang_v1_key);
DECLARE_STATIC_KEY_FALSE(junzhang_v2_key);
DECLARE_STATIC_KEY_FALSE(junzhang_v3_key);

#define is_in_host()		static_branch_likely(&run_mode_host_key)
#define is_in_guest()		static_branch_unlikely(&run_mode_guest_key)
#define is_in_emul()		static_branch_unlikely(&run_mode_emul_key)
#define is_guest_or_emul()	!static_branch_likely(&run_mode_host_key)
#define is_junzhang_v1()	static_branch_unlikely(&junzhang_v1_key)
#define is_junzhang_v2()	static_branch_likely(&junzhang_v2_key)
#define is_junzhang_v3()	static_branch_unlikely(&junzhang_v3_key)

#endif /* _ASM_SW64_HW_INIT_H */
+17 −0
Original line number Diff line number Diff line
@@ -86,6 +86,9 @@ DEFINE_STATIC_KEY_FALSE(run_mode_guest_key);
DEFINE_STATIC_KEY_FALSE(run_mode_emul_key);

DEFINE_STATIC_KEY_FALSE(hw_una_enabled);
DEFINE_STATIC_KEY_FALSE(junzhang_v1_key);
DEFINE_STATIC_KEY_FALSE(junzhang_v2_key);
DEFINE_STATIC_KEY_FALSE(junzhang_v3_key);

struct socket_desc_t socket_desc[MAX_NUMSOCKETS];
int memmap_nr;
@@ -500,6 +503,20 @@ static void __init setup_firmware_fdt(void)
		pr_info("EXTCLK: %llu Hz\n", sunway_extclk_hz);
	}

	if (sunway_machine_is_compatible("sunway,junzhang")) {
		static_branch_enable(&junzhang_v1_key);
		static_branch_disable(&junzhang_v2_key);
		static_branch_disable(&junzhang_v3_key);
	} else if (sunway_machine_is_compatible("sunway,junzhang_v2")) {
		static_branch_enable(&junzhang_v2_key);
		static_branch_disable(&junzhang_v1_key);
		static_branch_disable(&junzhang_v3_key);
	} else if (sunway_machine_is_compatible("sunway,junzhang_v3")) {
		static_branch_enable(&junzhang_v3_key);
		static_branch_disable(&junzhang_v1_key);
		static_branch_disable(&junzhang_v2_key);
	}

	name = of_flat_dt_get_machine_name();
	if (name)
		pr_info("DTB(from firmware): Machine model: %s\n", name);