From: Peng Liang <liangpeng10@huawei.com>
To: Andrew Jones <drjones@redhat.com>
Cc: zhang.zhanghailiang@huawei.com, kvm@vger.kernel.org,
maz@kernel.org, will@kernel.org, kvmarm@lists.cs.columbia.edu
Subject: Re: [RFC v2 0/7] kvm: arm64: emulate ID registers
Date: Fri, 18 Sep 2020 17:51:27 +0800 [thread overview]
Message-ID: <9847289d-c575-3ef6-4d6e-460227e8cc21@huawei.com> (raw)
In-Reply-To: <20200918080106.5c6jqarj3mhwi3mv@kamzik.brq.redhat.com>
On 9/18/2020 4:01 PM, Andrew Jones wrote:
> On Thu, Sep 17, 2020 at 08:00:54PM +0800, Peng Liang wrote:
>> In AArch64, guest will read the same values of the ID regsiters with
>> host. Both of them read the values from arm64_ftr_regs. This patch
>> series add support to emulate and configure ID registers so that we can
>> control the value of ID registers that guest read.
>>
>> v1 -> v2:
>> - save the ID registers in sysreg file instead of a new struct
>> - apply a checker before setting the value to the register
>> - add doc for new KVM_CAP_ARM_CPU_FEATURE
>>
>> Peng Liang (7):
>> arm64: add a helper function to traverse arm64_ftr_regs
>> arm64: introduce check_features
>> kvm: arm64: save ID registers to sys_regs file
>> kvm: arm64: introduce check_user
>> kvm: arm64: implement check_user for ID registers
>> kvm: arm64: make ID registers configurable
>> kvm: arm64: add KVM_CAP_ARM_CPU_FEATURE extension
>>
>> Documentation/virt/kvm/api.rst | 8 +
>> arch/arm64/include/asm/cpufeature.h | 4 +
>> arch/arm64/include/asm/kvm_coproc.h | 2 +
>> arch/arm64/include/asm/kvm_host.h | 3 +
>> arch/arm64/kernel/cpufeature.c | 36 +++
>> arch/arm64/kvm/arm.c | 3 +
>> arch/arm64/kvm/sys_regs.c | 481 +++++++++++++++++++++++++++-
>> arch/arm64/kvm/sys_regs.h | 6 +
>> include/uapi/linux/kvm.h | 1 +
>> 9 files changed, 532 insertions(+), 12 deletions(-)
>>
>> --
>> 2.26.2
>>
>
> Hi Peng,
>
> I'd much rather see a series of patches where each patch converts a single
> ID register from using ID_SANITISED() to having its own table entry, where
> its own set_user() and reset() functions take into account its features
> using high level arm64_ftr* functions. Any ID registers that can still
> share code can certainly do so with some post-conversion refactoring.
>
> Thanks,
> drew
>
> .
>
Hi Andrew,
Thank you for your advise. I'll rework the code to use different set_user()
for different ID registers (maybe some general registers still use shareing
set_user()) and check the value defined by user space in its own set_user in
next version.
But do we need to implement reset() for ID registers? I think ID registers
are read-only in guest and guest won't and can't change their values. And
after 03fdfb2690099 ("KVM: arm64: Don't write junk to sysregs on reset"),
we won't write junk to sysregs on reset. So their values won't change on
reset?
Thanks,
Peng
_______________________________________________
kvmarm mailing list
kvmarm@lists.cs.columbia.edu
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
WARNING: multiple messages have this Message-ID (diff)
From: Peng Liang <liangpeng10@huawei.com>
To: Andrew Jones <drjones@redhat.com>
Cc: <kvmarm@lists.cs.columbia.edu>, <kvm@vger.kernel.org>,
<maz@kernel.org>, <will@kernel.org>,
<zhang.zhanghailiang@huawei.com>, <xiexiangyou@huawei.com>
Subject: Re: [RFC v2 0/7] kvm: arm64: emulate ID registers
Date: Fri, 18 Sep 2020 17:51:27 +0800 [thread overview]
Message-ID: <9847289d-c575-3ef6-4d6e-460227e8cc21@huawei.com> (raw)
In-Reply-To: <20200918080106.5c6jqarj3mhwi3mv@kamzik.brq.redhat.com>
On 9/18/2020 4:01 PM, Andrew Jones wrote:
> On Thu, Sep 17, 2020 at 08:00:54PM +0800, Peng Liang wrote:
>> In AArch64, guest will read the same values of the ID regsiters with
>> host. Both of them read the values from arm64_ftr_regs. This patch
>> series add support to emulate and configure ID registers so that we can
>> control the value of ID registers that guest read.
>>
>> v1 -> v2:
>> - save the ID registers in sysreg file instead of a new struct
>> - apply a checker before setting the value to the register
>> - add doc for new KVM_CAP_ARM_CPU_FEATURE
>>
>> Peng Liang (7):
>> arm64: add a helper function to traverse arm64_ftr_regs
>> arm64: introduce check_features
>> kvm: arm64: save ID registers to sys_regs file
>> kvm: arm64: introduce check_user
>> kvm: arm64: implement check_user for ID registers
>> kvm: arm64: make ID registers configurable
>> kvm: arm64: add KVM_CAP_ARM_CPU_FEATURE extension
>>
>> Documentation/virt/kvm/api.rst | 8 +
>> arch/arm64/include/asm/cpufeature.h | 4 +
>> arch/arm64/include/asm/kvm_coproc.h | 2 +
>> arch/arm64/include/asm/kvm_host.h | 3 +
>> arch/arm64/kernel/cpufeature.c | 36 +++
>> arch/arm64/kvm/arm.c | 3 +
>> arch/arm64/kvm/sys_regs.c | 481 +++++++++++++++++++++++++++-
>> arch/arm64/kvm/sys_regs.h | 6 +
>> include/uapi/linux/kvm.h | 1 +
>> 9 files changed, 532 insertions(+), 12 deletions(-)
>>
>> --
>> 2.26.2
>>
>
> Hi Peng,
>
> I'd much rather see a series of patches where each patch converts a single
> ID register from using ID_SANITISED() to having its own table entry, where
> its own set_user() and reset() functions take into account its features
> using high level arm64_ftr* functions. Any ID registers that can still
> share code can certainly do so with some post-conversion refactoring.
>
> Thanks,
> drew
>
> .
>
Hi Andrew,
Thank you for your advise. I'll rework the code to use different set_user()
for different ID registers (maybe some general registers still use shareing
set_user()) and check the value defined by user space in its own set_user in
next version.
But do we need to implement reset() for ID registers? I think ID registers
are read-only in guest and guest won't and can't change their values. And
after 03fdfb2690099 ("KVM: arm64: Don't write junk to sysregs on reset"),
we won't write junk to sysregs on reset. So their values won't change on
reset?
Thanks,
Peng
next prev parent reply other threads:[~2020-09-18 9:51 UTC|newest]
Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-17 12:00 [RFC v2 0/7] kvm: arm64: emulate ID registers Peng Liang
2020-09-17 12:00 ` Peng Liang
2020-09-17 12:00 ` [RFC v2 1/7] arm64: add a helper function to traverse arm64_ftr_regs Peng Liang
2020-09-17 12:00 ` Peng Liang
2020-09-18 7:18 ` Andrew Jones
2020-09-18 7:18 ` Andrew Jones
2020-09-18 9:24 ` Peng Liang
2020-09-18 9:24 ` Peng Liang
2020-09-18 10:28 ` Andrew Jones
2020-09-18 10:28 ` Andrew Jones
2020-09-18 11:58 ` Peng Liang
2020-09-18 11:58 ` Peng Liang
2020-09-17 12:00 ` [RFC v2 2/7] arm64: introduce check_features Peng Liang
2020-09-17 12:00 ` Peng Liang
2020-09-18 7:30 ` Andrew Jones
2020-09-18 7:30 ` Andrew Jones
2020-09-18 9:25 ` Peng Liang
2020-09-18 9:25 ` Peng Liang
2020-09-17 12:00 ` [RFC v2 3/7] kvm: arm64: save ID registers to sys_regs file Peng Liang
2020-09-17 12:00 ` Peng Liang
2020-09-18 7:34 ` Andrew Jones
2020-09-18 7:34 ` Andrew Jones
2020-09-17 12:00 ` [RFC v2 4/7] kvm: arm64: introduce check_user Peng Liang
2020-09-17 12:00 ` Peng Liang
2020-09-18 7:41 ` Andrew Jones
2020-09-18 7:41 ` Andrew Jones
2020-09-18 9:25 ` Peng Liang
2020-09-18 9:25 ` Peng Liang
2020-09-17 12:00 ` [RFC v2 5/7] kvm: arm64: implement check_user for ID registers Peng Liang
2020-09-17 12:00 ` Peng Liang
2020-09-18 7:46 ` Andrew Jones
2020-09-18 7:46 ` Andrew Jones
2020-09-18 9:26 ` Peng Liang
2020-09-18 9:26 ` Peng Liang
2020-09-17 12:01 ` [RFC v2 6/7] kvm: arm64: make ID registers configurable Peng Liang
2020-09-17 12:01 ` Peng Liang
2020-09-18 7:50 ` Andrew Jones
2020-09-18 7:50 ` Andrew Jones
2020-09-18 9:26 ` Peng Liang
2020-09-18 9:26 ` Peng Liang
2020-09-17 12:01 ` [RFC v2 7/7] kvm: arm64: add KVM_CAP_ARM_CPU_FEATURE extension Peng Liang
2020-09-17 12:01 ` Peng Liang
2020-09-18 7:55 ` Andrew Jones
2020-09-18 7:55 ` Andrew Jones
2020-09-18 9:26 ` Peng Liang
2020-09-18 9:26 ` Peng Liang
2020-09-18 8:01 ` [RFC v2 0/7] kvm: arm64: emulate ID registers Andrew Jones
2020-09-18 8:01 ` Andrew Jones
2020-09-18 9:51 ` Peng Liang [this message]
2020-09-18 9:51 ` Peng Liang
2020-09-18 10:20 ` Andrew Jones
2020-09-18 10:20 ` Andrew Jones
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=9847289d-c575-3ef6-4d6e-460227e8cc21@huawei.com \
--to=liangpeng10@huawei.com \
--cc=drjones@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=kvmarm@lists.cs.columbia.edu \
--cc=maz@kernel.org \
--cc=will@kernel.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.