From patchwork Thu Mar 21 10:47:38 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: 10863303 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 4FDC31575 for ; Thu, 21 Mar 2019 11:01:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 334C028B26 for ; Thu, 21 Mar 2019 11:01:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 276E72A0C0; Thu, 21 Mar 2019 11:01:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9ADC428B26 for ; Thu, 21 Mar 2019 11:01:21 +0000 (UTC) Received: from localhost ([127.0.0.1]:34882 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h6vRp-0004BS-0e for patchwork-qemu-devel@patchwork.kernel.org; Thu, 21 Mar 2019 07:01:21 -0400 Received: from eggs.gnu.org ([209.51.188.92]:46974) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1h6vHf-0004Og-O3 for qemu-devel@nongnu.org; Thu, 21 Mar 2019 06:50:53 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1h6vFu-0001pL-Kw for qemu-devel@nongnu.org; Thu, 21 Mar 2019 06:49:04 -0400 Received: from szxga07-in.huawei.com ([45.249.212.35]:56392 helo=huawei.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1h6vFs-0001H6-2p; Thu, 21 Mar 2019 06:49:00 -0400 Received: from DGGEMS414-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 9E29957B498EFBCAD080; Thu, 21 Mar 2019 18:48:57 +0800 (CST) Received: from S00345302A-PC.china.huawei.com (10.202.227.237) by DGGEMS414-HUB.china.huawei.com (10.3.19.214) with Microsoft SMTP Server id 14.3.408.0; Thu, 21 Mar 2019 18:48:47 +0800 From: Shameer Kolothum To: , , , , , , , Date: Thu, 21 Mar 2019 10:47:38 +0000 Message-ID: <20190321104745.28068-4-shameerali.kolothum.thodi@huawei.com> X-Mailer: git-send-email 2.12.0.windows.1 In-Reply-To: <20190321104745.28068-1-shameerali.kolothum.thodi@huawei.com> References: <20190321104745.28068-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 v3 03/10] 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+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Samuel Ortiz This adds the skeleton to support an acpi device interface for HW-reduced acpi platforms via ACPI GED - Generic Event Device (ACPI v6.1 5.6.9). This will be used by Arm/Virt to add hotplug support. Signed-off-by: Samuel Ortiz Signed-off-by: Shameer Kolothum --- hw/acpi/Kconfig | 4 ++ hw/acpi/Makefile.objs | 1 + hw/acpi/generic_event_device.c | 72 ++++++++++++++++++++++++++++++++++ include/hw/acpi/generic_event_device.h | 29 ++++++++++++++ 4 files changed, 106 insertions(+) create mode 100644 hw/acpi/generic_event_device.c create mode 100644 include/hw/acpi/generic_event_device.h diff --git a/hw/acpi/Kconfig b/hw/acpi/Kconfig index eca3bee..01a8b41 100644 --- a/hw/acpi/Kconfig +++ b/hw/acpi/Kconfig @@ -27,3 +27,7 @@ config ACPI_VMGENID bool default y depends on PC + +config ACPI_HW_REDUCED + bool + depends on ACPI diff --git a/hw/acpi/Makefile.objs b/hw/acpi/Makefile.objs index 2d46e37..b753232 100644 --- a/hw/acpi/Makefile.objs +++ b/hw/acpi/Makefile.objs @@ -6,6 +6,7 @@ common-obj-$(CONFIG_ACPI_MEMORY_HOTPLUG) += memory_hotplug.o common-obj-$(CONFIG_ACPI_CPU_HOTPLUG) += cpu.o common-obj-$(CONFIG_ACPI_NVDIMM) += nvdimm.o common-obj-$(CONFIG_ACPI_VMGENID) += vmgenid.o +common-obj-$(CONFIG_ACPI_HW_REDUCED) += generic_event_device.o common-obj-$(call lnot,$(CONFIG_ACPI_X86)) += acpi-stub.o common-obj-y += acpi_interface.o diff --git a/hw/acpi/generic_event_device.c b/hw/acpi/generic_event_device.c new file mode 100644 index 0000000..b21a551 --- /dev/null +++ b/hw/acpi/generic_event_device.c @@ -0,0 +1,72 @@ +/* + * + * 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 "hw/sysbus.h" +#include "hw/acpi/acpi.h" +#include "hw/acpi/generic_event_device.h" + +static void virt_device_plug_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) +{ +} + +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->props = virt_acpi_properties; + dc->realize = virt_device_realize; + + hc->plug = virt_device_plug_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/acpi/generic_event_device.h b/include/hw/acpi/generic_event_device.h new file mode 100644 index 0000000..f314515 --- /dev/null +++ b/include/hw/acpi/generic_event_device.h @@ -0,0 +1,29 @@ +/* + * + * 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 . + */ + +#ifndef HW_ACPI_GED_H +#define HW_ACPI_GED_H + +#define TYPE_VIRT_ACPI "virt-acpi" +#define VIRT_ACPI(obj) \ + OBJECT_CHECK(VirtAcpiState, (obj), TYPE_VIRT_ACPI) + +typedef struct VirtAcpiState { + SysBusDevice parent_obj; +} VirtAcpiState; + +#endif