From patchwork Tue Aug 23 18:52:33 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Suthikulpanit, Suravee" X-Patchwork-Id: 74509 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp2246067qga; Tue, 23 Aug 2016 11:54:49 -0700 (PDT) X-Received: by 10.98.0.83 with SMTP id 80mr56277853pfa.78.1471978488985; Tue, 23 Aug 2016 11:54:48 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id pg14si5108886pab.47.2016.08.23.11.54.48; Tue, 23 Aug 2016 11:54:48 -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 S1754482AbcHWSyq (ORCPT + 27 others); Tue, 23 Aug 2016 14:54:46 -0400 Received: from mail-cys01nam02on0075.outbound.protection.outlook.com ([104.47.37.75]:52743 "EHLO NAM02-CY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752269AbcHWSyV (ORCPT ); Tue, 23 Aug 2016 14:54:21 -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=34Z/D/HaIteAw04x1NoUxdW8Nnf4Kn2sfrksOgg63z4=; b=JSz44NNIfrxKnzhSBj2OxN4eHKfxljjIEfKhy8CWkxkJsgCtKQ+Jccfc4S4BomLk4qEbt+++aQz5/gK80btooUSRP4E+E5pNjMNB03hVUSoWazvKcxoDB1OAZaI48xZz7NBcUflIXyIfliH8R4vncY61NHEbYkMuAiygS4ssdVE= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Suravee.Suthikulpanit@amd.com; Received: from localhost.localdomain (114.109.128.54) by DM5PR12MB1452.namprd12.prod.outlook.com (10.172.38.141) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA_P384) id 15.1.557.21; Tue, 23 Aug 2016 18:53:12 +0000 From: Suravee Suthikulpanit To: , , , CC: , , , Suravee Suthikulpanit Subject: [PART2 PATCH v7 02/12] iommu/amd: Move and introduce new IRTE-related unions and structures Date: Tue, 23 Aug 2016 13:52:33 -0500 Message-ID: <1471978363-13756-3-git-send-email-Suravee.Suthikulpanit@amd.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1471978363-13756-1-git-send-email-Suravee.Suthikulpanit@amd.com> References: <1471978363-13756-1-git-send-email-Suravee.Suthikulpanit@amd.com> MIME-Version: 1.0 X-Originating-IP: [114.109.128.54] X-ClientProxiedBy: KL1PR02CA0053.apcprd02.prod.outlook.com (10.167.54.21) To DM5PR12MB1452.namprd12.prod.outlook.com (10.172.38.141) X-MS-Office365-Filtering-Correlation-Id: 071ec106-3425-451c-9193-08d3cb86bd75 X-Microsoft-Exchange-Diagnostics: 1; DM5PR12MB1452; 2:5Nc/gvPNjMYm+2DKdHVSdVu4UrpRf5HyW4P5ng8eQ6/KPezm5ozV/wx6UjW8zDd8EXRACkvKUxl9NiKzwg3lEh7W0II3pPVOPL8xll0xo+wfOX8Dmh5BvhQ1qV3Dt46HM8Grj8errRlP7KjqX6+1/lJaxsEonP2H+USK9m0ImyJlrcC6dljpM8152YTtLIf6; 3:zyHI2d4EWEgB+Trc+4obe3vRtmmeye++lHhYN+xRPQv5bbcZ51HVXd3GZYqbIzv8fBDrcqHjlfxmkwgrUTvMVNkDeubZn9qpd9AtLYpLiEVv73Hfyfdqrp3ENIO1j/s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kmflXc9hbkPh/05OhbPa1GTBrbudNdN5MARWd2/uKWwb0jAaXYwRFsN4boOKqk5CqWVTanb35KEZgGfDreIf3d5R/Q8s92BR6E+WwHy6XF1zj1kOjWScseGo3n4ha9FgML9ELs/vedD7SHH0tK4VnuhWztncfF0Wy5P2QFeOgKKS14+ohjrxEzQgF2uZLDZ9wkj28CWDK4r0rESx 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)(5005006)(8121501046)(3002001)(10201501046)(6055026); SRVR:DM5PR12MB1452; BCL:0; PCL:0; RULEID:; SRVR:DM5PR12MB1452; X-Microsoft-Exchange-Diagnostics: 1; DM5PR12MB1452; 4:tTso6XWdqvROkMm9c2wx21a4mZXSMY2A4NdWXYTy7RGRzVxEGbMdzGTqZS+6ZiJoXWRxRCTFYXKFm1207P6NuiWNiOblRgCzjccsXto3vKeiYDJMjNq53+oMVeNI4azfiQi3rg5nYXcUUFUqXSbE3QABrJXsKxIKQN2kI2i+PFqg/RLJ+oryoVv2Krm41UvkxbjbHwyIXoDXFLpu/TuRd7xlHtTUcaOTY4CIW57jXI2Y/kHbnrdmR6ilYXFcTnXDoJKM9GKU7CvYzY6ZW/ioQcdM3fx0Xa9ulgRYUlsCjzZ3I0TuV00ckc0Sj83yaEXWH74Zr8jc+VG4sE1O6y3IcBvpuEG2eW8NTvRI2J4t0eq3G7g3FmJa9gdosiCRKYuIJJsDwh28agqfzC1zl3wV1eXnTfGkYYnXFTQdgbdTJWaLLSoktHpMX39Y/AC+WaXZ X-Forefront-PRVS: 004395A01C X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6069001)(6009001)(7916002)(199003)(189002)(42186005)(76176999)(101416001)(48376002)(50466002)(77096005)(5660300001)(92566002)(105586002)(5003940100001)(36756003)(86362001)(106356001)(66066001)(50986999)(5001770100001)(19580395003)(19580405001)(50226002)(97736004)(189998001)(229853001)(3846002)(2950100001)(47776003)(8676002)(7736002)(6116002)(586003)(81156014)(68736007)(4326007)(2201001)(81166006)(305945005)(7846002)(2906002); DIR:OUT; SFP:1101; SCL:1; SRVR:DM5PR12MB1452; H:localhost.localdomain; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX: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; DM5PR12MB1452; 23:idudovFueYdS4SQqaq1/8iF+4Zd/wvcRcp/7mO9m9?= =?us-ascii?Q?mBE5nvs9PVoksATnR3NDyHUTcell8fSKNOfLmDXQUtZwQx/+tqtzHPgU90Bg?= =?us-ascii?Q?26NGZoGKO24Ds+PtoYxX0g2U+OMgDXaKyG87b8FgrVRt07O6PTMQNafxkN5X?= =?us-ascii?Q?/GTPbBhQT/xCEt1CLnSBHiL3TTj1x+yYs/xpe3pUl83+C5YExSDZtrapaFp0?= =?us-ascii?Q?1uEwmH3vJouUQTcyXJ4yJyNoahwgR78rSO00dIVy01+2BKmClpUrzlsB4mkg?= =?us-ascii?Q?a72VsEziNIck74xICNNejBcKEmHgXEVXFTSRMaFMCvs5SOuJh9tUMMm6Br/9?= =?us-ascii?Q?Dqqlv+4qRa3arrIWR5iK4oGlohlFgNXkE+h+tvjcsfa+rL4ZlZCI5jDHXF9d?= =?us-ascii?Q?kVHl5XRWywy+vle7ooa636YhzQbDf/3pRJl3lkH1u0YHTDTenz73Km0DXt2Z?= =?us-ascii?Q?KAg4nlUr5A2UAhN8FKSyunM2KQ7aJG3n2Ya2OsYIemU/vE1hUb6Oh8dFDUDE?= =?us-ascii?Q?srK/pKnTAJR6ExqEuppEJfIAhVBycm62mOnw8mQmcwYqB7iwx680aZQSSm40?= =?us-ascii?Q?IblEyNrMkpgZImFfFEXv2F7mp/jrZykOnYzoBq2FemUxWX1JQoRaQ6NufGLW?= =?us-ascii?Q?pzxXXgy42o7iwxUHYOCgS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QS7uH/s6hH1aXfqyZ4HMQ==; 24:mgX0gUqQG1UULcgtdHLH8RXHnigJKbYUm5AvLcZppi9U8j4XpjLjEVnalftnD7bd8EKTijjaZ7N5dNvce5vhcPdbQraKiaqJFN1UBZHXaQ0=; 7:jHhsIqM5dAlOLT6xHcJFnCli7X6NahyIHL3pHISSii0XqF8UWparwz9i3VDaWc1dZkRuvlWt7c95Q8qXMBDxD2eBqB8uo1mRBiYYw+k8R79L7y0gSZSBqXqOoA0lmgReP5LFU/xKeTprGf/bUWSJUrQ0SA/2Kh3miY6gFoLVp7JUcf6rD/NbbeYHiCgXvv8qtmXG4Aewllp6PAuzykpGF8sbOdqaZ7p/9fPKkyYchsuR6mVVvutBoROCjdkL0wma SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DM5PR12MB1452; 20:eg7+/e2TRMwmjiz1DA+E5pOvduTUuhUHMpyPXm0REktjafZzo2oNUf18LRn2z6s/LJ8/Ui6hvL/kL5RIOp60YMl4mE4pZDAUYVOwJTL7hgEXU11Rgrtr2d/YzPZ3+iSux0/ZL7DheNWTeySM5FGNQnx7RLvuDwAOBqZ9AjHxm7hCfJOY6eA5CzuQEOEsSXLyfoQr8luSJA3mQ8pQyAsQ6kjr+9fOE8gecY01lLIpOMYeNvfC3oRp2wTzaz088OeF X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Aug 2016 18:53:12.5082 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR12MB1452 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Suravee Suthikulpanit 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 */