From patchwork Thu Aug 18 19:42:34 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Suthikulpanit, Suravee" X-Patchwork-Id: 74195 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp70674qga; Thu, 18 Aug 2016 18:19:40 -0700 (PDT) X-Received: by 10.66.246.134 with SMTP id xw6mr8901827pac.35.1471569579657; Thu, 18 Aug 2016 18:19:39 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c9si5227288pas.141.2016.08.18.18.19.39; Thu, 18 Aug 2016 18:19:39 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@amdcloud.onmicrosoft.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755191AbcHSBTb (ORCPT + 27 others); Thu, 18 Aug 2016 21:19:31 -0400 Received: from mail-bl2nam02on0087.outbound.protection.outlook.com ([104.47.38.87]:58727 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755169AbcHSBT0 (ORCPT ); Thu, 18 Aug 2016 21:19:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=pljgfPIv563oohSudn3hUSO7VHAYG57fXLNj4xlVG4w=; b=pALvdsT7xWrATccID3VSi+pGr8HrQqBz4iGNy75PfEJ4M0ZhdP/FpAaK/AV138JrVFgBbuGOeqxD3XzDkbq1J0+TqSSX7q6I0OC4d+Zmev7/SiOxhzzRerKmuNM12Csx+U29T9Av8NX0b3s9t/PUGfMVliX8JQdKqIKx433Sk7E= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Suravee.Suthikulpanit@amd.com; Received: from localhost.localdomain (114.109.128.54) by MWHPR12MB1453.namprd12.prod.outlook.com (10.172.55.22) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.587.9; Thu, 18 Aug 2016 19:43:25 +0000 From: Suravee Suthikulpanit To: , , , CC: , , , Suravee Suthikulpanit Subject: [PART2 PATCH v6 02/12] iommu/amd: Move and introduce new IRTE-related unions and structures Date: Thu, 18 Aug 2016 14:42:34 -0500 Message-ID: <1471549364-6672-3-git-send-email-Suravee.Suthikulpanit@amd.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1471549364-6672-1-git-send-email-Suravee.Suthikulpanit@amd.com> References: <1471549364-6672-1-git-send-email-Suravee.Suthikulpanit@amd.com> MIME-Version: 1.0 X-Originating-IP: [114.109.128.54] X-ClientProxiedBy: KL1PR0201CA0016.apcprd02.prod.outlook.com (10.167.53.154) To MWHPR12MB1453.namprd12.prod.outlook.com (10.172.55.22) X-MS-Office365-Filtering-Correlation-Id: 577a818d-f028-4ecf-831c-08d3c79fed1e X-Microsoft-Exchange-Diagnostics: 1; MWHPR12MB1453; 2:oOVpihC8q9pAQWS8YDgQbxn7Ksblq3hHGL8gjbC5RR313Bp67mwL3cmVE65GeaiXwUVfGq56pjGITMik1Ij3mfjhWXz5GQVNDFCfHBh0i3XmESi0H2zbYXnKXTJ2+Pnn10DJhZsDi3XF+k6VuFNU6LOrMiesbThf3+lHi7OUbrpr4L39xxRADtp4ODVfZeSO; 3:Dq0zj6Grx8Tfrol8i4n4124Ftzpg9ex7mcWUTIuUbscjhfxQPIT9wzPDPGyBHdJCltuhyudy50SyR7dcZHC0keOPm8FaJ0zFD7gfp35/pMUGraCK2cGTgXjOGo+xYsW2; 25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9oyppfaLIEWxJ0tqR0HgBlQev/JZWoNzFF8hxIKDxeHhAEEngx5zmQ/znphtdiWztizk7yhOX1UnuQ3lPRPzF9nGqDltL79o93Ex89Q5S/SZszq+y2hVXB5ALrFfQ981My1m+18YuzOjVqIAh/JRiWDaZPRIDg4ignCmbGkS1krDJwiyiN/X+KUF7rhK6ZkuEKWTNRWUEyXK2LodzNY X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040176)(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001)(6055026); SRVR:MWHPR12MB1453; BCL:0; PCL:0; RULEID:; SRVR:MWHPR12MB1453; X-Microsoft-Exchange-Diagnostics: 1; MWHPR12MB1453; 4:EWmwqDda1EPPZ0xoWwZttI1C9LCThcTf/d6H3texR8ZtXNh0HxDtjeGdFdZcBpH/vw5CSWiSM8IYe0rnwKpFwMnTXsoC1Xhfq8xwqwSM3f6HpP6uCwz0I+Uk6R21UNBsM2hcienahDajJuISo7690mFE9IyTD8ALUnfQyjKFOvCvDh+DECAr2cBHcAPQZa7kFupUpxA5ZM0nBQo7Qr0t+c5ZNmLedL+JBbVApXjYfi+o3aRtOzWGF953KLWng9Hq3zUJcAiB9djXALt20kvU7CV+P+KoxJWII65Cf9n/R93MovVCDuacsUBSnH9kfECVjlv9qVCP8mp0euIiT+WwCyLPLI7QA8LZ+GPPJuUlRmAp19Tlld3vQ0SAnyyaJJoM5JnOIn5UnAjB+IlLIyF+/267jZ0aOcCDWk3mSDxP5xPnzsEaqYs5egQfJ2Jqp7O+ X-Forefront-PRVS: 0038DE95A2 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6069001)(6009001)(7916002)(189002)(199003)(86362001)(42186005)(50226002)(19580395003)(586003)(68736007)(92566002)(3846002)(6116002)(189998001)(105586002)(8676002)(81156014)(81166006)(5003940100001)(47776003)(5001770100001)(2950100001)(97736004)(48376002)(77096005)(50986999)(50466002)(106356001)(36756003)(2201001)(305945005)(19580405001)(76176999)(7846002)(7736002)(4326007)(2906002)(66066001)(229853001)(101416001); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR12MB1453; H:localhost.localdomain; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; MWHPR12MB1453; 23:TLYqAcfJ/2CKeuPT1FVeAtRE0MgaexUCooQDa7ZDs?= =?us-ascii?Q?xtlD9cv6BirQWi4gljKqzMT3mrON2soXzQ5pNewQb1jMqQxfpTFmwVIas8e7?= =?us-ascii?Q?vXonMxgiAMmj8/21XTYr1xnk5T2LoydTrTwHBfTnBOdShtAmPC5VxoPLWNlA?= =?us-ascii?Q?SAH8//WTKUSRISLNF037U1ZrV6PPMvN+gNJfvDwAAoOwPVg8PyTBY1/LnXPf?= =?us-ascii?Q?dR66JgqMBsEiRSktaFUNkZ+htssJY/rz/51jJuS6fWBOTot39vA3hnZXYLMu?= =?us-ascii?Q?moXifSqoUso5uS/hyOWEP+wHkZdyVy7DekDlW1lxxepd0SABhFSfsgiPagsU?= =?us-ascii?Q?KdGl6ibSAHWDq6h2cSycHTCWxky4FoMHc20iqLM3p73wK7NAxPQiISRwmItf?= =?us-ascii?Q?r1h9lXwgE22xMfTzq/zj5spIh0lp/iwi1R299rtwehYAkKjnfbnIfkv2MwnE?= =?us-ascii?Q?Ysou0o0TWsJ2F4YTJkD1DBmI2/OVkPDaV7I2irko6yuYmPmsUBgUbda7q9U9?= =?us-ascii?Q?2fau3ZToFi4dtU9Bq/8RwIx60lWwRwfJcO18YpKB5tWcAovTqdwDhADsZpCQ?= =?us-ascii?Q?ozTDK61G3C1SeL1rSMZJh0T+4+n68y483uqWTyYjkzH4PmT7idAncpomcex3?= =?us-ascii?Q?xj0/HyamdkJ6N4EqCUo5Lw5ltsi9F0M32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tWXDkqJ2MNTt+yAxyf7VQ8hHPUyti6ZUuYYhSa3SVVTmGYqwUU8d4vROggadBd8a2a68zFKrHeHdNvCem0OOhlaKgHjs=; 7:IvnS1+1i7vqWMrjdLX492/dlsN2MsFNGHkvWD/H4nxXhf4/FLFYY1Lg4+hY1sTacaXTwCLG3t0BQvRlJPAPlGis31wxfte+eSiCWqtJ+X5Bb5MXytOhCmT5s9S/Ws9FPDf2dLz6WKaAhXAdzzjXLDO9hJZczUtwuXuBhfgymMzi8CgpgtJCUe5QBG3CSGP6UP3f0a6F1YeuwU8P1Xt7vYql5JwVY6T6Ypi9UMV2LPgqY+p9wldGARX4dG6Rd5XhL SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; MWHPR12MB1453; 20:K8jJ0juq+7fMA01GjzOUM7O85CzvZAJ6nCtRpL8nbpXPZbrglsZUHIYDxG4MusGgPvbVj2WZ1QrsfKaYG+DxPI4CM1KUMwCI+5monZU7S+QZYbchqjXOf+4u4PHqf0AT9X46MmVuWmwWpEKA1bGyHFSbzqWSwUC9Wphkbhj+LXxyezSa1GXFiXTfpFNyM/nFNrNIeYptteki2a/e1wFglYF4j72LQ+NShyVWVt5Tx7cp784x7fo/+F8b88VqoXCu X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Aug 2016 19:43:25.6478 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR12MB1453 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Move existing unions and structs for accessing/managing IRTE to a proper header file. This is mainly to simplify variable declarations in subsequent patches. Besides, this patch also introduces new struct irte_ga for the new 128-bit IRTE format. Signed-off-by: Suravee Suthikulpanit --- drivers/iommu/amd_iommu.c | 28 --------------- drivers/iommu/amd_iommu_types.h | 76 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 76 insertions(+), 28 deletions(-) -- 1.9.1 diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c index 634f636..ac2962f 100644 --- a/drivers/iommu/amd_iommu.c +++ b/drivers/iommu/amd_iommu.c @@ -3693,34 +3693,6 @@ EXPORT_SYMBOL(amd_iommu_device_info); * *****************************************************************************/ -union irte { - u32 val; - struct { - u32 valid : 1, - no_fault : 1, - int_type : 3, - rq_eoi : 1, - dm : 1, - rsvd_1 : 1, - destination : 8, - vector : 8, - rsvd_2 : 8; - } fields; -}; - -struct irq_2_irte { - u16 devid; /* Device ID for IRTE table */ - u16 index; /* Index into IRTE table*/ -}; - -struct amd_ir_data { - struct irq_2_irte irq_2_irte; - union irte irte_entry; - union { - struct msi_msg msi_entry; - }; -}; - static struct irq_chip amd_ir_chip; #define DTE_IRQ_PHYS_ADDR_MASK (((1ULL << 45)-1) << 6) diff --git a/drivers/iommu/amd_iommu_types.h b/drivers/iommu/amd_iommu_types.h index 25f939b..c37c5c4 100644 --- a/drivers/iommu/amd_iommu_types.h +++ b/drivers/iommu/amd_iommu_types.h @@ -22,6 +22,7 @@ #include #include +#include #include #include #include @@ -706,4 +707,79 @@ enum amd_iommu_intr_mode_type { x == AMD_IOMMU_GUEST_IR_LEGACY_GA) #define AMD_IOMMU_GUEST_IR_VAPIC(x) (x == AMD_IOMMU_GUEST_IR_VAPIC) + +union irte { + u32 val; + struct { + u32 valid : 1, + no_fault : 1, + int_type : 3, + rq_eoi : 1, + dm : 1, + rsvd_1 : 1, + destination : 8, + vector : 8, + rsvd_2 : 8; + } fields; +}; + +union irte_ga_lo { + u64 val; + + /* For int remapping */ + struct { + u64 valid : 1, + no_fault : 1, + /* ------ */ + int_type : 3, + rq_eoi : 1, + dm : 1, + /* ------ */ + guest_mode : 1, + destination : 8, + rsvd : 48; + } fields_remap; + + /* For guest vAPIC */ + struct { + u64 valid : 1, + no_fault : 1, + /* ------ */ + ga_log_intr : 1, + rsvd1 : 3, + is_run : 1, + /* ------ */ + guest_mode : 1, + destination : 8, + rsvd2 : 16, + ga_tag : 32; + } fields_vapic; +}; + +union irte_ga_hi { + u64 val; + struct { + u64 vector : 8, + rsvd_1 : 4, + ga_root_ptr : 40, + rsvd_2 : 12; + } fields; +}; + +struct irte_ga { + union irte_ga_lo lo; + union irte_ga_hi hi; +}; + +struct irq_2_irte { + u16 devid; /* Device ID for IRTE table */ + u16 index; /* Index into IRTE table*/ +}; + +struct amd_ir_data { + struct irq_2_irte irq_2_irte; + union irte irte_entry; + struct msi_msg msi_entry; +}; + #endif /* _ASM_X86_AMD_IOMMU_TYPES_H */