linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Yifei Jiang <jiangyifei@huawei.com>
To: <paul.walmsley@sifive.com>, <palmer@dabbelt.com>,
	<aou@eecs.berkeley.edu>, <anup.patel@wdc.com>,
	<alistair.francis@wdc.com>, <atish.patra@wdc.com>,
	<deepa.kernel@gmail.com>
Cc: <kvm-riscv@lists.infradead.org>, <kvm@vger.kernel.org>,
	<linux-riscv@lists.infradead.org>, <linux-kernel@vger.kernel.org>,
	<victor.zhangxiaofeng@huawei.com>, <wu.wubin@huawei.com>,
	<zhang.zhanghailiang@huawei.com>, <dengkai1@huawei.com>,
	<yinyipeng1@huawei.com>, Yifei Jiang <jiangyifei@huawei.com>
Subject: [PATCH RFC 1/2] riscv/kvm: Fix use VSIP_VALID_MASK mask HIP register
Date: Thu, 27 Aug 2020 16:22:50 +0800	[thread overview]
Message-ID: <20200827082251.1591-2-jiangyifei@huawei.com> (raw)
In-Reply-To: <20200827082251.1591-1-jiangyifei@huawei.com>

The correct sip/sie 0x222 could mask wrong 0x000 by VSIP_VALID_MASK,
This patch fix it.

Signed-off-by: Yifei Jiang <jiangyifei@huawei.com>
Signed-off-by: Yipeng Yin <yinyipeng1@huawei.com>
---
 arch/riscv/kvm/vcpu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/riscv/kvm/vcpu.c b/arch/riscv/kvm/vcpu.c
index adb0815951aa..2976666e921f 100644
--- a/arch/riscv/kvm/vcpu.c
+++ b/arch/riscv/kvm/vcpu.c
@@ -419,8 +419,8 @@ static int kvm_riscv_vcpu_set_reg_csr(struct kvm_vcpu *vcpu,
 
 	if (reg_num == KVM_REG_RISCV_CSR_REG(sip) ||
 	    reg_num == KVM_REG_RISCV_CSR_REG(sie)) {
-		reg_val = reg_val << VSIP_TO_HVIP_SHIFT;
 		reg_val = reg_val & VSIP_VALID_MASK;
+		reg_val = reg_val << VSIP_TO_HVIP_SHIFT;
 	}
 
 	((unsigned long *)csr)[reg_num] = reg_val;
-- 
2.19.1



  reply	other threads:[~2020-08-27  8:23 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-27  8:22 [PATCH RFC 0/2] Add log dirty support Yifei Jiang
2020-08-27  8:22 ` Yifei Jiang [this message]
2020-08-28  4:47   ` [PATCH RFC 1/2] riscv/kvm: Fix use VSIP_VALID_MASK mask HIP register Anup Patel
2020-08-27  8:22 ` [PATCH RFC 2/2] target/kvm: Add interfaces needed for log dirty Yifei Jiang
2020-08-28  4:53   ` Anup Patel
2020-08-31  2:39     ` Jiangyifei
2020-09-01 15:20       ` Anup Patel
2020-09-04  8:29         ` Jiangyifei

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200827082251.1591-2-jiangyifei@huawei.com \
    --to=jiangyifei@huawei.com \
    --cc=alistair.francis@wdc.com \
    --cc=anup.patel@wdc.com \
    --cc=aou@eecs.berkeley.edu \
    --cc=atish.patra@wdc.com \
    --cc=deepa.kernel@gmail.com \
    --cc=dengkai1@huawei.com \
    --cc=kvm-riscv@lists.infradead.org \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=palmer@dabbelt.com \
    --cc=paul.walmsley@sifive.com \
    --cc=victor.zhangxiaofeng@huawei.com \
    --cc=wu.wubin@huawei.com \
    --cc=yinyipeng1@huawei.com \
    --cc=zhang.zhanghailiang@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).