From patchwork Fri Sep 6 08:31:47 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiang Zheng X-Patchwork-Id: 1158873 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=nongnu.org (client-ip=209.51.188.17; helo=lists.gnu.org; envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=huawei.com Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46PrSr5714z9s3Z for ; Fri, 6 Sep 2019 18:34:20 +1000 (AEST) Received: from localhost ([::1]:53504 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i69hB-00023I-Dt for incoming@patchwork.ozlabs.org; Fri, 06 Sep 2019 04:34:17 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50207) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1i69gP-0001zd-1P for qemu-devel@nongnu.org; Fri, 06 Sep 2019 04:33:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1i69gN-0005br-Bf for qemu-devel@nongnu.org; Fri, 06 Sep 2019 04:33:28 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:51114 helo=huawei.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1i69gI-0005WM-Tp; Fri, 06 Sep 2019 04:33:23 -0400 Received: from DGGEMS403-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id B1284F9680A2F91B9579; Fri, 6 Sep 2019 16:33:15 +0800 (CST) Received: from HGHY1z004218071.china.huawei.com (10.177.29.32) by DGGEMS403-HUB.china.huawei.com (10.3.19.203) with Microsoft SMTP Server id 14.3.439.0; Fri, 6 Sep 2019 16:33:08 +0800 From: Xiang Zheng To: , , , , , , , , , , , , , , , , Date: Fri, 6 Sep 2019 16:31:47 +0800 Message-ID: <20190906083152.25716-2-zhengxiang9@huawei.com> X-Mailer: git-send-email 2.15.1.windows.2 In-Reply-To: <20190906083152.25716-1-zhengxiang9@huawei.com> References: <20190906083152.25716-1-zhengxiang9@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.177.29.32] X-CFilter-Loop: Reflected X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 45.249.212.35 Subject: [Qemu-devel] [PATCH v18 1/6] hw/arm/virt: Introduce RAS platform version and RAS machine option X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: wanghaibin.wang@huawei.com, zhengxiang9@huawei.com Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" From: Dongjiu Geng 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 Signed-off-by: Xiang Zheng --- 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); + } + 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) diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h index a72094204e..04ab42ca42 100644 --- a/include/hw/arm/virt.h +++ b/include/hw/arm/virt.h @@ -103,6 +103,7 @@ typedef struct { bool disallow_affinity_adjustment; bool no_its; bool no_pmu; + bool no_ras; bool claim_edge_triggered_timers; bool smbios_old_sys_ver; bool no_highmem_ecam; @@ -119,6 +120,7 @@ typedef struct { bool highmem_ecam; bool its; bool virt; + bool ras; int32_t gic_version; VirtIOMMUType iommu; struct arm_boot_info bootinfo;