From patchwork Tue Sep 24 15:21:51 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heyi Guo X-Patchwork-Id: 11159109 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 7612613B1 for ; Tue, 24 Sep 2019 15:27:35 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 537A0214DA for ; Tue, 24 Sep 2019 15:27:35 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="fRJk7AIE" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 537A0214DA Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=huawei.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=B5A8r6zI4myBmYPYmWL1YXBNAfltRTyh0sc2E+qpHo4=; b=fRJk7AIElEmp63 uGjNgQzM7r9GnOFapr97wGuDgZTlOXkd52GUSRY7oDlnQZWyFDcIC683JRlMZ9nSCPZ42hJUJkNfV eZxnxLTyQUQOlTJtoXozupm2WSh93rK4P2fF/7TE+Quio4NpjrAiTL3g4ZPCZ5hNOiQjDvr53+Fqo T3Xe4mj+4POqXe/cd8mdh+NmRZrGP7VKe5xjXt/+pD4ZTNn+N+3IkJIzMscIHeWwJnYllZnaQCrAa pV5S4E5c3/6e+z4bXuX1vG3d61pjIkFvehrnckXpE9uyIrOM4Hcr247nd7ufbAY68U1Qup4a0LerZ Icf3NBg8ZjKfb/IrKfHA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.2 #3 (Red Hat Linux)) id 1iCmj0-0007Ua-N7; Tue, 24 Sep 2019 15:27:34 +0000 Received: from szxga07-in.huawei.com ([45.249.212.35] helo=huawei.com) by bombadil.infradead.org with esmtps (Exim 4.92.2 #3 (Red Hat Linux)) id 1iCmf9-0003AQ-HV for linux-arm-kernel@lists.infradead.org; Tue, 24 Sep 2019 15:23:37 +0000 Received: from DGGEMS409-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id 683D193003537AC7CFD4; Tue, 24 Sep 2019 23:23:32 +0800 (CST) Received: from linux-Bxxcye.huawei.com (10.175.104.222) by DGGEMS409-HUB.china.huawei.com (10.3.19.209) with Microsoft SMTP Server id 14.3.439.0; Tue, 24 Sep 2019 23:23:22 +0800 From: Heyi Guo To: , , , Subject: [RFC PATCH 12/12] virt/acpi: add SDEI table if SDEI is enabled Date: Tue, 24 Sep 2019 23:21:51 +0800 Message-ID: <1569338511-3572-13-git-send-email-guoheyi@huawei.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1569338511-3572-1-git-send-email-guoheyi@huawei.com> References: <1569338511-3572-1-git-send-email-guoheyi@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.175.104.222] X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190924_082336_099380_BDEC79FF X-CRM114-Status: UNSURE ( 9.68 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.3 (--) X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary: Content analysis details: (-2.3 points) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [45.249.212.35 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , Peter Maydell , "Michael S. Tsirkin" , Marc Zyngier , Shannon Zhao , James Morse , Igor Mammedov , Heyi Guo , wanghaibin.wang@huawei.com, Dave Martin Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org Add SDEI table if SDEI is enabled, so that guest OS can get aware and utilize the interfaces. Signed-off-by: Heyi Guo Cc: Peter Maydell Cc: Dave Martin Cc: Marc Zyngier Cc: Mark Rutland Cc: James Morse Cc: Shannon Zhao Cc: "Michael S. Tsirkin" Cc: Igor Mammedov --- hw/arm/virt-acpi-build.c | 16 ++++++++++++++++ include/hw/acpi/acpi-defs.h | 5 +++++ 2 files changed, 21 insertions(+) diff --git a/hw/arm/virt-acpi-build.c b/hw/arm/virt-acpi-build.c index 6cdf156..1088214 100644 --- a/hw/arm/virt-acpi-build.c +++ b/hw/arm/virt-acpi-build.c @@ -32,6 +32,7 @@ #include "trace.h" #include "hw/core/cpu.h" #include "target/arm/cpu.h" +#include "target/arm/sdei.h" #include "hw/acpi/acpi-defs.h" #include "hw/acpi/acpi.h" #include "hw/nvram/fw_cfg.h" @@ -475,6 +476,16 @@ build_iort(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms) } static void +build_sdei(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms) +{ + int sdei_start = table_data->len; + + (void)acpi_data_push(table_data, sizeof(AcpiSdei)); + build_header(linker, table_data, (void *)(table_data->data + sdei_start), + "SDEI", table_data->len - sdei_start, 1, NULL, NULL); +} + +static void build_spcr(GArray *table_data, BIOSLinker *linker, VirtMachineState *vms) { AcpiSerialPortConsoleRedirection *spcr; @@ -796,6 +807,11 @@ void virt_acpi_build(VirtMachineState *vms, AcpiBuildTables *tables) acpi_add_table(table_offsets, tables_blob); build_spcr(tables_blob, tables->linker, vms); + if (sdei_enabled) { + acpi_add_table(table_offsets, tables_blob); + build_sdei(tables_blob, tables->linker, vms); + } + if (ms->numa_state->num_nodes > 0) { acpi_add_table(table_offsets, tables_blob); build_srat(tables_blob, tables->linker, vms); diff --git a/include/hw/acpi/acpi-defs.h b/include/hw/acpi/acpi-defs.h index 57a3f58..0a2265d 100644 --- a/include/hw/acpi/acpi-defs.h +++ b/include/hw/acpi/acpi-defs.h @@ -634,4 +634,9 @@ struct AcpiIortRC { } QEMU_PACKED; typedef struct AcpiIortRC AcpiIortRC; +struct AcpiSdei { + ACPI_TABLE_HEADER_DEF /* ACPI common table header */ +} QEMU_PACKED; +typedef struct AcpiSdei AcpiSdei; + #endif