From patchwork Wed Jan 25 01:43:20 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: 9536281 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 3C17A6046A for ; Wed, 25 Jan 2017 01:44:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2DE5C26B39 for ; Wed, 25 Jan 2017 01:44:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2287B27D29; Wed, 25 Jan 2017 01:44:33 +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 1097F26B39 for ; Wed, 25 Jan 2017 01:44:31 +0000 (UTC) Received: from localhost ([::1]:56734 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cWCdS-0003hn-DU for patchwork-qemu-devel@patchwork.kernel.org; Tue, 24 Jan 2017 20:44:30 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47457) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cWCcw-0003hD-Kx for qemu-devel@nongnu.org; Tue, 24 Jan 2017 20:43:59 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cWCcs-0005Mo-J4 for qemu-devel@nongnu.org; Tue, 24 Jan 2017 20:43:58 -0500 Received: from mail-yw0-x22c.google.com ([2607:f8b0:4002:c05::22c]:34440) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cWCcs-0005Lw-F2 for qemu-devel@nongnu.org; Tue, 24 Jan 2017 20:43:54 -0500 Received: by mail-yw0-x22c.google.com with SMTP id w75so3587419ywg.1 for ; Tue, 24 Jan 2017 17:43:52 -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=Px4RQiGPLWz/m9yXp+8Cqzjd2Q1Kq0D6w01ovvSlmhg=; b=FV+62R/rXjcXHOrOL/flbLIs2qvKJqteLl+ion5E4Gt373K9Xsfdp+JRPQ3Q/CWh52 T/bAbCaNv/Hf+ZzGsWQrTLfb6rKbJDIX3ZePic5GN0nbvGSaypBsZujruPEqAlQk+ght ML1WA3oRJIpWQWxeMVgR61YsMPb7iCdIuK0nQ= 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=Px4RQiGPLWz/m9yXp+8Cqzjd2Q1Kq0D6w01ovvSlmhg=; b=cmCN1deDe9mbH6N7YrEnJzn2AfmhJ8LI3DCZaZQA98CCtPj/NOkD/X98XHdGItHF4M dgyT26ZoQuIpNVOgUTtwvO8rJHyNoAALa7CxB6CO6VmZXG9nPRrBJiXIhgnYx0YxQ2WC w0tlsh6G6OtUq12GRYELtqj9DjTcmCTukTjtyEen8154H2RAvWJzc6Nql65B6BleSs4o I6EciMkJTeGbTFru3E9LiyJEVqzAybuThJ0/PqMvSznEmyP7tdHT7azeUoJAgwh1gPDO qYgWjXqIx2Bf7X6zf9QxmX7Vz1jHicgwBCouxFK5pjugU5lSftpitawgMFd4YnFUuaSq rThA== X-Gm-Message-State: AIkVDXJtU3BfEuGHg7ntiRBpbFcrd8GTEfdCJYb8RNE9cxs/36832P+gmMEFhryeGRr+DIsE X-Received: by 10.129.158.144 with SMTP id v138mr28209436ywg.65.1485308632187; Tue, 24 Jan 2017 17:43:52 -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 w126sm10757317yww.41.2017.01.24.17.43.51 (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 24 Jan 2017 17:43:51 -0800 (PST) From: ben@skyportsystems.com To: qemu-devel@nongnu.org Date: Tue, 24 Jan 2017 17:43:20 -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:4002:c05::22c Subject: [Qemu-devel] [PATCH v4 1/9] 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+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 | 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);