| To: | Ralf Baechle <ralf@linux-mips.org> |
|---|---|
| Subject: | [PATCH v3 1/3] Loongson-2F: Flush the branch target history such as BTB and RAS |
| From: | Wu Zhangjin <wuzhangjin@gmail.com> |
| Date: | Sat, 13 Mar 2010 12:34:15 +0800 |
| Cc: | linux-mips@linux-mips.org, Shinya Kuribayashi <shinya.kuribayashi@necel.com>, Wu Zhangjin <wuzhangjin@gmail.com> |
| Dkim-signature: | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:date :message-id:x-mailer:in-reply-to:references:in-reply-to:references :mime-version:content-type:content-transfer-encoding; bh=7ZXouYudrJmeK/+cVsboMRJmXpFppTKTJ7E8DejkODo=; b=bTJcgnAlEa2xWoKMd4NJpINHLIgzeFbEo1jWOZOnmgkLklRwM3+rsfLutVWRs28mDu JsBR3ULHfjhw22WNrAD3MOcnG+RaEU7TD5ay00uE4TQF5aiASAmtzdCFlY9n9KDg8B7H WDiutx3HGZFDf/hdP3wto71bInHEgaVr+lwA0= |
| Domainkey-signature: | a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :mime-version:content-type:content-transfer-encoding; b=G4sPRG+5/5EkJm/8GTFY4iOJOJb9gKdCaZKmphQNXz248P6FG6OW6goGLD13lQJgcV 8VZFBDWljwfXBSzMJ4mD4S0qKtFRKjJeMSBukETCGew9hoFBqR1eyHXpKl60lBlW2/ZV ZvvqoV9We6sjWDsDP783Aocs6kGVwEJZyb9z0= |
| In-reply-to: | <cover.1268453720.git.wuzhangjin@gmail.com> |
| In-reply-to: | <cover.1268453720.git.wuzhangjin@gmail.com> |
| Original-recipient: | rfc822;linux-mips@linux-mips.org |
| References: | <cover.1268453720.git.wuzhangjin@gmail.com> |
| References: | <cover.1268453720.git.wuzhangjin@gmail.com> |
| Sender: | linux-mips-bounce@linux-mips.org |
From: Wu Zhangjin <wuzhangjin@gmail.com> As the Chapter 15: "Errata: Issue of Out-of-order in loongson"[1] shows, to workaround the Issue of Loongson-2F,We need to do: "When switching from user mode to kernel mode, you should flush the branch target history such as BTB and RAS." This patch did clear BTB(branch target buffer), forbid RAS(return address stack) via Loongson-2F's 64bit diagnostic register. [1] Chinese Version: http://www.loongson.cn/uploadfile/file/200808211 [2] English Version of Chapter 15: http://groups.google.com.hk/group/loongson-dev/msg/e0d2e220958f10a6?dmode=source Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com> --- arch/mips/include/asm/stackframe.h | 19 +++++++++++++++++++ 1 files changed, 19 insertions(+), 0 deletions(-) diff --git a/arch/mips/include/asm/stackframe.h b/arch/mips/include/asm/stackframe.h index 3b6da33..c841912 100644 --- a/arch/mips/include/asm/stackframe.h +++ b/arch/mips/include/asm/stackframe.h @@ -121,6 +121,25 @@ .endm #else .macro get_saved_sp /* Uniprocessor variation */ +#ifdef CONFIG_CPU_LOONGSON2F + /* + * Clear BTB (branch target buffer), forbid RAS (return address + * stack) to workaround the Out-of-order Issue in Loongson2F + * via its diagnostic register. + */ + move k0, ra + jal 1f + nop +1: jal 1f + nop +1: jal 1f + nop +1: jal 1f + nop +1: move ra, k0 + li k0, 3 + mtc0 k0, $22 +#endif /* CONFIG_CPU_LOONGSON2F */ #if defined(CONFIG_32BIT) || defined(KBUILD_64BIT_SYM32) lui k1, %hi(kernelsp) #else -- 1.7.0.1 |
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | [PATCH v3 0/3] Workaround the Out-of-order Issue of Loongson-2F, Wu Zhangjin |
|---|---|
| Next by Date: | [PATCH v3 2/3] Loongson-2F: Enable fixups of binutils 2.20.1, Wu Zhangjin |
| Previous by Thread: | [PATCH v3 0/3] Workaround the Out-of-order Issue of Loongson-2F, Wu Zhangjin |
| Next by Thread: | Re: [PATCH v3 1/3] Loongson-2F: Flush the branch target history such as BTB and RAS, Ralf Baechle |
| Indexes: | [Date] [Thread] [Top] [All Lists] |