From patchwork Mon Mar 20 00:09:41 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Haozhong Zhang X-Patchwork-Id: 9632897 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 F2F6160326 for ; Mon, 20 Mar 2017 00:16:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E6E2E27F9F for ; Mon, 20 Mar 2017 00:16:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DB9AF27FBC; Mon, 20 Mar 2017 00:16:01 +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=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 5073D28111 for ; Mon, 20 Mar 2017 00:15:58 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cpkwr-0006Zj-2Q; Mon, 20 Mar 2017 00:13:21 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cpkwp-0006Wi-95 for xen-devel@lists.xen.org; Mon, 20 Mar 2017 00:13:19 +0000 Received: from [85.158.137.68] by server-16.bemta-3.messagelabs.com id F1/0B-06437-E9E1FC85; Mon, 20 Mar 2017 00:13:18 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrBLMWRWlGSWpSXmKPExsVywNykWHeu3Pk Ig6ufrS2WfFzM4sDocXT3b6YAxijWzLyk/IoE1ox7888xFrwSqLh64DVzA+MKvi5GTg4WgVtM EquWyHcxcnEICUxnlLh69jMjSEJCgFfiyLIZrF2MHEC2n8SptVogYSGBXkaJi1MlQGw2AX2JF Y8PsoLYIgLSEtc+XwZrZRaYzSRxvzEExBYWSJbY07SLEWKXqkTLxpvsIDavgK3E9dlrmSFWyU tcuHqKBcTmFLCTWHPpNjvELluJ/bemsU1g5FvAyLCKUb04tagstUjXQi+pKDM9oyQ3MTNH19D AWC83tbg4MT01JzGpWC85P3cTIzBEGIBgB+OFdudDjJIcTEqivCedTkYI8SXlp1RmJBZnxBeV 5qQWH2KU4eBQkuBNdwbKCRalpqdWpGXmAIMVJi3BwaMkwnsBpJW3uCAxtzgzHSJ1ilFRSpxXB 6RPACSRUZoH1waLkEuMslLCvIxAhwjxFKQW5WaWoMq/YhTnYFQS5p0GMoUnM68EbvoroMVMQI vffjgBsrgkESEl1cCoLSGRwisRrMPZwDyr5rXKviO3HWNrJU+u0nyo8X6VlvGN7s3Ojh1Zb37 dZGv2v3viT7nK5uS+4DiJLc+yhGKlNZef/Lpw+7EVcnJxh9QYfr6YqdhRc/r3Cm2jmas/bp5b vad856ka3277T7ICYg923u/cb+YpyzR17dOJ5zKjps0RTjt3frW2EktxRqKhFnNRcSIAkzEyO osCAAA= X-Env-Sender: haozhong.zhang@intel.com X-Msg-Ref: server-3.tower-31.messagelabs.com!1489968792!90971302!4 X-Originating-IP: [192.55.52.115] X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG X-StarScan-Received: X-StarScan-Version: 9.2.3; banners=-,-,- X-VirusChecked: Checked Received: (qmail 27517 invoked from network); 20 Mar 2017 00:13:17 -0000 Received: from mga14.intel.com (HELO mga14.intel.com) (192.55.52.115) by server-3.tower-31.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 20 Mar 2017 00:13:17 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=intel.com; i=@intel.com; q=dns/txt; s=intel; t=1489968797; x=1521504797; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=0lDgZnOMO9qa8avJrMDDtK8HoMGRQqKXX5dqhfyjbsQ=; b=xcl72FWXSE2YQj6XBTS9jPEodEjCZI8yDmwCzkKz4WGlBsTH4vVpFliJ jdcfUNO+SvyCPjd5ILq28XRmxH+y2w==; Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Mar 2017 17:13:16 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.36,191,1486454400"; d="scan'208";a="78799196" Received: from hz-desktop.sh.intel.com (HELO localhost) ([10.239.159.153]) by fmsmga006.fm.intel.com with ESMTP; 19 Mar 2017 17:13:15 -0700 From: Haozhong Zhang To: xen-devel@lists.xen.org Date: Mon, 20 Mar 2017 08:09:41 +0800 Message-Id: <20170320000949.24675-8-haozhong.zhang@intel.com> X-Mailer: git-send-email 2.10.1 In-Reply-To: <20170320000949.24675-1-haozhong.zhang@intel.com> References: <20170320000949.24675-1-haozhong.zhang@intel.com> Cc: Haozhong Zhang , Wei Liu , Andrew Cooper , Ian Jackson , Jan Beulich , Konrad Rzeszutek Wilk , Dan Williams Subject: [Xen-devel] [RFC XEN PATCH v2 07/15] tools/libacpi: expose the minimum alignment used by mem_ops.alloc X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP The AML builder added later requires this information to implement a memory allocator that can allocate contiguous memory across multiple calls to mem_ops.alloc(). Signed-off-by: Haozhong Zhang --- Cc: Jan Beulich Cc: Andrew Cooper Cc: Ian Jackson Cc: Wei Liu Changes in v2: * Only expose the minimal alignment. * Rename min_alloc_align to min_alloc_byte_align to clarify the unit. --- tools/firmware/hvmloader/util.c | 2 ++ tools/libacpi/libacpi.h | 2 ++ tools/libxl/libxl_x86_acpi.c | 2 ++ 3 files changed, 6 insertions(+) diff --git a/tools/firmware/hvmloader/util.c b/tools/firmware/hvmloader/util.c index 03cfb795d3..d289361317 100644 --- a/tools/firmware/hvmloader/util.c +++ b/tools/firmware/hvmloader/util.c @@ -971,6 +971,8 @@ void hvmloader_acpi_build_tables(struct acpi_config *config, ctxt.mem_ops.free = acpi_mem_free; ctxt.mem_ops.v2p = acpi_v2p; + ctxt.min_alloc_byte_align = 16; + acpi_build_tables(&ctxt, config); hvm_param_set(HVM_PARAM_VM_GENERATION_ID_ADDR, config->vm_gid_addr); diff --git a/tools/libacpi/libacpi.h b/tools/libacpi/libacpi.h index 67bd67fa0a..2049a1b032 100644 --- a/tools/libacpi/libacpi.h +++ b/tools/libacpi/libacpi.h @@ -51,6 +51,8 @@ struct acpi_ctxt { void (*free)(struct acpi_ctxt *ctxt, void *v, uint32_t size); unsigned long (*v2p)(struct acpi_ctxt *ctxt, void *v); } mem_ops; + + uint32_t min_alloc_byte_align; /* minimum alignment used by mem_ops.alloc */ }; struct acpi_config { diff --git a/tools/libxl/libxl_x86_acpi.c b/tools/libxl/libxl_x86_acpi.c index c0a6e321ec..f242450166 100644 --- a/tools/libxl/libxl_x86_acpi.c +++ b/tools/libxl/libxl_x86_acpi.c @@ -183,6 +183,8 @@ int libxl__dom_load_acpi(libxl__gc *gc, libxl_ctxt.c.mem_ops.v2p = virt_to_phys; libxl_ctxt.c.mem_ops.free = acpi_mem_free; + libxl_ctxt.c.min_alloc_byte_align = 16; + rc = init_acpi_config(gc, dom, b_info, &config); if (rc) { LOG(ERROR, "init_acpi_config failed (rc=%d)", rc);