From patchwork Fri Apr 8 12:49: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: 65405 Delivered-To: patch@linaro.org Received: by 10.112.43.237 with SMTP id z13csp50563lbl; Fri, 8 Apr 2016 05:52:58 -0700 (PDT) X-Received: by 10.66.146.39 with SMTP id sz7mr12727928pab.76.1460119977164; Fri, 08 Apr 2016 05:52:57 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p10si759523pfj.229.2016.04.08.05.52.56; Fri, 08 Apr 2016 05:52:57 -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 S1758443AbcDHMwo (ORCPT + 29 others); Fri, 8 Apr 2016 08:52:44 -0400 Received: from mail-by2on0081.outbound.protection.outlook.com ([207.46.100.81]:35616 "EHLO na01-by2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932685AbcDHMuF (ORCPT ); Fri, 8 Apr 2016 08:50:05 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:To:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=LzTIfhD0Vyq5NUC32SKres/9CSqdJM4T7E43NJ6oK0w=; b=ujOlNtdcafXNZ7I4P9EV2apkAVwbB/lfO7xA6YwtsuCx6ktlAMFXoFZinTrURQm04rT9ObzXYl5WSg4TBdAUqX5an3q4PjT39+ftNzzx276rMsPLAiigTm5bYvTa+3iESZHnXQzkV8FjbkIDRKisTQosuKfbktPeXR1WJwIxPDE= Authentication-Results: redhat.com; dkim=none (message not signed) header.d=none; redhat.com; dmarc=none action=none header.from=amd.com; Received: from localhost.localdomain (124.121.8.20) by SN1PR12MB0446.namprd12.prod.outlook.com (10.162.105.14) with Microsoft SMTP Server (TLS) id 15.1.453.26; Fri, 8 Apr 2016 12:49:59 +0000 From: Suravee Suthikulpanit To: , , , , , CC: , , , , Suravee Suthikulpanit Subject: [PART2 RFC v1 2/9] iommu/amd: Add data structure for guest vAPIC support Date: Fri, 8 Apr 2016 07:49:23 -0500 Message-ID: <1460119770-2896-3-git-send-email-Suravee.Suthikulpanit@amd.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1460119770-2896-1-git-send-email-Suravee.Suthikulpanit@amd.com> References: <1460119770-2896-1-git-send-email-Suravee.Suthikulpanit@amd.com> MIME-Version: 1.0 X-Originating-IP: [124.121.8.20] X-ClientProxiedBy: HKNPR06CA0022.apcprd06.prod.outlook.com (10.141.16.12) To SN1PR12MB0446.namprd12.prod.outlook.com (10.162.105.14) X-MS-Office365-Filtering-Correlation-Id: 32e32afe-6099-4134-fdbf-08d35fac4d96 X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0446; 2:/KH9QU/ZOu5emsqxHO+aMRwMN+3exDvMeM2B3MYQo16RFE3v7oJWAYd2WGkX4gvgMv6fH9UeaCSXphj1Sxvqxg4mWZwjKEUj0jj4EIetmOjj6u36ny0g8ff6a9mltadofNPzM919gMvE4IadLfwWeKM56Ge8CvVKG8C+/276WCk1QuWiC/MoJRNFu1s80TVp; 3:97tTfiYw4fpYrKCd0nMEiULyxnVqN+JTQfem/IDPug1qMPa+wraB2MXEzmMxg21TaBZ+BnAPpNGCL2N+hio/CiQPsvZwfTTFhe2htgEb6ZBoBrBCFHW9F1am2He5iubD; 25:bXRYFca1QBkNPoK9AP9XkPQhiXwAaU81roQVknH5E7KCuXeqGujkpum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11TkGFhX3KZ8fh0Fsug0YOCzKLeWzCsl9mXDaXZwwIwYeMDRHkUOVsAZhFG3xHTCWg5vihuhkV3pyTfEG1qpcAOmHXFlwtV5q990B1PKR5Dcvs5cw6B39spOu5TC0H6yWHOqoSXr5WJWd+ntb34pdSMUFerH6GoeIeTlH+sPFRm+Z2Ft+eDe5E91ynzmDO/jkNN9/Ah/R6z3YhjTZMKwtX+tB X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046); SRVR:SN1PR12MB0446; BCL:0; PCL:0; RULEID:; SRVR:SN1PR12MB0446; X-Forefront-PRVS: 0906E83A25 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6069001)(6009001)(50466002)(48376002)(77096005)(47776003)(66066001)(229853001)(36756003)(86362001)(1096002)(42186005)(19580405001)(19580395003)(92566002)(6116002)(3846002)(586003)(5004730100002)(50986999)(76176999)(4326007)(189998001)(5003940100001)(2950100001)(2201001)(2906002)(5008740100001)(5001770100001)(81166005)(50226001); DIR:OUT; SFP:1101; SCL:1; SRVR:SN1PR12MB0446; H:localhost.localdomain; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0446; 23:wcw3UYRHHsJEaTtawysDO5vFUaJfgVn6+UT/yNJlYPHueGn9t5jtb60Vjix2iTWyJDNZQcw4r1yY7Lxh0tuNvY2aUpSS4XMhKldCQya7fDwJGbX9HY4TufqvX/YYQa7Oz0hYPcsiTj129RSHjBSF5e2YueIxZH/Waw8Hlf+Do125lJ5C3SdPOvcV2byBnpMSSR9Ir+8dewGNpGmKkMvd6R567Ygtz9Lyhf8u41ThrVQp1pfgkx6bu/zEW2YYytWRCJs96lQ1sw1Y0pLJ4uEP+LTcEqO5nfRy7YvZboMkrWG51wXvjNNsXb7KGzvblIkHJajyL8E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LAqnrGBgfNEjFvjElPovVFkMV5yuQNIDz1GDZXzidimTErGWclEPwxU+AjZCqKGSI X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Apr 2016 12:49:59.5906 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR12MB0446 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Suravee Suthikulpanit This patch adds new data structure for the 128-bit IOMMU IRTE format, which can support both legacy and GA interrupt remapping modes. 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 | 188 ++++++++++++++++++++++++++++++++-------- drivers/iommu/amd_iommu_types.h | 63 ++++++++++++++ 2 files changed, 217 insertions(+), 34 deletions(-) -- 1.9.1 diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c index 374c129..af6079a 100644 --- a/drivers/iommu/amd_iommu.c +++ b/drivers/iommu/amd_iommu.c @@ -3601,21 +3601,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*/ @@ -3624,6 +3609,7 @@ struct irq_2_irte { struct amd_ir_data { struct irq_2_irte irq_2_irte; union irte irte_entry; + struct irte_ga irte_ga_entry; union { struct msi_msg msi_entry; }; @@ -3650,7 +3636,60 @@ static void set_dte_irq_entry(u16 devid, struct irq_remap_table *table) amd_iommu_dev_table[devid].data[2] = dte; } +void *amd_iommu_get_irte(struct irq_remap_table *table, int index) +{ + void *ret = NULL; + + if (!amd_iommu_guest_ir) { + union irte *ptr = (union irte *)table->table; + + ret = &ptr[index]; + } else { + struct irte_ga *ptr = (struct irte_ga *)table->table; + + ret = &ptr[index]; + } + return ret; +} + #define IRTE_ALLOCATED (~1U) +static void set_irte_allocated(struct irq_remap_table *table, int index) +{ + if (!amd_iommu_guest_ir) { + table->table[index] = IRTE_ALLOCATED; + } else { + struct irte_ga *irte = amd_iommu_get_irte(table, index); + + memset(&irte->lo.val, 0, sizeof(u64)); + memset(&irte->hi.val, 0, sizeof(u64)); + irte->hi.fields.vector = 0xff; + } +} + +static bool is_irte_allocated(struct irq_remap_table *table, int index) +{ + if (!amd_iommu_guest_ir) { + union irte *irte = amd_iommu_get_irte(table, index); + + return irte->val != 0; + } else { + struct irte_ga *irte = amd_iommu_get_irte(table, index); + + return irte->hi.fields.vector != 0; + } +} + +static void clear_irte(struct irq_remap_table *table, int index) +{ + if (!amd_iommu_guest_ir) { + table->table[index] = 0; + } else { + struct irte_ga *irte = amd_iommu_get_irte(table, index); + + memset(&irte->lo.val, 0, sizeof(u64)); + memset(&irte->hi.val, 0, sizeof(u64)); + } +} static struct irq_remap_table *get_irq_table(u16 devid, bool ioapic) { @@ -3697,13 +3736,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) + 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; + set_irte_allocated(table, i); } irq_lookup_table[devid] = table; @@ -3740,14 +3784,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 (!is_irte_allocated(table, index)) c += 1; else c = 0; if (c == count) { for (; c != 0; --c) - table->table[index - c + 1] = IRTE_ALLOCATED; + set_irte_allocated(table, index - c + 1); index -= count - 1; goto out; @@ -3762,6 +3806,42 @@ out: return index; } +static int modify_irte_ga(u16 devid, int index, struct irte_ga *irte) +{ + struct irq_remap_table *table; + struct amd_iommu *iommu; + unsigned long flags; + struct irte_ga *entry; + struct irte_ga tmp; + + iommu = amd_iommu_rlookup_table[devid]; + if (iommu == NULL) + return -EINVAL; + + table = get_irq_table(devid, false); + if (!table) + return -ENOMEM; + + spin_lock_irqsave(&table->lock, flags); + + entry = amd_iommu_get_irte(table, index); + + memcpy(&tmp, entry, sizeof(struct irte_ga)); + + entry->lo.fields_remap.valid = 0; + entry->hi.val = irte->hi.val; + entry->hi.fields.ga_root_ptr = tmp.hi.fields.ga_root_ptr; + entry->lo.val = irte->lo.val; + entry->lo.fields_remap.valid = 1; + + spin_unlock_irqrestore(&table->lock, flags); + + iommu_flush_irt(iommu, devid); + iommu_completion_wait(iommu); + + return 0; +} + static int modify_irte(u16 devid, int index, union irte irte) { struct irq_remap_table *table; @@ -3801,7 +3881,7 @@ static void free_irte(u16 devid, int index) return; spin_lock_irqsave(&table->lock, flags); - table->table[index] = 0; + clear_irte(table, index); spin_unlock_irqrestore(&table->lock, flags); iommu_flush_irt(iommu, devid); @@ -3889,19 +3969,33 @@ 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; 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; + if (!amd_iommu_guest_ir) { + union irte *irte = &data->irte_entry; + + 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; + } else { + struct irte_ga *irte = &data->irte_ga_entry; + + irte->lo.val = 0; + irte->hi.val = 0; + irte->lo.fields_remap.guest_mode = 0; + irte->lo.fields_remap.int_type = apic->irq_delivery_mode; + irte->lo.fields_remap.dm = apic->irq_dest_mode; + irte->hi.fields.vector = irq_cfg->vector; + irte->lo.fields_remap.destination = irq_cfg->dest_apicid; + irte->lo.fields_remap.valid = 1; + } switch (info->type) { case X86_IRQ_ALLOC_TYPE_IOAPIC: @@ -4037,7 +4131,13 @@ 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; - modify_irte(irte_info->devid, irte_info->index, data->irte_entry); + if (!amd_iommu_guest_ir) { + data->irte_entry.fields.valid = 1; + modify_irte(irte_info->devid, irte_info->index, data->irte_entry); + } else if (amd_iommu_guest_ir >= AMD_IOMMU_GUEST_IR_LEGACY_GA) { + data->irte_ga_entry.lo.fields_remap.valid = 1; + modify_irte_ga(irte_info->devid, irte_info->index, &data->irte_ga_entry); + } } static void irq_remapping_deactivate(struct irq_domain *domain, @@ -4045,10 +4145,14 @@ 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; - entry.val = 0; - modify_irte(irte_info->devid, irte_info->index, data->irte_entry); + if (!amd_iommu_guest_ir) { + data->irte_entry.fields.valid = 0; + modify_irte(irte_info->devid, irte_info->index, data->irte_entry); + } else { + data->irte_ga_entry.lo.fields_remap.valid = 0; + modify_irte_ga(irte_info->devid, irte_info->index, &data->irte_ga_entry); + } } static struct irq_domain_ops amd_ir_domain_ops = { @@ -4075,9 +4179,19 @@ 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); + if (!amd_iommu_guest_ir) { + 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); + } else { + struct irte_ga *entry = &ir_data->irte_ga_entry; + + entry->hi.fields.vector = cfg->vector; + entry->lo.fields_remap.destination = cfg->dest_apicid; + entry->lo.fields_remap.guest_mode = 0; + modify_irte_ga(irte_info->devid, irte_info->index, entry); + } /* * After this point, all the interrupts will start arriving @@ -4097,19 +4211,25 @@ static void ir_compose_msi_msg(struct irq_data *irq_data, struct msi_msg *msg) } static struct irq_chip amd_ir_chip = { + .name = "AMD-IR-IRQ-CHIP", .irq_ack = ir_ack_apic_edge, .irq_set_affinity = amd_ir_set_affinity, .irq_compose_msi_msg = ir_compose_msi_msg, }; +static const char amd_iommu_ir_domain_name[] = "AMD-IOMMU-IR-DOMAIN"; +static const char amd_iommu_msi_domain_name[] = "AMD-IOMMU-MSI-DOMAIN"; + int amd_iommu_create_irq_domain(struct amd_iommu *iommu) { iommu->ir_domain = irq_domain_add_tree(NULL, &amd_ir_domain_ops, iommu); if (!iommu->ir_domain) return -ENOMEM; + iommu->ir_domain->name = amd_iommu_ir_domain_name; iommu->ir_domain->parent = arch_get_ir_parent_domain(); iommu->msi_domain = arch_create_msi_irq_domain(iommu->ir_domain); + iommu->msi_domain->name = amd_iommu_msi_domain_name; return 0; } diff --git a/drivers/iommu/amd_iommu_types.h b/drivers/iommu/amd_iommu_types.h index 95414120..ec546f3 100644 --- a/drivers/iommu/amd_iommu_types.h +++ b/drivers/iommu/amd_iommu_types.h @@ -708,4 +708,67 @@ enum amd_iommu_intr_mode_type { AMD_IOMMU_GUEST_IR_GA, }; +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; +}; + #endif /* _ASM_X86_AMD_IOMMU_TYPES_H */