Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 817d3dd2 authored by qctecmdr Service's avatar qctecmdr Service Committed by Gerrit - the friendly Code Review server
Browse files

Merge "scsi: ufs: add UFS fault injection to hibernate enter and exit"

parents 68a9943c 4ab7ea4d
Loading
Loading
Loading
Loading
+22 −0
Original line number Diff line number Diff line
@@ -100,6 +100,16 @@ static const int err_inject_query_err_codes[] = {
	0xFF,
};

static const int err_inject_hibern8_err_codes[] = {
	-EIO,
	-ETIMEDOUT,
	-1,
	PWR_REMOTE,
	PWR_BUSY,
	PWR_ERROR_CAP,
	PWR_FATAL_ERROR,
};

static struct ufsdbg_err_scenario err_scen_arr[] = {
	{
		"ERR_INJECT_INTR",
@@ -126,6 +136,16 @@ static struct ufsdbg_err_scenario err_scen_arr[] = {
		err_inject_query_err_codes,
		ARRAY_SIZE(err_inject_query_err_codes),
	},
	{
		"ERR_INJECT_HIBERN8_ENTER",
		err_inject_hibern8_err_codes,
		ARRAY_SIZE(err_inject_hibern8_err_codes),
	},
	{
		"ERR_INJECT_HIBERN8_EXIT",
		err_inject_hibern8_err_codes,
		ARRAY_SIZE(err_inject_hibern8_err_codes),
	},
};

static bool inject_fatal_err_tr(struct ufs_hba *hba, u8 ocs_err)
@@ -281,6 +301,8 @@ void ufsdbg_error_inject_dispatcher(struct ufs_hba *hba,
	case ERR_INJECT_UIC:
	case ERR_INJECT_DME_ATTR:
	case ERR_INJECT_QUERY:
	case ERR_INJECT_HIBERN8_ENTER:
	case ERR_INJECT_HIBERN8_EXIT:
		goto should_fail;
	default:
		dev_err(hba->dev, "%s: unsupported error scenario\n",
+3 −1
Original line number Diff line number Diff line
/* Copyright (c) 2013-2016, The Linux Foundation. All rights reserved.
/* Copyright (c) 2013-2016, 2018, The Linux Foundation. All rights reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 and
@@ -29,6 +29,8 @@ enum ufsdbg_err_inject_scenario {
	ERR_INJECT_UIC,
	ERR_INJECT_DME_ATTR,
	ERR_INJECT_QUERY,
	ERR_INJECT_HIBERN8_ENTER,
	ERR_INJECT_HIBERN8_EXIT,
	ERR_INJECT_MAX_ERR_SCENARIOS,
};

+4 −0
Original line number Diff line number Diff line
@@ -5190,6 +5190,8 @@ static int __ufshcd_uic_hibern8_enter(struct ufs_hba *hba)
	trace_ufshcd_profile_hibern8(dev_name(hba->dev), "enter",
			     ktime_to_us(ktime_sub(ktime_get(), start)), ret);

	ufsdbg_error_inject_dispatcher(hba, ERR_INJECT_HIBERN8_ENTER, 0, &ret);

	/*
	 * Do full reinit if enter failed or if LINERESET was detected during
	 * Hibern8 operation. After LINERESET, link moves to default PWM-G1
@@ -5255,6 +5257,8 @@ int ufshcd_uic_hibern8_exit(struct ufs_hba *hba)
	trace_ufshcd_profile_hibern8(dev_name(hba->dev), "exit",
			     ktime_to_us(ktime_sub(ktime_get(), start)), ret);

	ufsdbg_error_inject_dispatcher(hba, ERR_INJECT_HIBERN8_EXIT, 0, &ret);

	/* Do full reinit if exit failed */
	if (ret) {
		ufshcd_update_error_stats(hba, UFS_ERR_HIBERN8_EXIT);