From: Xiang Zheng <zhengxiang9@huawei.com>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: Eduardo Habkost <ehabkost@redhat.com>,
kvm-devel <kvm@vger.kernel.org>,
"Michael S. Tsirkin" <mst@redhat.com>,
wanghaibin.wang@huawei.com, Marcelo Tosatti <mtosatti@redhat.com>,
Linuxarm <linuxarm@huawei.com>,
QEMU Developers <qemu-devel@nongnu.org>,
gengdongjiu <gengdongjiu@huawei.com>,
Shannon Zhao <shannon.zhaosl@gmail.com>,
qemu-arm <qemu-arm@nongnu.org>, James Morse <james.morse@arm.com>,
Jonathan Cameron <jonathan.cameron@huawei.com>,
Igor Mammedov <imammedo@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>,
"xuwei \(O\)" <xuwei5@huawei.com>,
Laszlo Ersek <lersek@redhat.com>,
Richard Henderson <rth@twiddle.net>
Subject: Re: [PATCH v18 1/6] hw/arm/virt: Introduce RAS platform version and RAS machine option
Date: Sun, 29 Sep 2019 10:04:49 +0800 [thread overview]
Message-ID: <3d335a56-b90b-f8bb-cb05-95bf52ddade5@huawei.com> (raw)
In-Reply-To: <CAFEAcA9cQwAJfPBC9fRcxLZVzZqag0Si62nTBNwDPyQiPVwPcg@mail.gmail.com>
On 2019/9/27 22:02, Peter Maydell wrote:
> On Fri, 6 Sep 2019 at 09:33, Xiang Zheng <zhengxiang9@huawei.com> wrote:
>>
>> From: Dongjiu Geng <gengdongjiu@huawei.com>
>>
>> Support RAS Virtualization feature since version 4.2, disable it by
>> default in the old versions. Also add a machine option which allows user
>> to enable it explicitly.
>>
>> Signed-off-by: Dongjiu Geng <gengdongjiu@huawei.com>
>> Signed-off-by: Xiang Zheng <zhengxiang9@huawei.com>
>> ---
>> hw/arm/virt.c | 33 +++++++++++++++++++++++++++++++++
>> include/hw/arm/virt.h | 2 ++
>> 2 files changed, 35 insertions(+)
>>
>> diff --git a/hw/arm/virt.c b/hw/arm/virt.c
>> index d74538b021..e0451433c8 100644
>> --- a/hw/arm/virt.c
>> +++ b/hw/arm/virt.c
>> @@ -1783,6 +1783,20 @@ static void virt_set_its(Object *obj, bool value, Error **errp)
>> vms->its = value;
>> }
>>
>> +static bool virt_get_ras(Object *obj, Error **errp)
>> +{
>> + VirtMachineState *vms = VIRT_MACHINE(obj);
>> +
>> + return vms->ras;
>> +}
>> +
>> +static void virt_set_ras(Object *obj, bool value, Error **errp)
>> +{
>> + VirtMachineState *vms = VIRT_MACHINE(obj);
>> +
>> + vms->ras = value;
>> +}
>> +
>> static char *virt_get_gic_version(Object *obj, Error **errp)
>> {
>> VirtMachineState *vms = VIRT_MACHINE(obj);
>> @@ -2026,6 +2040,19 @@ static void virt_instance_init(Object *obj)
>> "Valid values are none and smmuv3",
>> NULL);
>>
>> + if (vmc->no_ras) {
>> + vms->ras = false;
>> + } else {
>> + /* Default disallows RAS instantiation */
>> + vms->ras = false;
>> + object_property_add_bool(obj, "ras", virt_get_ras,
>> + virt_set_ras, NULL);
>> + object_property_set_description(obj, "ras",
>> + "Set on/off to enable/disable "
>> + "RAS instantiation",
>> + NULL);
>> + }
>
> For a property which is disabled by default, you don't need
> to have a separate flag in the VirtMachineClass struct.
> Those are only needed for properties where we need the old machine
> types to have the property be 'off' but new machine types
> need to default to it be 'on'. Since vms->ras is false
> by default anyway, you can just have this part:
>
>> + /* Default disallows RAS instantiation */
>> + vms->ras = false;
>> + object_property_add_bool(obj, "ras", virt_get_ras,
>> + virt_set_ras, NULL);
>> + object_property_set_description(obj, "ras",
>> + "Set on/off to enable/disable "
>> + "RAS instantiation",
>> + NULL);
>
> Compare the 'vms->secure' flag and associated property
> for an example of this.
Thanks for pointing it out, I will remove the no_ras in the VirtMachineClass struct.
>
>> vms->irqmap = a15irqmap;
>>
>> virt_flash_create(vms);
>> @@ -2058,8 +2085,14 @@ DEFINE_VIRT_MACHINE_AS_LATEST(4, 2)
>>
>> static void virt_machine_4_1_options(MachineClass *mc)
>> {
>> + VirtMachineClass *vmc = VIRT_MACHINE_CLASS(OBJECT_CLASS(mc));
>> +
>> virt_machine_4_2_options(mc);
>> compat_props_add(mc->compat_props, hw_compat_4_1, hw_compat_4_1_len);
>> + /* Disable memory recovery feature for 4.1 as RAS support was
>> + * introduced with 4.2.
>> + */
>> + vmc->no_ras = true;
>> }
>> DEFINE_VIRT_MACHINE(4, 1)
>
> thanks
> -- PMM
>
> .
>
--
Thanks,
Xiang
next prev parent reply other threads:[~2019-09-29 2:06 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-06 8:31 [Qemu-devel] [PATCH v18 0/6] Add ARMv8 RAS virtualization support in QEMU Xiang Zheng
2019-09-06 8:31 ` [Qemu-devel] [PATCH v18 1/6] hw/arm/virt: Introduce RAS platform version and RAS machine option Xiang Zheng
2019-09-27 14:02 ` Peter Maydell
2019-09-29 2:04 ` Xiang Zheng [this message]
2019-09-06 8:31 ` [Qemu-devel] [PATCH v18 2/6] docs: APEI GHES generation and CPER record description Xiang Zheng
2019-09-19 13:25 ` Peter Maydell
2019-09-20 1:45 ` Xiang Zheng
2019-10-04 8:20 ` [Qemu-devel] " Igor Mammedov
2019-10-08 13:25 ` Xiang Zheng
2019-09-06 8:31 ` [Qemu-devel] [PATCH v18 3/6] ACPI: Add APEI GHES table generation support Xiang Zheng
2019-09-27 15:43 ` Michael S. Tsirkin
2019-10-08 6:00 ` Xiang Zheng
2019-10-08 7:45 ` Michael S. Tsirkin
2019-10-08 12:48 ` Xiang Zheng
2019-09-06 8:31 ` [Qemu-devel] [PATCH v18 4/6] KVM: Move hwpoison page related functions into include/sysemu/kvm_int.h Xiang Zheng
2019-09-27 13:19 ` [Qemu-arm] " Peter Maydell
2019-10-08 7:01 ` Xiang Zheng
2019-09-06 8:31 ` [Qemu-devel] [PATCH v18 5/6] target-arm: kvm64: inject synchronous External Abort Xiang Zheng
2019-09-27 13:33 ` Peter Maydell
2019-10-08 8:05 ` Xiang Zheng
2019-09-06 8:31 ` [Qemu-devel] [PATCH v18 6/6] target-arm: kvm64: handle SIGBUS signal from kernel or KVM Xiang Zheng
2019-09-27 13:57 ` Peter Maydell
2019-10-08 12:42 ` Xiang Zheng
2019-09-17 12:39 ` [Qemu-devel] [PATCH v18 0/6] Add ARMv8 RAS virtualization support in QEMU Xiang Zheng
2019-09-20 2:07 ` gengdongjiu
2019-09-27 14:03 ` [Qemu-arm] " Peter Maydell
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=3d335a56-b90b-f8bb-cb05-95bf52ddade5@huawei.com \
--to=zhengxiang9@huawei.com \
--cc=ehabkost@redhat.com \
--cc=gengdongjiu@huawei.com \
--cc=imammedo@redhat.com \
--cc=james.morse@arm.com \
--cc=jonathan.cameron@huawei.com \
--cc=kvm@vger.kernel.org \
--cc=lersek@redhat.com \
--cc=linuxarm@huawei.com \
--cc=mst@redhat.com \
--cc=mtosatti@redhat.com \
--cc=pbonzini@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=rth@twiddle.net \
--cc=shannon.zhaosl@gmail.com \
--cc=wanghaibin.wang@huawei.com \
--cc=xuwei5@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).