From patchwork Sun Feb 5 09:11:56 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: ben@skyportsystems.com X-Patchwork-Id: 9556009 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 93024602B1 for ; Sun, 5 Feb 2017 09:13:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7AE572582C for ; Sun, 5 Feb 2017 09:13:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6F71E27C14; Sun, 5 Feb 2017 09:13:20 +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=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0C6BC2582C for ; Sun, 5 Feb 2017 09:13:20 +0000 (UTC) Received: from localhost ([::1]:42325 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1caIsp-0002Zm-18 for patchwork-qemu-devel@patchwork.kernel.org; Sun, 05 Feb 2017 04:13:19 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59505) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1caIsB-0002XD-Fx for qemu-devel@nongnu.org; Sun, 05 Feb 2017 04:12:40 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1caIs9-0001r1-2W for qemu-devel@nongnu.org; Sun, 05 Feb 2017 04:12:39 -0500 Received: from mail-pg0-x230.google.com ([2607:f8b0:400e:c05::230]:35453) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1caIs8-0001qt-RT for qemu-devel@nongnu.org; Sun, 05 Feb 2017 04:12:36 -0500 Received: by mail-pg0-x230.google.com with SMTP id 194so19475546pgd.2 for ; Sun, 05 Feb 2017 01:12:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=skyportsystems.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :in-reply-to:references; bh=joPDF3ldFJxA+MN8QNB75ZwyZ92cdD5gqXD+eA1qXnk=; b=K+9GXY4eohz67IxxEaoIa2Tcvcf9NxWUOwGZiZCGIQCm6sNAHOkWraBKB8Kn6pxSXm dLAQoRuKdptGu1WGCjQ1gtk1ch5a9gP9uCoMPU7q9Vbv0wYXwkVc+6784BrrcHIfiVGV PCBWNvUb6TkQ69092XqmQFpr+qR0YpSMiGj6A= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:in-reply-to:references; bh=joPDF3ldFJxA+MN8QNB75ZwyZ92cdD5gqXD+eA1qXnk=; b=XnQWd5JUpRuhtaz5Rv9Okt64KWLq7JJx0iUdafnOHOYicH0PzURS68aOCuASrlI2Vs GwG4e7F/OOthoyXGxMwCYe5omeSk5zfziJ+BVJO8sSviB6DBuEyfiNbPjqDMXH4JenA9 4Szpy1wAQFiZdiC2I2iajyEP92V0Sgagqq4inQMuk97CF+F9MM0IW1RpbYfSFvomeDv0 II7CV5fA35hyRxZApZHXol7jz/KrB57ehYcQY5hSlJzquK+tm7vBGi6uS6oiNjYtxoI+ 6SbTj4AQQVsw1lfSzMx9k3m1LXnR72q6yIybKdhTopsiIy81d8uZM6n+4kT1aOn8dVoz FvDA== X-Gm-Message-State: AIkVDXL/mSjN+WkeYPOhiLU9FMXGLIkYfckb/l8kQ2H0exPCSHEVFRXV/+3PeBnWfozi2tf+ X-Received: by 10.99.101.131 with SMTP id z125mr6806049pgb.218.1486285956035; Sun, 05 Feb 2017 01:12:36 -0800 (PST) Received: from Arrow.corp.skyportsystems.com (76-236-31-201.lightspeed.sntcca.sbcglobal.net. [76.236.31.201]) by smtp.gmail.com with ESMTPSA id s24sm2347127pgo.25.2017.02.05.01.12.35 (version=TLS1 cipher=AES128-SHA bits=128/128); Sun, 05 Feb 2017 01:12:35 -0800 (PST) From: ben@skyportsystems.com To: qemu-devel@nongnu.org Date: Sun, 5 Feb 2017 01:11:56 -0800 Message-Id: X-Mailer: git-send-email 2.10.1 (Apple Git-78) In-Reply-To: References: In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:400e:c05::230 Subject: [Qemu-devel] [PATCH v5 01/10] ACPI: Add a function for building named qword entries 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: imammedo@redhat.com, lersek@redhat.com, Ben Warren , mst@redhat.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Ben Warren This is initially used to patch a 64-bit address into the VM Generation ID SSDT Signed-off-by: Ben Warren --- hw/acpi/aml-build.c | 35 +++++++++++++++++++++++++++++++++++ include/hw/acpi/aml-build.h | 4 ++++ 2 files changed, 39 insertions(+) diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c index b2a1e40..9fc54c9 100644 --- a/hw/acpi/aml-build.c +++ b/hw/acpi/aml-build.c @@ -264,6 +264,9 @@ static void build_append_int(GArray *table, uint64_t value) * Warning: runtime patching is best avoided. Only use this as * a replacement for DataTableRegion (for guests that don't * support it). + * + * ACPI 5.0: 19.2.5 + * 32-bit integers are supported beginning with ACPI 1.0 */ int build_append_named_dword(GArray *array, const char *name_format, ...) @@ -285,6 +288,38 @@ build_append_named_dword(GArray *array, const char *name_format, ...) return offset; } +/* + * Build NAME(XXXX, 0x0000000000000000) where 0x0000000000000000 + * is encoded as a qword, and return the offset to 0x0000000000000000 + * for runtime patching. + * + * Warning: runtime patching is best avoided. Only use this as + * a replacement for DataTableRegion (for guests that don't + * support it). + * + * ACPI 5.0: 19.2.5 + * 64-bit integers are supported beginning with ACPI 2.0 + */ +int +build_append_named_qword(GArray *array, const char *name_format, ...) +{ + int offset; + va_list ap; + + build_append_byte(array, 0x08); /* NameOp */ + va_start(ap, name_format); + build_append_namestringv(array, name_format, ap); + va_end(ap); + + build_append_byte(array, 0x0E); /* QWordPrefix */ + + offset = array->len; + build_append_int_noprefix(array, 0x0000000000000000, 8); + assert(array->len == offset + 8); + + return offset; +} + static GPtrArray *alloc_list; static Aml *aml_alloc(void) diff --git a/include/hw/acpi/aml-build.h b/include/hw/acpi/aml-build.h index 559326c..dbf63cf 100644 --- a/include/hw/acpi/aml-build.h +++ b/include/hw/acpi/aml-build.h @@ -385,6 +385,10 @@ int build_append_named_dword(GArray *array, const char *name_format, ...) GCC_FMT_ATTR(2, 3); +int +build_append_named_qword(GArray *array, const char *name_format, ...) +GCC_FMT_ATTR(2, 3); + void build_srat_memory(AcpiSratMemoryAffinity *numamem, uint64_t base, uint64_t len, int node, MemoryAffinityFlags flags);