From patchwork Mon Jul 11 10:11:32 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Suthikulpanit, Suravee" X-Patchwork-Id: 71724 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp538814qga; Mon, 11 Jul 2016 03:45:10 -0700 (PDT) X-Received: by 10.66.248.3 with SMTP id yi3mr33748966pac.61.1468233910112; Mon, 11 Jul 2016 03:45:10 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i1si3399138pfj.61.2016.07.11.03.45.09; Mon, 11 Jul 2016 03:45:10 -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 S1030554AbcGKKpA (ORCPT + 30 others); Mon, 11 Jul 2016 06:45:00 -0400 Received: from mail-by2nam01on0070.outbound.protection.outlook.com ([104.47.34.70]:63856 "EHLO NAM01-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1030391AbcGKKoz (ORCPT ); Mon, 11 Jul 2016 06:44:55 -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=LR3WOotMD3Lmarf/nx+fQwns4uJBveU82ZHma+XHkfk=; b=QhF+2kxUllJblcwwmvdPG2W5MtFYbZoyri+3nqhK8bSeTconQGFvBXBJbH7o9oNvnZEgy4NGZVWK8Ksb0yB1NJQqdgt+Cux3c5yVrSTtiyW31b4eXtlbCFCoIpXIjxztquTu9FzJTT2TlGOOXrqU5JoA/9Z/xIuj1zRi9EBfMFs= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Suravee.Suthikulpanit@amd.com; Received: from localhost.localdomain (124.121.8.20) by CY1PR12MB0444.namprd12.prod.outlook.com (10.163.91.22) with Microsoft SMTP Server (TLS) id 15.1.534.14; Mon, 11 Jul 2016 10:12:33 +0000 From: Suravee Suthikulpanit To: , , , CC: , , , Suravee Suthikulpanit Subject: [PART2 PATCH v3 04/11] iommu/amd: Add support for multiple IRTE formats Date: Mon, 11 Jul 2016 05:11:32 -0500 Message-ID: <1468231899-6987-5-git-send-email-suravee.suthikulpanit@amd.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1468231899-6987-1-git-send-email-suravee.suthikulpanit@amd.com> References: <1468231899-6987-1-git-send-email-suravee.suthikulpanit@amd.com> MIME-Version: 1.0 X-Originating-IP: [124.121.8.20] X-ClientProxiedBy: SG2PR03CA0026.apcprd03.prod.outlook.com (10.160.233.36) To CY1PR12MB0444.namprd12.prod.outlook.com (10.163.91.22) X-MS-Office365-Filtering-Correlation-Id: 8f968d48-9ef8-490e-67b9-08d3a973e1a7 X-Microsoft-Exchange-Diagnostics: 1; CY1PR12MB0444; 2:W1j55i8ok2EIxccHeAduCj23j81/t7Fx3qzWAKQ8QDQhzA9CXJntU3GL/0yQrndli3XSioy0hZZJnKPqWQJNMiDcLw4RjetFZ5jnpCDm9EA1WxxUhd3HxHSmP5gbX9BVoPGv0q3kK/aT9+EJtn5LAMS2PaWqAq46eB0ZVkVEE6LmWV0KC0k+7ft5UQmbH1uZ; 3:EpseT5BTBXgYWUyVpSGW7QQyVhqrt6sByB9c96O67ksQBqK9l9HB1Sp3KsjIpi5IWFkUd3tBpx4f+MrNbmqLhrBMu8WAzt/lohmr6aqDtGWLntlodW4AlSGuKrQJMHWd; 25:RBbR5NP62QlsHGi/PMUpB/F3o+tHgWQWTUfFWl7qtHv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bKj6HSQGeCmj+M5RqRbpbbRKnS665+LihgK4txSceqTawehxY1PQDH4p4EGyeXsl5Ho9v2rhBsv32mf7B6OrJVEi9IcAqRFvoTUPUQknLFkDmnsYyx9yMlEqiWvIm; 4:6B4Hz8JgPxuCC/OolZGF6DyeFeWkBvWNQhi7JBL0K16vpn2MtptXcNdKF8YD8lmgs2LEt+kWM/TsXIWgnE3yJnadog2kxckP01luLTakx1oWYLSVMDHk3toYNhk53F2aY/if5PgBk0G57P4/RMZowkJBFIPZLSOuJyrdXrmi92pE5mHy4UA2vXIt1Bk2CA41+WopGi3ldhsagdUck67cznTlG869Anwec2BPsy9m31icQkw9SEmX2mkL7+ry0+yNg4mFG8VCkHgoQF5mAWomeYt6trSwxaSkPZKk6gkqcwDsFkyJgVc47JuFd2+lAdoO8Ddn4uHQGJ//c9z+gGRpIv/PQWKWB502/w6RpgbpIUtYPUc1H6eMt6xLymxFGdGfCfr0wuVefEz+7C4pdAnvQK+QxWzHLpTB8y/lTgSIvTk= 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)(3002001)(10201501046)(6055026); SRVR:CY1PR12MB0444; BCL:0; PCL:0; RULEID:; SRVR:CY1PR12MB0444; X-Forefront-PRVS: 00003DBFE7 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(6069001)(7916002)(189002)(199003)(3846002)(6116002)(2201001)(101416001)(81166006)(86362001)(5003940100001)(47776003)(586003)(189998001)(106356001)(66066001)(7736002)(77096005)(5001770100001)(36756003)(97736004)(50466002)(33646002)(50986999)(19580405001)(81156014)(305945005)(68736007)(4326007)(50226002)(19580395003)(48376002)(8676002)(105586002)(76176999)(7846002)(92566002)(42186005)(2906002)(2950100001)(229853001); DIR:OUT; SFP:1101; SCL:1; SRVR:CY1PR12MB0444; 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; CY1PR12MB0444; 23:iBL20ysgj4zhyK0zWUafey8fYhhkwvhOSoLR4kY98?= =?us-ascii?Q?dNtyrW5fBrY9W03GTKGO4JhJ8pUW+/zMfiVrkT6gjyUXri16APuXooQqsVL6?= =?us-ascii?Q?UspgE+/tMbKzOQagv8aaEPpe+F82HjFrTm+taPnF0Ee5N9zKYCnAMqWLacXI?= =?us-ascii?Q?rWVbPJ4f2R3krtTj+6/wtlfSp1OVfRNWRVj5G+a09ioLo25MLPQE5IXi7wdo?= =?us-ascii?Q?+fNRQqjjiendFq4wmPVtnsOxIFy1WK0q9AVAGaUhI60734WkuJdSo1pi3UEG?= =?us-ascii?Q?IoACKaVHIZ/UekZdO7j0ml/v/RPatb39MFUwL/j97O7iz2QxgZMd8WIBzA4r?= =?us-ascii?Q?F/bnNe5EjqSRO1VxDfVJ93Hqbp/kjFi9Qq/GZ9hyPrRv20u4ac9GLhWBL5ll?= =?us-ascii?Q?zZFig1FNfQWlM6wE+E7e5EgthiAyiQnjnBFLbeSh5gqCTfN9xrqWt+okfpAz?= =?us-ascii?Q?X21+l67u7aqLJf8msxwPxvyACz1t/thf8ZcxpO+dAa3pv54Z615sIdLHvs4h?= =?us-ascii?Q?jnUp211xQvlwZh7pBJU/bg5pAYAMhVAU9T8n6NUjlLo8E9YN6R3qCUObeVGD?= =?us-ascii?Q?8VYNj1N/PBJbDgJwWHytf/dOBxSgY5docOO8f/YcTcgIQMwteMimx5Oriv1a?= =?us-ascii?Q?3GFp53YGjWchg8yw8Awdmp46TiLmzCYAdLlude4nAMYWsOOU+ppmgT/uA/4K?= =?us-ascii?Q?TXGL3NbDFFLlpuiBmoVQFZSUiAw/bwPuOfbxIBM2sKThJ7PDNUwJulhpEwSx?= =?us-ascii?Q?q3w9UY/dVuIjX1o2+prgji0kVFj+x61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KwMdcffpBLKrOw9Fx/2xFqZKip2Mllpx2o5ViAaksgAwfZbTW1ROccHd+rWogvdBBCeJ5CGX3Ori1Gr/JmT5BEMI0lb//6rfsAxLUgTro1ANb73Wec7vrqmunEONJEZX1xNHV3h56ZKzi2H4tGJHQ93Eb6YPwuyOohbCWK6O+rbzcSpBWKcmusgXysnQU0RkboeZmqcaxqKaq7nyNbh4FlIut9T SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; CY1PR12MB0444; 20:emcbgkCU46vVUmOYwBn/lSj0rhVLUy3gO6e6g3yVqJAzzVjG/wfgrMeS+7rZp8yTF3Ycik3hwyNOYGD1k6V8Y2g0B8PCf+DfdHHzdU92Xk8Iz5geKix0GJWckidI+GFy6zsGLi3iEHNBPFAumonEzLAvZIGo+0/GegIYqiGkWNG8xuec1eby40lfPkfMothGZHU63Zc6b4X991zv/658mDQZ48tv0LZzxl7h8i++5dm94d97/P9fsg+B8iqaJVRA X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Jul 2016 10:12:33.5686 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR12MB0444 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 cc59fc5..84d3918 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; union { struct msi_msg msi_entry;