From patchwork Wed Feb 15 22:34:55 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Goel, Sameer" X-Patchwork-Id: 9575209 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 399596045F for ; Wed, 15 Feb 2017 22:38:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2830328536 for ; Wed, 15 Feb 2017 22:38:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1C7E928545; Wed, 15 Feb 2017 22:38:08 +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 7CBD528536 for ; Wed, 15 Feb 2017 22:38:07 +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 1ce8Ah-0002a9-8F; Wed, 15 Feb 2017 22:35:35 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ce8Ag-0002a3-1R for xen-devel@lists.xensource.com; Wed, 15 Feb 2017 22:35:34 +0000 Received: from [85.158.139.211] by server-12.bemta-5.messagelabs.com id 32/6D-01703-5B7D4A85; Wed, 15 Feb 2017 22:35:33 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrAIsWRWlGSWpSXmKPExsVybKJsgu6W60s iDPZ9lLG4N+U9uwOjx/a+XewBjFGsmXlJ+RUJrBmbpp5lKbhpVPHj0UHGBsY/ml2MnBxCAkUS a07dYOti5OJgEXjJJLHyy242kISEQLTEug3H2CFsPomLL34wgRRJCExglPj1tZkRxBESOMgkc eHcSUa49t/zQBxOIMdF4tqstcwgNqNAgcScDR8ZIewUiVldb8BsNgENif4Th8FqRAQUJdatfs cCYjMLLGSS+LFQHMQWFrCTWHxxDSvETFWJ00uagc7j4OAVcJZY/o8T4joFiePbtzFOYBRcwMi wilGjOLWoLLVI19BcL6koMz2jJDcxM0fX0MBULze1uDgxPTUnMalYLzk/dxMjMOQYgGAH48XT nocYJTmYlER5f+1bEiHEl5SfUpmRWJwRX1Sak1p8iFGGg0NJgjfzGlBOsCg1PbUiLTMHGPwwa QkOHiUR3lyQNG9xQWJucWY6ROoUo6KUOK8iSEIAJJFRmgfXBou4S4yyUsK8jECHCPEUpBblZp agyr9iFOdgVBLmFQWZwpOZVwI3/RXQYiagxaxxC0EWlyQipKQaGAU3MxaHnv6sXnWmxoMrXy7 z8I6ESp4XmmEuG7VOb5Cdr/dv/ts3gvatj48uuaTQwqPz9oKuRdNC5xW5KZ4GienuloukDYsZ 9h8/dfjDBbvTwZae/+/MTv6Tvcvb9lXWtoUFjnFLCw331l7kWLXLO/v5xRaGFQxmave8eKVnP Xz5g0VqioJGshJLcUaioRZzUXEiANNgVB6zAgAA X-Env-Sender: sgoel@codeaurora.org X-Msg-Ref: server-7.tower-206.messagelabs.com!1487198131!84974137!1 X-Originating-IP: [198.145.29.96] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.2.3; banners=-,-,- X-VirusChecked: Checked Received: (qmail 56889 invoked from network); 15 Feb 2017 22:35:32 -0000 Received: from smtp.codeaurora.org (HELO smtp.codeaurora.org) (198.145.29.96) by server-7.tower-206.messagelabs.com with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 15 Feb 2017 22:35:32 -0000 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 36EEE609F2; Wed, 15 Feb 2017 22:35:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1487198130; bh=H24YWJOkSJeGMR9rSy5Sg6x2wjpr9iEyDrvwe9DqgXE=; h=From:To:Cc:Subject:Date:From; b=HwIb8ErROp5bYRB/dnSyM5dt6Xfq94QBJc+8or9U+Zb/gZgWYulmv5b7S/89sMWvE ERu4taeQqpb2ydxCWh9Dv1SiOEoAAOZfOwNg5BtuqYFpCuNAZPxHzyDO9GX9QDdCtD 3XLfs/BCX93lQ+kocSYepbBmvE2OpKY+bKyCvVqY= Received: from sgoel-lnx.qualcomm.com (unknown [129.46.14.70]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: sgoel@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id EC43A606B6; Wed, 15 Feb 2017 22:35:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1487198129; bh=H24YWJOkSJeGMR9rSy5Sg6x2wjpr9iEyDrvwe9DqgXE=; h=From:To:Cc:Subject:Date:From; b=TCA+dAfeG2rB4vsWPl7vTG5pj38qzja5HNvuoFHW3gaR1Jn66spNFTOIkDpzb+U23 Lq4B3JYVL53aST4+tFw0VZezOaOQgfcRDvSbSfw/Z4chCEJHl5bowYK8UNNVlLrxY2 kctPfjRETjvDQWzMJTVt3S/G3RT1q88gnLVt5IZs= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org EC43A606B6 From: Sameer Goel To: xen-devel@lists.xensource.com Date: Wed, 15 Feb 2017 15:34:55 -0700 Message-Id: <1487198095-1887-1-git-send-email-sgoel@codeaurora.org> X-Mailer: git-send-email 1.8.2.1 Cc: Stefano Stabellini , "Rafael J. Wysocki" , Bob Moore , Julien Grall , Lv Zheng , Sameer Goel , Shanker Donthineni Subject: [Xen-devel] [PATCH] ACPICA: ACPI 6.0: Add support for IORT table. 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 From: Lv Zheng ACPICA commit 5de82757aef5d6163e37064033aacbce193abbca This patch adds support for IORT (IO Remapping Table) in iasl. Note that some field names are modified to shrink their length or the decompiled IORT ASL will contain fields with ugly ":" alignment. The IORT contains field definitions around "Memory Access Properties". This patch also adds support to encode/decode it using inline table. This patch doesn't add inline table support for the SMMU interrupt fields due to a limitation in current ACPICA data table support. Lv Zheng. Link: https://github.com/acpica/acpica/commit/5de82757 Signed-off-by: Lv Zheng Signed-off-by: Bob Moore Signed-off-by: Rafael J. Wysocki [Linux commit 874f6a723e56d0da9e481629b17482bcd3801ecf] [only port the IORT changes] Signed-off-by: Sameer Goel --- xen/include/acpi/actbl2.h | 148 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 146 insertions(+), 2 deletions(-) diff --git a/xen/include/acpi/actbl2.h b/xen/include/acpi/actbl2.h index d2327d2..e13c823 100644 --- a/xen/include/acpi/actbl2.h +++ b/xen/include/acpi/actbl2.h @@ -5,7 +5,7 @@ *****************************************************************************/ /* - * Copyright (C) 2000 - 2011, Intel Corp. + * Copyright (C) 2000 - 2016, Intel Corp. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -67,7 +67,8 @@ #define ACPI_SIG_DBGP "DBGP" /* Debug Port table */ #define ACPI_SIG_DMAR "DMAR" /* DMA Remapping table */ #define ACPI_SIG_HPET "HPET" /* High Precision Event Timer table */ -#define ACPI_SIG_IBFT "IBFT" /* i_sCSI Boot Firmware Table */ +#define ACPI_SIG_IBFT "IBFT" /* iSCSI Boot Firmware Table */ +#define ACPI_SIG_IORT "IORT" /* IO Remapping Table */ #define ACPI_SIG_IVRS "IVRS" /* I/O Virtualization Reporting Structure */ #define ACPI_SIG_MCFG "MCFG" /* PCI Memory Mapped Configuration table */ #define ACPI_SIG_MCHI "MCHI" /* Management Controller Host Interface table */ @@ -556,6 +557,149 @@ struct acpi_ibft_target { /******************************************************************************* * + * IORT - IO Remapping Table + * + * Conforms to "IO Remapping Table System Software on ARM Platforms", + * Document number: ARM DEN 0049B, October 2015 + * + ******************************************************************************/ + +struct acpi_table_iort { + struct acpi_table_header header; + u32 node_count; + u32 node_offset; + u32 reserved; +}; + +/* + * IORT subtables + */ +struct acpi_iort_node { + u8 type; + u16 length; + u8 revision; + u32 reserved; + u32 mapping_count; + u32 mapping_offset; + char node_data[1]; +}; + +/* Values for subtable Type above */ + +enum acpi_iort_node_type { + ACPI_IORT_NODE_ITS_GROUP = 0x00, + ACPI_IORT_NODE_NAMED_COMPONENT = 0x01, + ACPI_IORT_NODE_PCI_ROOT_COMPLEX = 0x02, + ACPI_IORT_NODE_SMMU = 0x03, + ACPI_IORT_NODE_SMMU_V3 = 0x04 +}; + +struct acpi_iort_id_mapping { + u32 input_base; /* Lowest value in input range */ + u32 id_count; /* Number of IDs */ + u32 output_base; /* Lowest value in output range */ + u32 output_reference; /* A reference to the output node */ + u32 flags; +}; + +/* Masks for Flags field above for IORT subtable */ + +#define ACPI_IORT_ID_SINGLE_MAPPING (1) + +struct acpi_iort_memory_access { + u32 cache_coherency; + u8 hints; + u16 reserved; + u8 memory_flags; +}; + +/* Values for cache_coherency field above */ + +#define ACPI_IORT_NODE_COHERENT 0x00000001 /* The device node is fully coherent */ +#define ACPI_IORT_NODE_NOT_COHERENT 0x00000000 /* The device node is not coherent */ + +/* Masks for Hints field above */ + +#define ACPI_IORT_HT_TRANSIENT (1) +#define ACPI_IORT_HT_WRITE (1<<1) +#define ACPI_IORT_HT_READ (1<<2) +#define ACPI_IORT_HT_OVERRIDE (1<<3) + +/* Masks for memory_flags field above */ + +#define ACPI_IORT_MF_COHERENCY (1) +#define ACPI_IORT_MF_ATTRIBUTES (1<<1) + +/* + * IORT node specific subtables + */ +struct acpi_iort_its_group { + u32 its_count; + u32 identifiers[1]; /* GIC ITS identifier arrary */ +}; + +struct acpi_iort_named_component { + u32 node_flags; + u64 memory_properties; /* Memory access properties */ + u8 memory_address_limit; /* Memory address size limit */ + char device_name[1]; /* Path of namespace object */ +}; + +struct acpi_iort_root_complex { + u64 memory_properties; /* Memory access properties */ + u32 ats_attribute; + u32 pci_segment_number; +}; + +/* Values for ats_attribute field above */ + +#define ACPI_IORT_ATS_SUPPORTED 0x00000001 /* The root complex supports ATS */ +#define ACPI_IORT_ATS_UNSUPPORTED 0x00000000 /* The root complex doesn't support ATS */ + +struct acpi_iort_smmu { + u64 base_address; /* SMMU base address */ + u64 span; /* Length of memory range */ + u32 model; + u32 flags; + u32 global_interrupt_offset; + u32 context_interrupt_count; + u32 context_interrupt_offset; + u32 pmu_interrupt_count; + u32 pmu_interrupt_offset; + u64 interrupts[1]; /* Interrupt array */ +}; + +/* Values for Model field above */ + +#define ACPI_IORT_SMMU_V1 0x00000000 /* Generic SMMUv1 */ +#define ACPI_IORT_SMMU_V2 0x00000001 /* Generic SMMUv2 */ +#define ACPI_IORT_SMMU_CORELINK_MMU400 0x00000002 /* ARM Corelink MMU-400 */ +#define ACPI_IORT_SMMU_CORELINK_MMU500 0x00000003 /* ARM Corelink MMU-500 */ + +/* Masks for Flags field above */ + +#define ACPI_IORT_SMMU_DVM_SUPPORTED (1) +#define ACPI_IORT_SMMU_COHERENT_WALK (1<<1) + +struct acpi_iort_smmu_v3 { + u64 base_address; /* SMMUv3 base address */ + u32 flags; + u32 reserved; + u64 vatos_address; + u32 model; /* O: generic SMMUv3 */ + u32 event_gsiv; + u32 pri_gsiv; + u32 gerr_gsiv; + u32 sync_gsiv; +}; + +/* Masks for Flags field above */ + +#define ACPI_IORT_SMMU_V3_COHACC_OVERRIDE (1) +#define ACPI_IORT_SMMU_V3_HTTU_OVERRIDE (1<<1) + +/******************************************************************************* + * * IVRS - I/O Virtualization Reporting Structure * Version 1 *