From patchwork Mon Jul 25 09:32:03 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Suthikulpanit, Suravee" X-Patchwork-Id: 72698 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp1049057qga; Mon, 25 Jul 2016 02:36:08 -0700 (PDT) X-Received: by 10.98.0.83 with SMTP id 80mr498853pfa.78.1469439367882; Mon, 25 Jul 2016 02:36:07 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id sy10si32765439pab.259.2016.07.25.02.36.07; Mon, 25 Jul 2016 02:36:07 -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 S1753202AbcGYJfx (ORCPT + 29 others); Mon, 25 Jul 2016 05:35:53 -0400 Received: from mail-sn1nam01on0076.outbound.protection.outlook.com ([104.47.32.76]:16256 "EHLO NAM01-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752783AbcGYJdL (ORCPT ); Mon, 25 Jul 2016 05:33:11 -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=J/kRT3lZwCnqN/OwhFjPaomO907kEi7IE7wrvrtTPH8=; b=IrCBdRphU+xPH4B0kIwN41M6Hq2iGdEndArVMz2ylSo0Fgj++C9+9vlzDCieoXxncmbiOyjDquzSjmI4hdI5G6pM00HtmRtDcThMFGKgQSsmSpD0WYvKj2YTARnFQnQZGu6ozyOyPAqThKF0t7aW4NL52vSmRXoTYKfaBIAedlQ= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Suravee.Suthikulpanit@amd.com; Received: from localhost.localdomain (114.109.128.54) by BLUPR12MB0434.namprd12.prod.outlook.com (10.162.92.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.549.15; Mon, 25 Jul 2016 09:32:55 +0000 From: Suravee Suthikulpanit To: , , , CC: , , , Suravee Suthikulpanit Subject: [PART2 PATCH v5 04/12] iommu/amd: Add support for multiple IRTE formats Date: Mon, 25 Jul 2016 04:32:03 -0500 Message-ID: <1469439131-11308-5-git-send-email-suravee.suthikulpanit@amd.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1469439131-11308-1-git-send-email-suravee.suthikulpanit@amd.com> References: <1469439131-11308-1-git-send-email-suravee.suthikulpanit@amd.com> MIME-Version: 1.0 X-Originating-IP: [114.109.128.54] X-ClientProxiedBy: SG2PR06CA0066.apcprd06.prod.outlook.com (10.167.73.162) To BLUPR12MB0434.namprd12.prod.outlook.com (10.162.92.14) X-MS-Office365-Filtering-Correlation-Id: d9e54c2f-97b0-45c8-7948-08d3b46ea9fb X-Microsoft-Exchange-Diagnostics: 1; BLUPR12MB0434; 2:M0QD0/WJOHBSDbcvjeRHm17pWpzzx7Wdbg+z9/iL8UPMk+pySIRB8/CgkL76IlKGdpo8Y/XA7XfPrTcUyPkyaG8ESLmqLRhr9F3Xf3n6qajXgWV0716ZrU02vN15kEEqIVPlUxpcHM1z123q0in1QOMD50RGSHsuNCFO+nKrpsJNvtqfNf3/ZB97PYvzJW0D; 3:exGPDYKkrPOugGEoobikSPFCXIi9SVXAIZJ7/wvHSedRBb51mmOHPzEtOerYX0KBalLnrG78dnJ9/60R2RVwhvyf5DiTBwhYwwF3XvxM4WsQLT3ue/5OVyoP3PiRt2xL; 25:Xfp8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fMzwxCqlDhFGixbP5DW7PiqFkArpu13RbAjYNgKsTYAlsjaZVDdvxh0v2+AKX63RImYAjx9CCmsKlHkam6Ba7YqB8UNWwOK3GxgOHR6AXluFVY44+IRlF4dg7wEURihHL6WOgdttI3ptEUZGSD2LY/IbBcRZ1LMC; 4:odoyXP4oJYgGZJNGlzSZ3+oNPub/Rtw6YDr6G+hP3F+To5Wbgta6Xg1GG9DuxTx5tpQ5UDcKXief7ME8azvl/A/iXw1XDDej0WBjxMKKbjujVmV5/b3fWZmw3XpeJH/cMXafWq+HSoB+h5ZIUUwoJ3k7UuhE4mAt5DvqDsTTNPznLSfdeJeAPXbCaardqOBLZbyxYbPbhXaIg77sZRKE9yCSbwfb21UxSFzs2JhedLSEa4DdJ9kakykaySDAO3n/oRRyr+oHjGwP8XrObfqwSAD7UORhQdGD/KGSmru8YYCyrg6IePkbSl+IaNXF4u1uoEX1yBVWlpvhaHbSH6+PjI9vFEnbLj70nRncbjdXmmHcvGxSvKUCCxg0i7fK2Ov7hGjUAFGHK27TrGLR5OOV2OT6pBRjWOSK89+SoZl3XXzAWMw/VVduwyIaPNLUF1px X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046)(6055026); SRVR:BLUPR12MB0434; BCL:0; PCL:0; RULEID:; SRVR:BLUPR12MB0434; X-Forefront-PRVS: 0014E2CF50 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6069001)(6009001)(7916002)(189002)(199003)(77096005)(229853001)(50986999)(76176999)(586003)(48376002)(105586002)(19580405001)(81156014)(81166006)(8676002)(97736004)(4326007)(42186005)(5001770100001)(189998001)(2906002)(50226002)(19580395003)(50466002)(7846002)(66066001)(5003940100001)(68736007)(92566002)(86362001)(101416001)(7736002)(305945005)(3846002)(6116002)(2950100001)(106356001)(47776003)(36756003)(33646002)(2201001); DIR:OUT; SFP:1101; SCL:1; SRVR:BLUPR12MB0434; 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; BLUPR12MB0434; 23:BmRq/XOc4Am+RU+X3hXZsPeIig93z+ZJhs9XfNifF?= =?us-ascii?Q?iDg1R0kD+GFNW7Is8JtmzF7vwWGhzjyTH3yJCnIcVVioI55o30C8KUJYAFel?= =?us-ascii?Q?cPDdsAjkmyncT98OYDiVj9PbkALbcpKi/hP1o1ahnXCaGcKq+DmWhqIdxPV8?= =?us-ascii?Q?bekt9gfahLTdsIicjsdzeewAyTNDnuWfSBoQU9A3mtAJ1bEc5fdp8BVGYUlI?= =?us-ascii?Q?QPMmNUtlu/TAdwiJEifJQe8mO3FWh6+SZv0VRjK0G/zjuirgNqWLq6BZstvE?= =?us-ascii?Q?A5Kdzj1/YzGIjCuKPbcECn95Uc0M+Z8QVQwVv3noHPdZpx+sFDm50XMgwLVX?= =?us-ascii?Q?wXTp499ExupjJDX48xlfpSgtDnvvZMk5GLDagJ6FedZSVh3d0zE3PbvtBIi5?= =?us-ascii?Q?MNFfVZD9w5+gSWopw13Z3b17LFDDxe0c/FMq+DNpFJDtz6GhpDxWY25Nc9ok?= =?us-ascii?Q?+iUoh3q29hUwL5edBPLDqI2K22q6PR8yObqAGBA/Cwmx7DmK7ScU4HICVGR8?= =?us-ascii?Q?8n8UoSI8i6b8S6JLDpT12SSM1Ax8n8cBSLIe7tT9lXNOi9pgAhApIpN+Zwc8?= =?us-ascii?Q?E+jJ1lvGx30ijQH5K8MJNTIcNZzJVLS6ZtB8x0gx3mXO94OR6uSxyKX2XNWZ?= =?us-ascii?Q?ZDdO6w9RKetU/vqjHegTI/k+6Bynu1thINfNTT6xT1tP5pdSpx/5z7W8KDfF?= =?us-ascii?Q?HaVC5qwH25Bv0mWgZAL9K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B/MqJbTp69wYJ7zmFU81TiwkuCgwmdvVntn0IhdR+gvpXwDpNJgLla6A+Ow=; 7:6wNqS5f3aMs0bfTgCvHfExUhkJQiU3X9KZtz+WD9QbMbByAIYM9NG/a3xl6iO2QhooshGMfIs8aFKyT7oBA3hAckpDKZTVw/KAhAZKIgKfxupXKY50+C4ir1223CLhoGiZbpCTSGUOccdKF4DUM17L8VWI8ihSWTCARAHYfHnVWss1A8srncsecO0UFnjzqayUoP7syCC10JexDJLbfB+P/wVySuiZdLmFw/uziGoe2Jt2TE4yFeKimTY4x5dy8S SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BLUPR12MB0434; 20:gvxLElv0k/64Vjyb6ZNcP3/dgWToC+121hi6bE3EkAEZpM8ayIOIhApQbaDrhxT+Sw3eR7hwjo4DwicGUqfDzaP+SDGxOY+eVbw3/xb6Yq8cXG8Lopo4QZA4car79r15ihIh/hOd2+7oD+4mxSLExXnOeymfv71kdOKyDob5yzbX29QggmqByk/3jnYMlNykl7ffpHVyRxhUSnsKUhzVK3cQnRzjTIT2y+uXNunQnxQ6Vym/c8MqMXC6rdh+d4j9 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jul 2016 09:32:55.2081 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BLUPR12MB0434 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Suravee Suthikulpanit This patch enables support for the new 128-bit IOMMU IRTE format, which can be used for both legacy and vapic interrupt remapping modes. It replaces the existing operations on IRTE, which can only support the older 32-bit IRTE format, with calls to the new struct amd_irt_ops. It also provides helper functions for setting up, accessing, and updating interrupt remapping table entries in different mode. Signed-off-by: Suravee Suthikulpanit --- drivers/iommu/amd_iommu.c | 72 +++++++++++++++++++++++++++-------------- drivers/iommu/amd_iommu_init.c | 2 ++ drivers/iommu/amd_iommu_types.h | 1 - 3 files changed, 50 insertions(+), 25 deletions(-) -- 1.9.1 diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c index 139ea8b..abfb2b7 100644 --- a/drivers/iommu/amd_iommu.c +++ b/drivers/iommu/amd_iommu.c @@ -3714,8 +3714,6 @@ static void set_dte_irq_entry(u16 devid, struct irq_remap_table *table) amd_iommu_dev_table[devid].data[2] = dte; } -#define IRTE_ALLOCATED (~1U) - static struct irq_remap_table *get_irq_table(u16 devid, bool ioapic) { struct irq_remap_table *table = NULL; @@ -3761,13 +3759,18 @@ static struct irq_remap_table *get_irq_table(u16 devid, bool ioapic) goto out; } - memset(table->table, 0, MAX_IRQS_PER_TABLE * sizeof(u32)); + if (!AMD_IOMMU_GUEST_IR_GA(amd_iommu_guest_ir)) + memset(table->table, 0, + MAX_IRQS_PER_TABLE * sizeof(u32)); + else + memset(table->table, 0, + (MAX_IRQS_PER_TABLE * (sizeof(u64) * 2))); if (ioapic) { int i; for (i = 0; i < 32; ++i) - table->table[i] = IRTE_ALLOCATED; + iommu->irte_ops->set_allocated(table, i); } irq_lookup_table[devid] = table; @@ -3793,6 +3796,10 @@ static int alloc_irq_index(u16 devid, int count) struct irq_remap_table *table; unsigned long flags; int index, c; + struct amd_iommu *iommu = amd_iommu_rlookup_table[devid]; + + if (!iommu) + return -ENODEV; table = get_irq_table(devid, false); if (!table) @@ -3804,14 +3811,14 @@ static int alloc_irq_index(u16 devid, int count) for (c = 0, index = table->min_index; index < MAX_IRQS_PER_TABLE; ++index) { - if (table->table[index] == 0) + if (!iommu->irte_ops->is_allocated(table, index)) c += 1; else c = 0; if (c == count) { for (; c != 0; --c) - table->table[index - c + 1] = IRTE_ALLOCATED; + iommu->irte_ops->set_allocated(table, index - c + 1); index -= count - 1; goto out; @@ -3900,7 +3907,7 @@ static void free_irte(u16 devid, int index) return; spin_lock_irqsave(&table->lock, flags); - table->table[index] = 0; + iommu->irte_ops->clear_allocated(table, index); spin_unlock_irqrestore(&table->lock, flags); iommu_flush_irt(iommu, devid); @@ -3990,6 +3997,7 @@ static void irte_ga_set_affinity(void *entry, u16 devid, u16 index, modify_irte_ga(devid, index, irte); } +#define IRTE_ALLOCATED (~1U) static void irte_set_allocated(struct irq_remap_table *table, int index) { table->table[index] = IRTE_ALLOCATED; @@ -4119,19 +4127,17 @@ static void irq_remapping_prepare_irte(struct amd_ir_data *data, { struct irq_2_irte *irte_info = &data->irq_2_irte; struct msi_msg *msg = &data->msi_entry; - union irte *irte = &data->irte_entry; struct IO_APIC_route_entry *entry; + struct amd_iommu *iommu = amd_iommu_rlookup_table[devid]; + + if (!iommu) + return; data->irq_2_irte.devid = devid; data->irq_2_irte.index = index + sub_handle; - - /* Setup IRTE for IOMMU */ - irte->val = 0; - irte->fields.vector = irq_cfg->vector; - irte->fields.int_type = apic->irq_delivery_mode; - irte->fields.destination = irq_cfg->dest_apicid; - irte->fields.dm = apic->irq_dest_mode; - irte->fields.valid = 1; + iommu->irte_ops->prepare(data->entry, apic->irq_delivery_mode, + apic->irq_dest_mode, irq_cfg->vector, + irq_cfg->dest_apicid); switch (info->type) { case X86_IRQ_ALLOC_TYPE_IOAPIC: @@ -4187,7 +4193,7 @@ static int irq_remapping_alloc(struct irq_domain *domain, unsigned int virq, { struct irq_alloc_info *info = arg; struct irq_data *irq_data; - struct amd_ir_data *data; + struct amd_ir_data *data = NULL; struct irq_cfg *cfg; int i, ret, devid; int index = -1; @@ -4239,6 +4245,16 @@ static int irq_remapping_alloc(struct irq_domain *domain, unsigned int virq, if (!data) goto out_free_data; + if (!AMD_IOMMU_GUEST_IR_GA(amd_iommu_guest_ir)) + data->entry = kzalloc(sizeof(union irte), GFP_KERNEL); + else + data->entry = kzalloc(sizeof(struct irte_ga), + GFP_KERNEL); + if (!data->entry) { + kfree(data); + goto out_free_data; + } + irq_data->hwirq = (devid << 16) + i; irq_data->chip_data = data; irq_data->chip = &amd_ir_chip; @@ -4275,6 +4291,7 @@ static void irq_remapping_free(struct irq_domain *domain, unsigned int virq, data = irq_data->chip_data; irte_info = &data->irq_2_irte; free_irte(irte_info->devid, irte_info->index); + kfree(data->entry); kfree(data); } } @@ -4286,8 +4303,11 @@ static void irq_remapping_activate(struct irq_domain *domain, { struct amd_ir_data *data = irq_data->chip_data; struct irq_2_irte *irte_info = &data->irq_2_irte; + struct amd_iommu *iommu = amd_iommu_rlookup_table[irte_info->devid]; - modify_irte(irte_info->devid, irte_info->index, &data->irte_entry); + if (iommu) + iommu->irte_ops->activate(data->entry, irte_info->devid, + irte_info->index); } static void irq_remapping_deactivate(struct irq_domain *domain, @@ -4295,10 +4315,11 @@ static void irq_remapping_deactivate(struct irq_domain *domain, { struct amd_ir_data *data = irq_data->chip_data; struct irq_2_irte *irte_info = &data->irq_2_irte; - union irte entry; + struct amd_iommu *iommu = amd_iommu_rlookup_table[irte_info->devid]; - entry.val = 0; - modify_irte(irte_info->devid, irte_info->index, &data->irte_entry); + if (iommu) + iommu->irte_ops->deactivate(data->entry, irte_info->devid, + irte_info->index); } static struct irq_domain_ops amd_ir_domain_ops = { @@ -4315,8 +4336,12 @@ static int amd_ir_set_affinity(struct irq_data *data, struct irq_2_irte *irte_info = &ir_data->irq_2_irte; struct irq_cfg *cfg = irqd_cfg(data); struct irq_data *parent = data->parent_data; + struct amd_iommu *iommu = amd_iommu_rlookup_table[irte_info->devid]; int ret; + if (!iommu) + return -ENODEV; + ret = parent->chip->irq_set_affinity(parent, mask, force); if (ret < 0 || ret == IRQ_SET_MASK_OK_DONE) return ret; @@ -4325,9 +4350,8 @@ static int amd_ir_set_affinity(struct irq_data *data, * Atomically updates the IRTE with the new destination, vector * and flushes the interrupt entry cache. */ - ir_data->irte_entry.fields.vector = cfg->vector; - ir_data->irte_entry.fields.destination = cfg->dest_apicid; - modify_irte(irte_info->devid, irte_info->index, &ir_data->irte_entry); + iommu->irte_ops->set_affinity(ir_data->entry, irte_info->devid, + irte_info->index, cfg->vector, cfg->dest_apicid); /* * After this point, all the interrupts will start arriving diff --git a/drivers/iommu/amd_iommu_init.c b/drivers/iommu/amd_iommu_init.c index d0930b1..6635cdf 100644 --- a/drivers/iommu/amd_iommu_init.c +++ b/drivers/iommu/amd_iommu_init.c @@ -1883,8 +1883,10 @@ static void iommu_enable_ga(struct amd_iommu *iommu) /* Fall through */ case AMD_IOMMU_GUEST_IR_LEGACY_GA: iommu_feature_enable(iommu, CONTROL_GA_EN); + iommu->irte_ops = &irte_128_ops; break; default: + iommu->irte_ops = &irte_32_ops; break; } #endif diff --git a/drivers/iommu/amd_iommu_types.h b/drivers/iommu/amd_iommu_types.h index 2a3819a..4fad61a 100644 --- a/drivers/iommu/amd_iommu_types.h +++ b/drivers/iommu/amd_iommu_types.h @@ -792,7 +792,6 @@ struct amd_irte_ops { struct amd_ir_data { struct irq_2_irte irq_2_irte; - union irte irte_entry; void *entry; /* Pointer to union irte or struct irte_ga */ union { struct msi_msg msi_entry;