From patchwork Wed Jul 13 13:20:23 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Suthikulpanit, Suravee" X-Patchwork-Id: 71942 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp1105545qga; Wed, 13 Jul 2016 09:59:37 -0700 (PDT) X-Received: by 10.66.255.7 with SMTP id am7mr15383740pad.75.1468429177307; Wed, 13 Jul 2016 09:59:37 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t63si4767675pfa.44.2016.07.13.09.59.36; Wed, 13 Jul 2016 09:59:37 -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 S1751654AbcGMQ4w (ORCPT + 30 others); Wed, 13 Jul 2016 12:56:52 -0400 Received: from mail-sn1nam02on0047.outbound.protection.outlook.com ([104.47.36.47]:39232 "EHLO NAM02-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751063AbcGMQ4l (ORCPT ); Wed, 13 Jul 2016 12:56:41 -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=prL2jCKniz4sJgAopv60L11lNX4aqn8RlQERFOQgvbA=; b=n4vUSnAn00rjFNbSp96GsUVO0C8K+wMMkD/bFjOPFwCPKXRb1SJk53sPzgglAZKXyouWEgkAkVUmtp5Xbyc7zQ9ddTW2gzmX8W0GZXhVhmvjlnKInvwr4qZXr+tn6PCnxVGfHUCUTGbCmHKp78tP6w/WEfMhwF1fCiAmiMxC7iY= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Suravee.Suthikulpanit@amd.com; Received: from localhost.localdomain (114.109.128.54) by SN1PR12MB0445.namprd12.prod.outlook.com (10.162.105.139) with Microsoft SMTP Server (TLS) id 15.1.534.14; Wed, 13 Jul 2016 13:21:04 +0000 From: Suravee Suthikulpanit To: , , , CC: , , , Suravee Suthikulpanit , Suravee Suthikulpanit Subject: [PART2 PATCH v4 02/11] iommu/amd: Move and introduce new IRTE-related unions and structures Date: Wed, 13 Jul 2016 08:20:23 -0500 Message-ID: <1468416032-7692-3-git-send-email-suravee.suthikulpanit@amd.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1468416032-7692-1-git-send-email-suravee.suthikulpanit@amd.com> References: <1468416032-7692-1-git-send-email-suravee.suthikulpanit@amd.com> MIME-Version: 1.0 X-Originating-IP: [114.109.128.54] X-ClientProxiedBy: SIXPR04CA0024.apcprd04.prod.outlook.com (10.162.171.14) To SN1PR12MB0445.namprd12.prod.outlook.com (10.162.105.139) X-MS-Office365-Filtering-Correlation-Id: 04582227-1b4c-4d65-ab16-08d3ab208f76 X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0445; 2:mtwsww9WCI/rKpHCNV79usOo4mFANQYZ1cf3QwhKhcSaR5XZ02eggjt+n+fXUUm0/DaXnNLSSqtcIGjP3GJoX/kyB6OiM+6cznhx7j2sLRrsTXl3qHMZtfXKKRSXwaMYOlyIBtQy1h+j1YTaQ4cFqxunbytt4gD9cJtVmQ8R8zm9sLzhEiAXOFW69/F3s6IN; 3:RovznxpVBc8rUZarJqVcI5Oa/lFPGyS8Tegi1mhz5WX7a0QChMAq6qdJnqScvyKQjmAMHsGdS1HRGESC6KrvMX7ZY4uhCqZEiZa5AmikCSfxP8iINMP4m1YAXvgyAviw X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:SN1PR12MB0445; X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0445; 25:6cVPYjCG5EReZXBku3bfVIxvmgHkfDTwBUe6CQXTA+hEQZQubknwdcQikgnrsZzD38eGKb0/QKt+ycZWllsZizEvG6MeuHJSylu3GIk/j4ZqC6zCgZHqWTPhbMDad7PRBk66cxcmLlYWetSN1NtFQDklSRU6kIl7x4QhEZbNFsasFVIDlR0rHNL7sjATTL3Hfha+hykIXbbIRPJf6zplJHfZppctB/Tmpdmf45o7FRAmliBc+Zr0unWvKED7CUzxiN2Cz23Tf1SnOThXxuKh4/ppqaIKIcjUZfMetOZclgYku24C3glSoJRUejTLst/gF4mkeHZM/2alDTlGetRm+22wYULGijr1gSRDSMeqLqDxt8C1aPLSzRG7XlqP24c83KyR+s39Ikphcz6CdoXDg5BmshO6n96YIe/8h0eyCibeeKBYp0QcR/kOKuuv90GVTqHpu9M8E9A9zpuJ2pmViRVU9h9BseNimapE1ovCaKscmsbYsLC8inicwMU9pXTbDXc22XSM1hZfoEC2BYueZb5qhzBWZ43nq6Dw5dljhbU0vW7VSjFuNW29Zmp5JdSCB7iBe2Dy0mum4NWBlnFb4X5s6pVG2YoVKQeHYysSIC2lEMbPOlfhJ7sYjkJRQSUJXuMBZDzS15Knp1GClnevzVilD7mt6DM5IsW/G4eAPOhjrgBadlBKvVgyAG/aLpims/LJDy1ou9ogFxN4J6VCw7xJ/tzI86FieEUVLmwmWxdRvzXvmKgKQ9zgByrCujgN X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0445; 31:LQyqKENFHmMk6VWbQ0snxLyeN+aYZmW+/LQyvuBv0Kir4tDMxhZp/8AHmSl9VmxnhzFe8loC/vf7HKPvTqtU3Ujb7xk0I1yJ7Murya9PEmuw7FuiKrCP67eu4kRi2Uya5vcQUE6KaxcbDTmNXYTFz4ba3LDv4tgp6n7kG5hrTJyAxBdWuwaCOVNBoc52YiOK6aNq0RfUe6ylKlzXnqMwaQ==; 20:4WxoQVyEYVA0G4GsitJGOhWJ3+RXk7VBOxMAiuG8xBtvDAOCaxI43qR817j/igsC8dvyrd2IfZPJa9FrvO9ZvuI3mgAc7TkNPkdHIQ+WklVszl+7v4c6djH+Run47QuG3jkN9wmRfkPkWszfwVcFU9CfTETC92KsBJt+3zU7XB75vkyInJzUOxr6XPImmf1PzKrfOEh5noKGW5izkRaEBo8VM4KZW4X/pwAq1atBw96FIbTJXP7ofh4V5bxiJqTRfiZlTXg5oiTsa06mDt9go6aupUcIQx727mZEZ4PYqnZd9GFA56R6bE9Ze3Bl8qBqlvteKHdvzqK56HFifKTSC+EVyWwyYNJdYtdbv/OwU2Dpur54Fka6iTX7y1XYOdubaCe2PywwexVk2UKHahTS/VdzmZYZHAUYQ1ExyDFEIAmbJdAm3o6kWynqd4vjeKyYKuIBqwVczOKWuhfDGgKkfEgE9hCJalJ/8SUdHE/cTNBTQey6o0L3gK4QVzAz3jdq X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(8121501046)(5005006)(10201501046)(3002001)(6055026); SRVR:SN1PR12MB0445; BCL:0; PCL:0; RULEID:; SRVR:SN1PR12MB0445; X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0445; 4:LyP84x+vOYQXdZdD9IZNwi8PVFqclqa0ZmgEY0/H+Sgy/3muvge/tczBBtFKJGS/dj8O5PRJeyc5AiLgOC267y98xwuyQbGEZhjY/4Fv3OqJfkKmc2dfOHVYTnWpiYZV49rToYOGFrCybXgkibBPDNxdP1RGKXSWEaDpCzrg/8BwYMkTu6O3Lt8244yuyD3JwSL9PJWEYzEanBaMDNXIZ0fmgkYwdS4igo9clmVTMn/ZRGS4WK85pjM1XREVu5/QpHh69XR7t9EYDZg8VT8DhCQxIJPjUmIkxCv73OMQXq51p26VEh10D1xjWJp2ve50zVDgvv0J4CppHK73q6pa5zavlbY2G9yLwU6y0UBpA2MLMPs9wtjKfgLgJ/Ql0Irr2lIevc08ge0bvjfrvjCVBz7k9vZdj2lEc57VQu6gGKw= X-Forefront-PRVS: 000227DA0C X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6069001)(6009001)(7916002)(189002)(199003)(229853001)(101416001)(77096005)(8676002)(6116002)(2950100001)(42186005)(586003)(81156014)(81166006)(2201001)(3846002)(50986999)(4326007)(76176999)(50466002)(36756003)(5003940100001)(68736007)(105586002)(305945005)(47776003)(66066001)(86362001)(7846002)(50226002)(2906002)(48376002)(92566002)(106356001)(19580405001)(7736002)(33646002)(97736004)(189998001)(5001770100001)(19580395003); DIR:OUT; SFP:1101; SCL:1; SRVR:SN1PR12MB0445; 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; SN1PR12MB0445; 23:0tc6nUQut4gxCB8wTkehReNz1tPNueBcBojjwPWEi?= =?us-ascii?Q?KlrPpMod9cH3uVcvP+ED3HezpWxaYDMhHVCYv5pk4yNyvp3jMzF4BYWAcb8w?= =?us-ascii?Q?qd+T2AvNz5vZbCpubCpOtu2UpMa/YY/sOQIL96HlRiLoxvOU0p9PJXAgm/UY?= =?us-ascii?Q?p8DR8CsZeBiTJsQ/8MlAGKMbHJILuQrBf6imzeXZ6t4jITmQ/doYqOXICP4p?= =?us-ascii?Q?IS8+dqRvOhHYscC7Qv4dKZmMagH6qRH4LYIvVsohdQ4jipz+EdyJXf5Sjr+/?= =?us-ascii?Q?hFWyZCKLzA1TQk1v04B+4RieIvZ8oMhk7lN0vh8psfrkKv63BVkSZlYmXXEG?= =?us-ascii?Q?FjOPo2AmygVSJZU3JMP5ywonfeybdbuOK9ApNCz4iXSqDmF5STZvgzgI9f2F?= =?us-ascii?Q?cySBd/PrYFGGry4ROGwNXU0isAEAUVeIvZjzLCrv1c9pKXPio2uUo2Wvkh58?= =?us-ascii?Q?eWH8e2m/RixWDRCj53FjfPzZFCrcjgvIst3uUt/5JfaL+Ji3vSU8VCFxBEN4?= =?us-ascii?Q?gPQT9aZnEa6Ubqn6jIO4lDhNBXTleUvE5obmaOT1f9ZEDZza9LzPvd7L50Md?= =?us-ascii?Q?kmebFBFSGK0fFuo/s88S+cOBGcn4zNrkt5DIKvTQqnzgq38DtVSbeHXLselp?= =?us-ascii?Q?qgUtClrPA93d3bDCkuYudoZroyUDrly05tIsvgDHEENgBHUPDzt0Rpud/pjc?= =?us-ascii?Q?izoxKj4MXcyP5AMH9RFFholhAc37vWqNCs0TNKfyRV9Iv2UwJmzIT7uZIrp6?= =?us-ascii?Q?Qq/st6n/J+gfHm3rPVFgJdW+etjZJpqO3tKAxMvIJ4JFC2oGxrPH3tDKXU9R?= =?us-ascii?Q?CvgUdJ11zl8PJwAPUigaixvQGYbp31QH9gekXPDhw7vQ3bmH+9pM5lL0eQF8?= =?us-ascii?Q?EBxvJi7V6xswERLM4MOZfaRQw9P2Ksme7x9KdZHiGKSG8/ky3XjL29XnyZhc?= =?us-ascii?Q?Wx3by9WcwYPndRADR7/qbFLwVKdCYT8LX3+HooeVYtpq5QaSGWNtZNP5SqXn?= =?us-ascii?Q?I7jiJK22f1H+J9swaZL9N3vyG3Ncoiuf3BKdPEF8+988YVF9kW3d94M7cILl?= =?us-ascii?Q?EEI8uwJbRmMUZnpK3HCLYMcoDYOh1wCoA8qc8fns2cd8uRAgg=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0445; 6:Rej7r+pdGdcRwd427/rvgKYQwaer/z/5KzYWenwbAH9DRAg3EYmY2byoMed2CKF4AcVVpjuUxqhRdLHv0xQ2D2y5TXz1jCKHWK5bFcv+Wg8YvBhrCyk8M2P39Tp77axrCUoWnsH/N22hXWUy0524sf3pX3YJfw4TspobZhaA37p3j+otAD0bnwq0/I9aQX+CN5MIDDSN19gX19AqLszoEt6pApOSN8SPEnbrGKtQH/bZ1lFLtldupPDgthZ66PeXYy6zqsXE87fahEMlWH1fJZ85HZ6I1hBybXbB+TvEm8SZ2JLMNMdnMbZwjkONokKk07jNr5QWMxdwNR7tfhBVUQ==; 5:vy0BCoo23DpHNXeydw9jLbpC4xXAxHBu9jYmDPM+DKfXsxhJ2fgK59lUY2NmGa67aL1Q2i+IHpy6QhqjvPBRcwuf6hpRfYgFRjAkifswJ77X5QCAOYoegkGrDXWUHtFJ0ek2faOlwmZIywLbL4M9LA==; 24:RHbOCBP8GU3KzWpRcRFqJEaA1lfYMWd2gCD3r5l13caIvdNWt6ASKgeMLT6yasYcX+/Vv5Jl2ZuJGyZNfeR6PKyu1Yg2WJFBGrg1P/kQGpQ=; 7:PajlOZWbTv6m7dLRWbzgGp76XwxXDyata42TTI9brx+i9MD5h/HKwP6uHDtSEQVXif4+LQvsDq/exFtWJ3pFjeHFivAH+Z3Fw2qflMbg0c6c9jCUadoK+8s1b2AfNmKDurfBwVTxzKZDO9LtBZeIUxga99VmHCjxYCJ4pmnJxjGhlsQ8v08iDOgopDGIYuKdbSm2iDu4nYdqdoG2+GQcGRiTRAHEmhQgdtKr7Y3qzKeXcnl2YdVhMCnWARzA5fCO SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0445; 20:wW/a7LhMMK1xbNykWiobjTi/ZDWHu2hA43yIA/IgSLMVoUJNTDwdZwyGRY2G2VHEFG4jWS+TX7bY4ZImEJfdieKIkqSqadhaY8dSgDdrl+gf3LgfMon9SFrbO/53pl7aIOJePc6dh6j0pdjOkjH36NzR3a11jhcJnXw3rxzPD81F1ElukQh5qg+oKQU4WZTJGmv+OrQafyNE9q6e7V8mSkbJMQ0OfnQ1Ts14ShYCmbqOpIPJZFx5XTt22SHQtRF+ X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Jul 2016 13:21:04.6034 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR12MB0445 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 | 78 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 78 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..d9227a9 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,81 @@ 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; + union { + struct msi_msg msi_entry; + }; +}; + #endif /* _ASM_X86_AMD_IOMMU_TYPES_H */