From patchwork Fri Mar 8 11:42:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shameerali Kolothum Thodi X-Patchwork-Id: 159973 Delivered-To: patch@linaro.org Received: by 2002:a02:5cc1:0:0:0:0:0 with SMTP id w62csp8613065jad; Fri, 8 Mar 2019 03:51:46 -0800 (PST) X-Google-Smtp-Source: APXvYqyXHqgLtPEV87LfLQQ2KnriprZNTvotG2wG9q1ovpPRD6B4si4DPZ9j7Z+A5r8QLv3ouOWw X-Received: by 2002:a81:7c05:: with SMTP id x5mr1181091ywc.168.1552045906301; Fri, 08 Mar 2019 03:51:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1552045906; cv=none; d=google.com; s=arc-20160816; b=CJw0EwVEDfjEpmsgxG3o6fagWtv1SjCVR1XZqQkU4ipVyaTGlYuyP6DcpbW/2/i8n0 E8rQGPGF/+ajWZ/rr+w/d/71U8j1Guq8rjeqm7QfM5mnn6haiV53VK5HMP0MtcCtk1VY i0CK7j4WDYZ59zB5bdH9bVrNGBEzwL7XLGKTRLWAE9Zr787V3A07eTNZd5tHgEvo/pV6 1K4XUN2A2w4NzWl9J9VXPEyE6i2Jv9qXS0UjxyF1FvZ1/DBYsbeaOkTAQG+BKXAYy+SL HmaAi6e2HBulX+0UJhpWmgLgiFdSn/2mrN5Slor7ZNfNm/hRkvnnJ8R4zak/dKFobrSe nKjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject:mime-version:references :in-reply-to:message-id:date:to:from; bh=qUFxfLue9kPDLmQXqjTNvy7+EG4wwjc7T8u3YWDLtyg=; b=AFek+Q/o56MxkAr4sdHPoCdriWewG89h/gnKPvMEENEo6cVPUDBAFwvzMZQgHFg+lk yH6o+0MMxwg46R7yj6NX88C/hcgyimV+1m3hsHha8miwEcuiR67kBCLYEMRpE6ZGW9PV pCJ9sJIbrTWpMzu4qXDxNiUKKtjG5uh/FJNgfaa8tATNapDlv0gh52RnrtQBfyXGRecm bWdLJEmsjPaDU/OyDoqqjkq5sK2ew5anFLZ6lVXNQeS2jlqzgsFIU+ZcCdpJs6+X80rk HOSA31AGeO1jxbBTUcu1kqEA7KOdF7synhrelHX2IIeeIC1qNtNM+kikW9RQSlxsMVZ5 38XA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id s130si4169800ybb.107.2019.03.08.03.51.46 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 08 Mar 2019 03:51:46 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org" Received: from localhost ([127.0.0.1]:41591 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h2E2Q-0004K3-M5 for patch@linaro.org; Fri, 08 Mar 2019 06:51:42 -0500 Received: from eggs.gnu.org ([209.51.188.92]:40454) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h2DvZ-0008Bk-4o for qemu-devel@nongnu.org; Fri, 08 Mar 2019 06:44:39 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h2DvX-0005Xf-EH for qemu-devel@nongnu.org; Fri, 08 Mar 2019 06:44:37 -0500 Received: from szxga07-in.huawei.com ([45.249.212.35]:43388 helo=huawei.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h2DvU-00051I-3q; Fri, 08 Mar 2019 06:44:32 -0500 Received: from DGGEMS410-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 281A5CF44E85DC7BA650; Fri, 8 Mar 2019 19:44:28 +0800 (CST) Received: from S00345302A-PC.china.huawei.com (10.202.227.237) by DGGEMS410-HUB.china.huawei.com (10.3.19.210) with Microsoft SMTP Server id 14.3.408.0; Fri, 8 Mar 2019 19:44:17 +0800 From: Shameer Kolothum To: , , , , , , , Date: Fri, 8 Mar 2019 11:42:11 +0000 Message-ID: <20190308114218.26692-5-shameerali.kolothum.thodi@huawei.com> X-Mailer: git-send-email 2.12.0.windows.1 In-Reply-To: <20190308114218.26692-1-shameerali.kolothum.thodi@huawei.com> References: <20190308114218.26692-1-shameerali.kolothum.thodi@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.202.227.237] 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 v2 04/11] hw/arm/virt: Add virtual ACPI device X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linuxarm@huawei.com, xuwei5@hisilicon.com Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Samuel Ortiz This is to provide an acpi device interface for Arm/virt. This will be used by Arm/Virt to add hotplug support via ACPI GED device. Signed-off-by: Samuel Ortiz Signed-off-by: Shameer Kolothum --- hw/arm/Makefile.objs | 2 +- hw/arm/virt-acpi.c | 111 ++++++++++++++++++++++++++++++++++++++++++++++++++ include/hw/arm/virt.h | 1 + 3 files changed, 113 insertions(+), 1 deletion(-) create mode 100644 hw/arm/virt-acpi.c -- 2.7.4 diff --git a/hw/arm/Makefile.objs b/hw/arm/Makefile.objs index fa57c7c..e0db3cd 100644 --- a/hw/arm/Makefile.objs +++ b/hw/arm/Makefile.objs @@ -1,6 +1,6 @@ obj-y += boot.o sysbus-fdt.o obj-$(CONFIG_ARM_VIRT) += virt.o -obj-$(CONFIG_ACPI) += virt-acpi-build.o +obj-$(CONFIG_ACPI) += virt-acpi-build.o virt-acpi.o obj-$(CONFIG_DIGIC) += digic_boards.o obj-$(CONFIG_EXYNOS4) += exynos4_boards.o obj-$(CONFIG_HIGHBANK) += highbank.o diff --git a/hw/arm/virt-acpi.c b/hw/arm/virt-acpi.c new file mode 100644 index 0000000..df8a02b --- /dev/null +++ b/hw/arm/virt-acpi.c @@ -0,0 +1,111 @@ +/* + * + * Copyright (c) 2018 Intel Corporation + * + * This program is free software; you can redistribute it and/or modify it + * under the terms and conditions of the GNU General Public License, + * version 2 or later, as published by the Free Software Foundation. + * + * This program is distributed in the hope it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program. If not, see . + */ + +#include "qemu/osdep.h" +#include "qemu/range.h" +#include "qapi/error.h" +#include "exec/address-spaces.h" + +#include "hw/hw.h" +#include "hw/hotplug.h" +#include "hw/sysbus.h" +#include "hw/arm/virt.h" + +#include "hw/acpi/acpi.h" + +typedef struct VirtAcpiState { + SysBusDevice parent_obj; +} VirtAcpiState; + +#define TYPE_VIRT_ACPI "virt-acpi" +#define VIRT_ACPI(obj) \ + OBJECT_CHECK(VirtAcpiState, (obj), TYPE_VIRT_ACPI) + +static const VMStateDescription vmstate_acpi = { + .name = "virt_acpi", + .version_id = 1, + .minimum_version_id = 1, +}; + +static void virt_device_plug_cb(HotplugHandler *hotplug_dev, + DeviceState *dev, Error **errp) +{ +} + +static void virt_device_unplug_request_cb(HotplugHandler *hotplug_dev, + DeviceState *dev, Error **errp) +{ +} + +static void virt_device_unplug_cb(HotplugHandler *hotplug_dev, + DeviceState *dev, Error **errp) +{ +} + +static void virt_send_ged(AcpiDeviceIf *adev, AcpiEventStatusBits ev) +{ +} + +static void virt_device_realize(DeviceState *dev, Error **errp) +{ +} + +DeviceState *virt_acpi_init(void) +{ + return sysbus_create_simple(TYPE_VIRT_ACPI, -1, NULL); +} + +static Property virt_acpi_properties[] = { + DEFINE_PROP_END_OF_LIST(), +}; + +static void virt_acpi_class_init(ObjectClass *class, void *data) +{ + DeviceClass *dc = DEVICE_CLASS(class); + HotplugHandlerClass *hc = HOTPLUG_HANDLER_CLASS(class); + AcpiDeviceIfClass *adevc = ACPI_DEVICE_IF_CLASS(class); + + dc->desc = "ACPI"; + dc->vmsd = &vmstate_acpi; + dc->props = virt_acpi_properties; + dc->realize = virt_device_realize; + + hc->plug = virt_device_plug_cb; + hc->unplug_request = virt_device_unplug_request_cb; + hc->unplug = virt_device_unplug_cb; + + adevc->send_event = virt_send_ged; +} + +static const TypeInfo virt_acpi_info = { + .name = TYPE_VIRT_ACPI, + .parent = TYPE_SYS_BUS_DEVICE, + .instance_size = sizeof(VirtAcpiState), + .class_init = virt_acpi_class_init, + .interfaces = (InterfaceInfo[]) { + { TYPE_HOTPLUG_HANDLER }, + { TYPE_ACPI_DEVICE_IF }, + { } + } +}; + +static void virt_acpi_register_types(void) +{ + type_register_static(&virt_acpi_info); +} + +type_init(virt_acpi_register_types) diff --git a/include/hw/arm/virt.h b/include/hw/arm/virt.h index 507517c..6076167 100644 --- a/include/hw/arm/virt.h +++ b/include/hw/arm/virt.h @@ -145,6 +145,7 @@ typedef struct { OBJECT_CLASS_CHECK(VirtMachineClass, klass, TYPE_VIRT_MACHINE) void virt_acpi_setup(VirtMachineState *vms); +DeviceState *virt_acpi_init(void); /* Return the number of used redistributor regions */ static inline int virt_gicv3_redist_region_count(VirtMachineState *vms)