From patchwork Fri Nov 17 06:22:30 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chao Gao X-Patchwork-Id: 10062357 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 EF39D6023A for ; Fri, 17 Nov 2017 06:27:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E2A402A539 for ; Fri, 17 Nov 2017 06:27:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D74352A990; Fri, 17 Nov 2017 06:27:41 +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.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED 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 8272E2A539 for ; Fri, 17 Nov 2017 06:27:41 +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 1eFa61-0001eN-UY; Fri, 17 Nov 2017 06:25:49 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eFa60-0001cV-VM for xen-devel@lists.xen.org; Fri, 17 Nov 2017 06:25:49 +0000 Received: from [85.158.139.211] by server-1.bemta-5.messagelabs.com id 36/B7-02029-CE08E0A5; Fri, 17 Nov 2017 06:25:48 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpkkeJIrShJLcpLzFFi42Jpa+uQ0H3dwBd lMOe1tsWSj4tZHBg9ju7+zRTAGMWamZeUX5HAmtF9dgNrwQ2RivcfH7A0MM4Q7GLk4hASmM4o 8XzWNqYuRk4OCQFeiSPLZrBC2AES3X9/g9lCAlUS8x49AqthE1CWuPi1lw3EFhGQlrj2+TIjy CBmgefMEv93NzCCJIQFEiW2T1gN1sAioCox9+kuZhCbV8BZ4uz9PSwQCxQkpjx8DxbnBIrvf3 OQCWKZk8TBddOYJjDyLmBkWMWoUZxaVJZapGtoqpdUlJmeUZKbmJmja2hgqpebWlycmJ6ak5h UrJecn7uJERgQDECwg7Fhu+chRkkOJiVRXh5zvighvqT8lMqMxOKM+KLSnNTiQ4wyHBxKErzH 6oFygkWp6akVaZk5wNCESUtw8CiJ8CYCw1OIt7ggMbc4Mx0idYrRmOPZzNcNzBzTrrY2MQux5 OXnpUqJ894HmSQAUppRmgc3CBYzlxhlpYR5GYFOE+IpSC3KzSxBlX/FKM7BqCTMWwkyhSczrw Ru3yugU5iATrG5wQ1ySkkiQkqqgXGxU6qDx42prcKix16KTZrycArf25zaJ1Xaj+6Efn7icVh nZ8klp7fGX4PU2qp4p5+54Sr5r2Wt0S7PgL/Hpka+OZlVt8Eh6/l0y3feDeec7hg/lX7y9OUC jzXaS5Pm7du39I3ZgjlH3O6/D5y+4UTI3A0Pv3ZnbWpaXbNtT52Q6YqVO2+s/zuzRImlOCPRU Iu5qDgRAPhM7+uUAgAA X-Env-Sender: chao.gao@intel.com X-Msg-Ref: server-11.tower-206.messagelabs.com!1510899922!87798367!9 X-Originating-IP: [134.134.136.24] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogMTM0LjEzNC4xMzYuMjQgPT4gMzkwOTcx\n X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Received: (qmail 54130 invoked from network); 17 Nov 2017 06:25:47 -0000 Received: from mga09.intel.com (HELO mga09.intel.com) (134.134.136.24) by server-11.tower-206.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 17 Nov 2017 06:25:47 -0000 Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 16 Nov 2017 22:25:46 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos; i="5.44,407,1505804400"; d="scan'208"; a="1245165346" Received: from skl-4s-chao.sh.intel.com ([10.239.48.9]) by fmsmga002.fm.intel.com with ESMTP; 16 Nov 2017 22:25:44 -0800 From: Chao Gao To: xen-devel@lists.xen.org Date: Fri, 17 Nov 2017 14:22:30 +0800 Message-Id: <1510899755-40237-24-git-send-email-chao.gao@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1510899755-40237-1-git-send-email-chao.gao@intel.com> References: <1510899755-40237-1-git-send-email-chao.gao@intel.com> Cc: Lan Tianyu , Kevin Tian , Stefano Stabellini , Wei Liu , Konrad Rzeszutek Wilk , George Dunlap , Andrew Cooper , Tim Deegan , Jan Beulich , Chao Gao , Ian Jackson , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= Subject: [Xen-devel] [PATCH v4 23/28] tools/libacpi: Add DMA remapping reporting (DMAR) ACPI table structures 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 Add dmar table structure according Chapter 8 "BIOS Considerations" of VTd spec Rev. 2.4. VTd spec:http://www.intel.com/content/dam/www/public/us/en/documents/product-specifications/vt-directed-io-spec.pdf Signed-off-by: Chao Gao Signed-off-by: Lan Tianyu --- tools/libacpi/acpi2_0.h | 61 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/tools/libacpi/acpi2_0.h b/tools/libacpi/acpi2_0.h index 2619ba3..6081417 100644 --- a/tools/libacpi/acpi2_0.h +++ b/tools/libacpi/acpi2_0.h @@ -422,6 +422,65 @@ struct acpi_20_slit { }; /* + * DMA Remapping Table header definition (DMAR) + */ + +/* + * DMAR Flags. + */ +#define ACPI_DMAR_INTR_REMAP (1 << 0) +#define ACPI_DMAR_X2APIC_OPT_OUT (1 << 1) + +struct acpi_dmar { + struct acpi_header header; + uint8_t host_address_width; + uint8_t flags; + uint8_t reserved[10]; +}; + +/* + * Device Scope Types + */ +#define ACPI_DMAR_DEV_SCOPE_PCI_ENDPOINT 0x01 +#define ACPI_DMAR_DEV_SCOPE_PCI_SUB_HRCHY 0x02 +#define ACPI_DMAR_DEV_SCOPE_IOAPIC 0x03 +#define ACPI_DMAR_DEV_SCOPE_HPET 0x04 +#define ACPI_DMAR_DEV_SCOPE_ACPI_NS_DEV 0x05 + +struct dmar_device_scope { + uint8_t type; + uint8_t length; + uint8_t reserved[2]; + uint8_t enumeration_id; + uint8_t bus; + uint16_t path[0]; +}; + +/* + * DMA Remapping Hardware Unit Types + */ +#define ACPI_DMAR_TYPE_DRHD 0x00 +#define ACPI_DMAR_TYPE_RMRR 0x01 +#define ACPI_DMAR_TYPE_ATSR 0x02 +#define ACPI_DMAR_TYPE_RHSA 0x03 +#define ACPI_DMAR_TYPE_ANDD 0x04 + +/* + * DMA Remapping Hardware Unit Flags. All other bits are reserved and must be 0. + */ +#define ACPI_DMAR_INCLUDE_PCI_ALL (1 << 0) + +struct acpi_dmar_hardware_unit { + uint16_t type; + uint16_t length; + uint8_t flags; + uint8_t reserved; + uint16_t pci_segment; + uint64_t base_address; + struct dmar_device_scope scope[0]; +}; + +/* * Table Signatures. */ #define ACPI_2_0_RSDP_SIGNATURE ASCII64('R','S','D',' ','P','T','R',' ') @@ -435,6 +494,7 @@ struct acpi_20_slit { #define ACPI_2_0_WAET_SIGNATURE ASCII32('W','A','E','T') #define ACPI_2_0_SRAT_SIGNATURE ASCII32('S','R','A','T') #define ACPI_2_0_SLIT_SIGNATURE ASCII32('S','L','I','T') +#define ACPI_2_0_DMAR_SIGNATURE ASCII32('D','M','A','R') /* * Table revision numbers. @@ -449,6 +509,7 @@ struct acpi_20_slit { #define ACPI_1_0_FADT_REVISION 0x01 #define ACPI_2_0_SRAT_REVISION 0x01 #define ACPI_2_0_SLIT_REVISION 0x01 +#define ACPI_2_0_DMAR_REVISION 0x01 #pragma pack ()