From patchwork Mon Jan 23 07:32:47 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: 718401 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3v6NPD69KBz9sR9 for ; Mon, 23 Jan 2017 18:34:40 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=skyportsystems.com header.i=@skyportsystems.com header.b="PFOq/gNz"; dkim-atps=neutral Received: from localhost ([::1]:39530 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cVZ9C-0005uI-Ca for incoming@patchwork.ozlabs.org; Mon, 23 Jan 2017 02:34:38 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33856) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cVZ7v-0004up-80 for qemu-devel@nongnu.org; Mon, 23 Jan 2017 02:33:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cVZ7u-0006dg-DE for qemu-devel@nongnu.org; Mon, 23 Jan 2017 02:33:19 -0500 Received: from mail-pf0-x22d.google.com ([2607:f8b0:400e:c00::22d]:36803) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cVZ7u-0006dT-7S for qemu-devel@nongnu.org; Mon, 23 Jan 2017 02:33:18 -0500 Received: by mail-pf0-x22d.google.com with SMTP id 189so39280019pfu.3 for ; Sun, 22 Jan 2017 23:33:18 -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=hTiCEMxg/HMpqO3E1TYtQYN4Hqx6k2s3eQlCEubVCAM=; b=PFOq/gNzKqg4opU9gKBQENTkVzz3SWg8nn04Gvzfk84OhjuWGsCphsW1UDGYeR+3SF WWK9JhY88YdAQ3Cl8xDCRQTnQOBhgGd2MmNmoSLeCFbcf3kbUz1Jug31cAEi+Wdbj3r9 yInLXLot/cf0eftV3JWFRpbD9hT+S6+ZhfGq4= 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=hTiCEMxg/HMpqO3E1TYtQYN4Hqx6k2s3eQlCEubVCAM=; b=j93NcKNOVa8F3CNydED7y3RActecb1ZGvYJZ/Wh/hi6PBSmbat564zOGRI9utwPVBY CgbYWtEHB20TuuSAZ23L8wIKLjmmjDhNbiPXTP7W+6m6MREblN6j4ww6/O6RQaS8ZovS EOjR+673jTvHGDlkI8J5L+U0T1SM+bYpPzG/oKaN4AwCeGXBZ8anqlZ45eLjRXM3IvN7 k3LwBWizywFC/K4SVphCcjEuF3mTWE7rBCeEPEbVxp6SQe5FZsWMq1nZjWDsSNy1NK1e KWwPUQQ4reaikt/9hge1HdQN27nH/A2FiuVuAu6E+3S8RgLW9Y3NgU98V583+YDbGkNZ P+ag== X-Gm-Message-State: AIkVDXI6skplVOgVjbeu+4lzt8yVcWsDCKBKQaXqS6a2mS6xocFH+RIthxOG2WEqv4coFE65 X-Received: by 10.84.231.134 with SMTP id g6mr41467168plk.40.1485156797155; Sun, 22 Jan 2017 23:33:17 -0800 (PST) Received: from Arrow.corp.skyportsystems.com (162-199-88-38.lightspeed.sntcca.sbcglobal.net. [162.199.88.38]) by smtp.gmail.com with ESMTPSA id d78sm34155810pfb.43.2017.01.22.23.33.16 (version=TLS1 cipher=AES128-SHA bits=128/128); Sun, 22 Jan 2017 23:33:16 -0800 (PST) From: ben@skyportsystems.com To: qemu-devel@nongnu.org Date: Sun, 22 Jan 2017 23:32:47 -0800 Message-Id: <6d20d5be94de5e631dd5f706f68738b9b2bc88b2.1485155611.git.ben@skyportsystems.com> 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:c00::22d Subject: [Qemu-devel] [PATCH v3 1/6] 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: Ben Warren Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: "Qemu-devel" 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 | 28 ++++++++++++++++++++++++++++ include/hw/acpi/aml-build.h | 4 ++++ 2 files changed, 32 insertions(+) diff --git a/hw/acpi/aml-build.c b/hw/acpi/aml-build.c index b2a1e40..dc4edc2 100644 --- a/hw/acpi/aml-build.c +++ b/hw/acpi/aml-build.c @@ -285,6 +285,34 @@ build_append_named_dword(GArray *array, const char *name_format, ...) return offset; } +/* + * Build NAME(XXXX, 0x00000000) where 0x00000000 is encoded as a qword, + * and return the offset to 0x00000000 for runtime patching. + * + * Warning: runtime patching is best avoided. Only use this as + * a replacement for DataTableRegion (for guests that don't + * support it). + */ +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, 0x00000000, 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);