Thomas Gleixner | 2025cf9 | 2019-05-29 07:18:02 -0700 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0-only |
David Woodhouse | 8a94ade | 2015-03-24 14:54:56 +0000 | [diff] [blame] | 2 | /* |
| 3 | * Copyright © 2015 Intel Corporation. |
| 4 | * |
David Woodhouse | 8a94ade | 2015-03-24 14:54:56 +0000 | [diff] [blame] | 5 | * Authors: David Woodhouse <dwmw2@infradead.org> |
| 6 | */ |
| 7 | |
| 8 | #include <linux/intel-iommu.h> |
David Woodhouse | 2f26e0a | 2015-09-09 11:40:47 +0100 | [diff] [blame] | 9 | #include <linux/mmu_notifier.h> |
| 10 | #include <linux/sched.h> |
Ingo Molnar | 6e84f31 | 2017-02-08 18:51:29 +0100 | [diff] [blame] | 11 | #include <linux/sched/mm.h> |
David Woodhouse | 2f26e0a | 2015-09-09 11:40:47 +0100 | [diff] [blame] | 12 | #include <linux/slab.h> |
| 13 | #include <linux/intel-svm.h> |
| 14 | #include <linux/rculist.h> |
| 15 | #include <linux/pci.h> |
| 16 | #include <linux/pci-ats.h> |
David Woodhouse | a222a7f | 2015-10-07 23:35:18 +0100 | [diff] [blame] | 17 | #include <linux/dmar.h> |
| 18 | #include <linux/interrupt.h> |
Souptick Joarder | 50a7ca3 | 2018-08-17 15:44:47 -0700 | [diff] [blame] | 19 | #include <linux/mm_types.h> |
Ashok Raj | 9d8c3af | 2017-08-08 13:29:27 -0700 | [diff] [blame] | 20 | #include <asm/page.h> |
David Woodhouse | a222a7f | 2015-10-07 23:35:18 +0100 | [diff] [blame] | 21 | |
Lu Baolu | af39507 | 2018-07-14 15:46:56 +0800 | [diff] [blame] | 22 | #include "intel-pasid.h" |
| 23 | |
David Woodhouse | a222a7f | 2015-10-07 23:35:18 +0100 | [diff] [blame] | 24 | static irqreturn_t prq_event_thread(int irq, void *d); |
David Woodhouse | 2f26e0a | 2015-09-09 11:40:47 +0100 | [diff] [blame] | 25 | |
Lu Baolu | d973795 | 2018-07-14 15:47:02 +0800 | [diff] [blame] | 26 | int intel_svm_init(struct intel_iommu *iommu) |
David Woodhouse | 8a94ade | 2015-03-24 14:54:56 +0000 | [diff] [blame] | 27 | { |
Sohil Mehta | 59103ca | 2017-12-20 11:59:25 -0800 | [diff] [blame] | 28 | if (cpu_feature_enabled(X86_FEATURE_GBPAGES) && |
| 29 | !cap_fl1gp_support(iommu->cap)) |
| 30 | return -EINVAL; |
| 31 | |
Sohil Mehta | f1ac10c | 2017-12-20 11:59:26 -0800 | [diff] [blame] | 32 | if (cpu_feature_enabled(X86_FEATURE_LA57) && |
| 33 | !cap_5lp_support(iommu->cap)) |
| 34 | return -EINVAL; |
| 35 | |
David Woodhouse | 8a94ade | 2015-03-24 14:54:56 +0000 | [diff] [blame] | 36 | return 0; |
| 37 | } |
David Woodhouse | 2f26e0a | 2015-09-09 11:40:47 +0100 | [diff] [blame] | 38 | |
David Woodhouse | a222a7f | 2015-10-07 23:35:18 +0100 | [diff] [blame] | 39 | #define PRQ_ORDER 0 |
| 40 | |
| 41 | int intel_svm_enable_prq(struct intel_iommu *iommu) |
| 42 | { |
| 43 | struct page *pages; |
| 44 | int irq, ret; |
| 45 | |
| 46 | pages = alloc_pages(GFP_KERNEL | __GFP_ZERO, PRQ_ORDER); |
| 47 | if (!pages) { |
| 48 | pr_warn("IOMMU: %s: Failed to allocate page request queue\n", |
| 49 | iommu->name); |
| 50 | return -ENOMEM; |
| 51 | } |
| 52 | iommu->prq = page_address(pages); |
| 53 | |
| 54 | irq = dmar_alloc_hwirq(DMAR_UNITS_SUPPORTED + iommu->seq_id, iommu->node, iommu); |
| 55 | if (irq <= 0) { |
| 56 | pr_err("IOMMU: %s: Failed to create IRQ vector for page request queue\n", |
| 57 | iommu->name); |
| 58 | ret = -EINVAL; |
| 59 | err: |
| 60 | free_pages((unsigned long)iommu->prq, PRQ_ORDER); |
| 61 | iommu->prq = NULL; |
| 62 | return ret; |
| 63 | } |
| 64 | iommu->pr_irq = irq; |
| 65 | |
| 66 | snprintf(iommu->prq_name, sizeof(iommu->prq_name), "dmar%d-prq", iommu->seq_id); |
| 67 | |
| 68 | ret = request_threaded_irq(irq, NULL, prq_event_thread, IRQF_ONESHOT, |
| 69 | iommu->prq_name, iommu); |
| 70 | if (ret) { |
| 71 | pr_err("IOMMU: %s: Failed to request IRQ for page request queue\n", |
| 72 | iommu->name); |
| 73 | dmar_free_hwirq(irq); |
Jerry Snitselaar | 72d5481 | 2017-12-20 09:48:56 -0700 | [diff] [blame] | 74 | iommu->pr_irq = 0; |
David Woodhouse | a222a7f | 2015-10-07 23:35:18 +0100 | [diff] [blame] | 75 | goto err; |
| 76 | } |
| 77 | dmar_writeq(iommu->reg + DMAR_PQH_REG, 0ULL); |
| 78 | dmar_writeq(iommu->reg + DMAR_PQT_REG, 0ULL); |
| 79 | dmar_writeq(iommu->reg + DMAR_PQA_REG, virt_to_phys(iommu->prq) | PRQ_ORDER); |
| 80 | |
| 81 | return 0; |
| 82 | } |
| 83 | |
| 84 | int intel_svm_finish_prq(struct intel_iommu *iommu) |
| 85 | { |
| 86 | dmar_writeq(iommu->reg + DMAR_PQH_REG, 0ULL); |
| 87 | dmar_writeq(iommu->reg + DMAR_PQT_REG, 0ULL); |
| 88 | dmar_writeq(iommu->reg + DMAR_PQA_REG, 0ULL); |
| 89 | |
Jerry Snitselaar | 72d5481 | 2017-12-20 09:48:56 -0700 | [diff] [blame] | 90 | if (iommu->pr_irq) { |
| 91 | free_irq(iommu->pr_irq, iommu); |
| 92 | dmar_free_hwirq(iommu->pr_irq); |
| 93 | iommu->pr_irq = 0; |
| 94 | } |
David Woodhouse | a222a7f | 2015-10-07 23:35:18 +0100 | [diff] [blame] | 95 | |
| 96 | free_pages((unsigned long)iommu->prq, PRQ_ORDER); |
| 97 | iommu->prq = NULL; |
| 98 | |
| 99 | return 0; |
| 100 | } |
| 101 | |
David Woodhouse | 2f26e0a | 2015-09-09 11:40:47 +0100 | [diff] [blame] | 102 | static void intel_flush_svm_range_dev (struct intel_svm *svm, struct intel_svm_dev *sdev, |
Jacob Pan | 8744daf | 2019-08-26 08:53:29 -0700 | [diff] [blame] | 103 | unsigned long address, unsigned long pages, int ih) |
David Woodhouse | 2f26e0a | 2015-09-09 11:40:47 +0100 | [diff] [blame] | 104 | { |
| 105 | struct qi_desc desc; |
David Woodhouse | 2f26e0a | 2015-09-09 11:40:47 +0100 | [diff] [blame] | 106 | |
Jacob Pan | 8744daf | 2019-08-26 08:53:29 -0700 | [diff] [blame] | 107 | /* |
| 108 | * Do PASID granu IOTLB invalidation if page selective capability is |
| 109 | * not available. |
| 110 | */ |
| 111 | if (pages == -1 || !cap_pgsel_inv(svm->iommu->cap)) { |
| 112 | desc.qw0 = QI_EIOTLB_PASID(svm->pasid) | |
| 113 | QI_EIOTLB_DID(sdev->did) | |
| 114 | QI_EIOTLB_GRAN(QI_GRAN_NONG_PASID) | |
| 115 | QI_EIOTLB_TYPE; |
Lu Baolu | 5d308fc | 2018-12-10 09:58:58 +0800 | [diff] [blame] | 116 | desc.qw1 = 0; |
David Woodhouse | 2f26e0a | 2015-09-09 11:40:47 +0100 | [diff] [blame] | 117 | } else { |
David Woodhouse | 5d52f48 | 2015-10-20 15:52:13 +0100 | [diff] [blame] | 118 | int mask = ilog2(__roundup_pow_of_two(pages)); |
| 119 | |
Lu Baolu | 5d308fc | 2018-12-10 09:58:58 +0800 | [diff] [blame] | 120 | desc.qw0 = QI_EIOTLB_PASID(svm->pasid) | |
| 121 | QI_EIOTLB_DID(sdev->did) | |
| 122 | QI_EIOTLB_GRAN(QI_GRAN_PSI_PASID) | |
| 123 | QI_EIOTLB_TYPE; |
| 124 | desc.qw1 = QI_EIOTLB_ADDR(address) | |
Lu Baolu | 5d308fc | 2018-12-10 09:58:58 +0800 | [diff] [blame] | 125 | QI_EIOTLB_IH(ih) | |
| 126 | QI_EIOTLB_AM(mask); |
David Woodhouse | 2f26e0a | 2015-09-09 11:40:47 +0100 | [diff] [blame] | 127 | } |
Lu Baolu | 5d308fc | 2018-12-10 09:58:58 +0800 | [diff] [blame] | 128 | desc.qw2 = 0; |
| 129 | desc.qw3 = 0; |
David Woodhouse | 2f26e0a | 2015-09-09 11:40:47 +0100 | [diff] [blame] | 130 | qi_submit_sync(&desc, svm->iommu); |
| 131 | |
| 132 | if (sdev->dev_iotlb) { |
Lu Baolu | 5d308fc | 2018-12-10 09:58:58 +0800 | [diff] [blame] | 133 | desc.qw0 = QI_DEV_EIOTLB_PASID(svm->pasid) | |
| 134 | QI_DEV_EIOTLB_SID(sdev->sid) | |
| 135 | QI_DEV_EIOTLB_QDEP(sdev->qdep) | |
| 136 | QI_DEIOTLB_TYPE; |
David Woodhouse | 5d52f48 | 2015-10-20 15:52:13 +0100 | [diff] [blame] | 137 | if (pages == -1) { |
Lu Baolu | 5d308fc | 2018-12-10 09:58:58 +0800 | [diff] [blame] | 138 | desc.qw1 = QI_DEV_EIOTLB_ADDR(-1ULL >> 1) | |
| 139 | QI_DEV_EIOTLB_SIZE; |
David Woodhouse | 5d52f48 | 2015-10-20 15:52:13 +0100 | [diff] [blame] | 140 | } else if (pages > 1) { |
| 141 | /* The least significant zero bit indicates the size. So, |
| 142 | * for example, an "address" value of 0x12345f000 will |
| 143 | * flush from 0x123440000 to 0x12347ffff (256KiB). */ |
| 144 | unsigned long last = address + ((unsigned long)(pages - 1) << VTD_PAGE_SHIFT); |
Ingo Molnar | ed7158b | 2018-02-22 10:54:55 +0100 | [diff] [blame] | 145 | unsigned long mask = __rounddown_pow_of_two(address ^ last); |
David Woodhouse | 2f26e0a | 2015-09-09 11:40:47 +0100 | [diff] [blame] | 146 | |
Lu Baolu | 5d308fc | 2018-12-10 09:58:58 +0800 | [diff] [blame] | 147 | desc.qw1 = QI_DEV_EIOTLB_ADDR((address & ~mask) | |
| 148 | (mask - 1)) | QI_DEV_EIOTLB_SIZE; |
David Woodhouse | 2f26e0a | 2015-09-09 11:40:47 +0100 | [diff] [blame] | 149 | } else { |
Lu Baolu | 5d308fc | 2018-12-10 09:58:58 +0800 | [diff] [blame] | 150 | desc.qw1 = QI_DEV_EIOTLB_ADDR(address); |
David Woodhouse | 2f26e0a | 2015-09-09 11:40:47 +0100 | [diff] [blame] | 151 | } |
Lu Baolu | 5d308fc | 2018-12-10 09:58:58 +0800 | [diff] [blame] | 152 | desc.qw2 = 0; |
| 153 | desc.qw3 = 0; |
David Woodhouse | 2f26e0a | 2015-09-09 11:40:47 +0100 | [diff] [blame] | 154 | qi_submit_sync(&desc, svm->iommu); |
| 155 | } |
| 156 | } |
| 157 | |
| 158 | static void intel_flush_svm_range(struct intel_svm *svm, unsigned long address, |
Jacob Pan | 8744daf | 2019-08-26 08:53:29 -0700 | [diff] [blame] | 159 | unsigned long pages, int ih) |
David Woodhouse | 2f26e0a | 2015-09-09 11:40:47 +0100 | [diff] [blame] | 160 | { |
| 161 | struct intel_svm_dev *sdev; |
| 162 | |
| 163 | rcu_read_lock(); |
| 164 | list_for_each_entry_rcu(sdev, &svm->devs, list) |
Jacob Pan | 8744daf | 2019-08-26 08:53:29 -0700 | [diff] [blame] | 165 | intel_flush_svm_range_dev(svm, sdev, address, pages, ih); |
David Woodhouse | 2f26e0a | 2015-09-09 11:40:47 +0100 | [diff] [blame] | 166 | rcu_read_unlock(); |
| 167 | } |
| 168 | |
David Woodhouse | 2f26e0a | 2015-09-09 11:40:47 +0100 | [diff] [blame] | 169 | /* Pages have been freed at this point */ |
| 170 | static void intel_invalidate_range(struct mmu_notifier *mn, |
| 171 | struct mm_struct *mm, |
| 172 | unsigned long start, unsigned long end) |
| 173 | { |
| 174 | struct intel_svm *svm = container_of(mn, struct intel_svm, notifier); |
| 175 | |
| 176 | intel_flush_svm_range(svm, start, |
Jacob Pan | 8744daf | 2019-08-26 08:53:29 -0700 | [diff] [blame] | 177 | (end - start + PAGE_SIZE - 1) >> VTD_PAGE_SHIFT, 0); |
David Woodhouse | 2f26e0a | 2015-09-09 11:40:47 +0100 | [diff] [blame] | 178 | } |
| 179 | |
David Woodhouse | 2f26e0a | 2015-09-09 11:40:47 +0100 | [diff] [blame] | 180 | static void intel_mm_release(struct mmu_notifier *mn, struct mm_struct *mm) |
| 181 | { |
| 182 | struct intel_svm *svm = container_of(mn, struct intel_svm, notifier); |
David Woodhouse | e57e58b | 2016-01-12 19:18:06 +0000 | [diff] [blame] | 183 | struct intel_svm_dev *sdev; |
David Woodhouse | 2f26e0a | 2015-09-09 11:40:47 +0100 | [diff] [blame] | 184 | |
David Woodhouse | e57e58b | 2016-01-12 19:18:06 +0000 | [diff] [blame] | 185 | /* This might end up being called from exit_mmap(), *before* the page |
| 186 | * tables are cleared. And __mmu_notifier_release() will delete us from |
| 187 | * the list of notifiers so that our invalidate_range() callback doesn't |
| 188 | * get called when the page tables are cleared. So we need to protect |
| 189 | * against hardware accessing those page tables. |
| 190 | * |
| 191 | * We do it by clearing the entry in the PASID table and then flushing |
| 192 | * the IOTLB and the PASID table caches. This might upset hardware; |
| 193 | * perhaps we'll want to point the PASID to a dummy PGD (like the zero |
| 194 | * page) so that we end up taking a fault that the hardware really |
| 195 | * *has* to handle gracefully without affecting other processes. |
| 196 | */ |
David Woodhouse | e57e58b | 2016-01-12 19:18:06 +0000 | [diff] [blame] | 197 | rcu_read_lock(); |
| 198 | list_for_each_entry_rcu(sdev, &svm->devs, list) { |
Lu Baolu | 1c4f88b | 2018-12-10 09:59:05 +0800 | [diff] [blame] | 199 | intel_pasid_tear_down_entry(svm->iommu, sdev->dev, svm->pasid); |
Jacob Pan | 8744daf | 2019-08-26 08:53:29 -0700 | [diff] [blame] | 200 | intel_flush_svm_range_dev(svm, sdev, 0, -1, 0); |
David Woodhouse | e57e58b | 2016-01-12 19:18:06 +0000 | [diff] [blame] | 201 | } |
| 202 | rcu_read_unlock(); |
| 203 | |
David Woodhouse | 2f26e0a | 2015-09-09 11:40:47 +0100 | [diff] [blame] | 204 | } |
| 205 | |
| 206 | static const struct mmu_notifier_ops intel_mmuops = { |
| 207 | .release = intel_mm_release, |
David Woodhouse | 2f26e0a | 2015-09-09 11:40:47 +0100 | [diff] [blame] | 208 | .invalidate_range = intel_invalidate_range, |
| 209 | }; |
| 210 | |
| 211 | static DEFINE_MUTEX(pasid_mutex); |
Lu Baolu | 51261aa | 2018-07-14 15:46:55 +0800 | [diff] [blame] | 212 | static LIST_HEAD(global_svm_list); |
David Woodhouse | 2f26e0a | 2015-09-09 11:40:47 +0100 | [diff] [blame] | 213 | |
David Woodhouse | 0204a49 | 2015-10-13 17:18:10 +0100 | [diff] [blame] | 214 | int intel_svm_bind_mm(struct device *dev, int *pasid, int flags, struct svm_dev_ops *ops) |
David Woodhouse | 2f26e0a | 2015-09-09 11:40:47 +0100 | [diff] [blame] | 215 | { |
| 216 | struct intel_iommu *iommu = intel_svm_device_to_iommu(dev); |
Lu Baolu | d7cbc0f | 2019-03-25 09:30:29 +0800 | [diff] [blame] | 217 | struct device_domain_info *info; |
David Woodhouse | 2f26e0a | 2015-09-09 11:40:47 +0100 | [diff] [blame] | 218 | struct intel_svm_dev *sdev; |
| 219 | struct intel_svm *svm = NULL; |
David Woodhouse | 5cec753 | 2015-10-15 15:52:15 +0100 | [diff] [blame] | 220 | struct mm_struct *mm = NULL; |
David Woodhouse | 2f26e0a | 2015-09-09 11:40:47 +0100 | [diff] [blame] | 221 | int pasid_max; |
| 222 | int ret; |
| 223 | |
Lu Baolu | c56cba5 | 2019-03-01 11:23:12 +0800 | [diff] [blame] | 224 | if (!iommu || dmar_disabled) |
David Woodhouse | 2f26e0a | 2015-09-09 11:40:47 +0100 | [diff] [blame] | 225 | return -EINVAL; |
| 226 | |
| 227 | if (dev_is_pci(dev)) { |
| 228 | pasid_max = pci_max_pasids(to_pci_dev(dev)); |
| 229 | if (pasid_max < 0) |
| 230 | return -EINVAL; |
| 231 | } else |
| 232 | pasid_max = 1 << 20; |
| 233 | |
Lu Baolu | bb37f7d | 2018-05-04 13:08:19 +0800 | [diff] [blame] | 234 | if (flags & SVM_FLAG_SUPERVISOR_MODE) { |
David Woodhouse | 5cec753 | 2015-10-15 15:52:15 +0100 | [diff] [blame] | 235 | if (!ecap_srs(iommu->ecap)) |
| 236 | return -EINVAL; |
| 237 | } else if (pasid) { |
| 238 | mm = get_task_mm(current); |
| 239 | BUG_ON(!mm); |
| 240 | } |
| 241 | |
David Woodhouse | 2f26e0a | 2015-09-09 11:40:47 +0100 | [diff] [blame] | 242 | mutex_lock(&pasid_mutex); |
David Woodhouse | 569e4f7 | 2015-10-15 13:59:14 +0100 | [diff] [blame] | 243 | if (pasid && !(flags & SVM_FLAG_PRIVATE_PASID)) { |
Lu Baolu | 51261aa | 2018-07-14 15:46:55 +0800 | [diff] [blame] | 244 | struct intel_svm *t; |
David Woodhouse | 2f26e0a | 2015-09-09 11:40:47 +0100 | [diff] [blame] | 245 | |
Lu Baolu | 51261aa | 2018-07-14 15:46:55 +0800 | [diff] [blame] | 246 | list_for_each_entry(t, &global_svm_list, list) { |
| 247 | if (t->mm != mm || (t->flags & SVM_FLAG_PRIVATE_PASID)) |
David Woodhouse | 2f26e0a | 2015-09-09 11:40:47 +0100 | [diff] [blame] | 248 | continue; |
| 249 | |
Lu Baolu | 51261aa | 2018-07-14 15:46:55 +0800 | [diff] [blame] | 250 | svm = t; |
David Woodhouse | 2f26e0a | 2015-09-09 11:40:47 +0100 | [diff] [blame] | 251 | if (svm->pasid >= pasid_max) { |
| 252 | dev_warn(dev, |
| 253 | "Limited PASID width. Cannot use existing PASID %d\n", |
| 254 | svm->pasid); |
| 255 | ret = -ENOSPC; |
| 256 | goto out; |
| 257 | } |
| 258 | |
| 259 | list_for_each_entry(sdev, &svm->devs, list) { |
| 260 | if (dev == sdev->dev) { |
David Woodhouse | 0204a49 | 2015-10-13 17:18:10 +0100 | [diff] [blame] | 261 | if (sdev->ops != ops) { |
| 262 | ret = -EBUSY; |
| 263 | goto out; |
| 264 | } |
David Woodhouse | 2f26e0a | 2015-09-09 11:40:47 +0100 | [diff] [blame] | 265 | sdev->users++; |
| 266 | goto success; |
| 267 | } |
| 268 | } |
| 269 | |
| 270 | break; |
| 271 | } |
| 272 | } |
| 273 | |
| 274 | sdev = kzalloc(sizeof(*sdev), GFP_KERNEL); |
| 275 | if (!sdev) { |
| 276 | ret = -ENOMEM; |
| 277 | goto out; |
| 278 | } |
| 279 | sdev->dev = dev; |
| 280 | |
Lu Baolu | d7cbc0f | 2019-03-25 09:30:29 +0800 | [diff] [blame] | 281 | ret = intel_iommu_enable_pasid(iommu, dev); |
David Woodhouse | 2f26e0a | 2015-09-09 11:40:47 +0100 | [diff] [blame] | 282 | if (ret || !pasid) { |
| 283 | /* If they don't actually want to assign a PASID, this is |
| 284 | * just an enabling check/preparation. */ |
| 285 | kfree(sdev); |
| 286 | goto out; |
| 287 | } |
Lu Baolu | d7cbc0f | 2019-03-25 09:30:29 +0800 | [diff] [blame] | 288 | |
| 289 | info = dev->archdata.iommu; |
| 290 | if (!info || !info->pasid_supported) { |
| 291 | kfree(sdev); |
| 292 | goto out; |
| 293 | } |
| 294 | |
| 295 | sdev->did = FLPT_DEFAULT_DID; |
| 296 | sdev->sid = PCI_DEVID(info->bus, info->devfn); |
| 297 | if (info->ats_enabled) { |
| 298 | sdev->dev_iotlb = 1; |
| 299 | sdev->qdep = info->ats_qdep; |
| 300 | if (sdev->qdep >= QI_DEV_EIOTLB_MAX_INVS) |
| 301 | sdev->qdep = 0; |
| 302 | } |
| 303 | |
David Woodhouse | 2f26e0a | 2015-09-09 11:40:47 +0100 | [diff] [blame] | 304 | /* Finish the setup now we know we're keeping it */ |
| 305 | sdev->users = 1; |
David Woodhouse | 0204a49 | 2015-10-13 17:18:10 +0100 | [diff] [blame] | 306 | sdev->ops = ops; |
David Woodhouse | 2f26e0a | 2015-09-09 11:40:47 +0100 | [diff] [blame] | 307 | init_rcu_head(&sdev->rcu); |
| 308 | |
| 309 | if (!svm) { |
| 310 | svm = kzalloc(sizeof(*svm), GFP_KERNEL); |
| 311 | if (!svm) { |
| 312 | ret = -ENOMEM; |
| 313 | kfree(sdev); |
| 314 | goto out; |
| 315 | } |
| 316 | svm->iommu = iommu; |
| 317 | |
Lu Baolu | 4774cc5 | 2018-07-14 15:47:01 +0800 | [diff] [blame] | 318 | if (pasid_max > intel_pasid_max_id) |
| 319 | pasid_max = intel_pasid_max_id; |
David Woodhouse | 2f26e0a | 2015-09-09 11:40:47 +0100 | [diff] [blame] | 320 | |
David Woodhouse | 5a10ba2 | 2015-10-24 21:06:39 +0200 | [diff] [blame] | 321 | /* Do not use PASID 0 in caching mode (virtualised IOMMU) */ |
Lu Baolu | af39507 | 2018-07-14 15:46:56 +0800 | [diff] [blame] | 322 | ret = intel_pasid_alloc_id(svm, |
| 323 | !!cap_caching_mode(iommu->cap), |
| 324 | pasid_max - 1, GFP_KERNEL); |
David Woodhouse | 2f26e0a | 2015-09-09 11:40:47 +0100 | [diff] [blame] | 325 | if (ret < 0) { |
| 326 | kfree(svm); |
Lu Baolu | bbe4b3a | 2018-02-24 13:42:27 +0800 | [diff] [blame] | 327 | kfree(sdev); |
David Woodhouse | 2f26e0a | 2015-09-09 11:40:47 +0100 | [diff] [blame] | 328 | goto out; |
| 329 | } |
| 330 | svm->pasid = ret; |
| 331 | svm->notifier.ops = &intel_mmuops; |
David Woodhouse | 5cec753 | 2015-10-15 15:52:15 +0100 | [diff] [blame] | 332 | svm->mm = mm; |
David Woodhouse | 569e4f7 | 2015-10-15 13:59:14 +0100 | [diff] [blame] | 333 | svm->flags = flags; |
David Woodhouse | 2f26e0a | 2015-09-09 11:40:47 +0100 | [diff] [blame] | 334 | INIT_LIST_HEAD_RCU(&svm->devs); |
Lu Baolu | 51261aa | 2018-07-14 15:46:55 +0800 | [diff] [blame] | 335 | INIT_LIST_HEAD(&svm->list); |
David Woodhouse | 2f26e0a | 2015-09-09 11:40:47 +0100 | [diff] [blame] | 336 | ret = -ENOMEM; |
David Woodhouse | 5cec753 | 2015-10-15 15:52:15 +0100 | [diff] [blame] | 337 | if (mm) { |
| 338 | ret = mmu_notifier_register(&svm->notifier, mm); |
| 339 | if (ret) { |
Lu Baolu | af39507 | 2018-07-14 15:46:56 +0800 | [diff] [blame] | 340 | intel_pasid_free_id(svm->pasid); |
David Woodhouse | 5cec753 | 2015-10-15 15:52:15 +0100 | [diff] [blame] | 341 | kfree(svm); |
| 342 | kfree(sdev); |
| 343 | goto out; |
| 344 | } |
Lu Baolu | 1c4f88b | 2018-12-10 09:59:05 +0800 | [diff] [blame] | 345 | } |
Sohil Mehta | 2f13eb7 | 2017-12-20 11:59:27 -0800 | [diff] [blame] | 346 | |
Lu Baolu | 1c4f88b | 2018-12-10 09:59:05 +0800 | [diff] [blame] | 347 | spin_lock(&iommu->lock); |
| 348 | ret = intel_pasid_setup_first_level(iommu, dev, |
| 349 | mm ? mm->pgd : init_mm.pgd, |
| 350 | svm->pasid, FLPT_DEFAULT_DID, |
| 351 | mm ? 0 : PASID_FLAG_SUPERVISOR_MODE); |
| 352 | spin_unlock(&iommu->lock); |
| 353 | if (ret) { |
| 354 | if (mm) |
| 355 | mmu_notifier_unregister(&svm->notifier, mm); |
| 356 | intel_pasid_free_id(svm->pasid); |
| 357 | kfree(svm); |
| 358 | kfree(sdev); |
| 359 | goto out; |
| 360 | } |
Lu Baolu | 51261aa | 2018-07-14 15:46:55 +0800 | [diff] [blame] | 361 | |
| 362 | list_add_tail(&svm->list, &global_svm_list); |
Jacob Pan | d7af4d9 | 2019-05-08 12:22:46 -0700 | [diff] [blame] | 363 | } else { |
| 364 | /* |
| 365 | * Binding a new device with existing PASID, need to setup |
| 366 | * the PASID entry. |
| 367 | */ |
| 368 | spin_lock(&iommu->lock); |
| 369 | ret = intel_pasid_setup_first_level(iommu, dev, |
| 370 | mm ? mm->pgd : init_mm.pgd, |
| 371 | svm->pasid, FLPT_DEFAULT_DID, |
| 372 | mm ? 0 : PASID_FLAG_SUPERVISOR_MODE); |
| 373 | spin_unlock(&iommu->lock); |
| 374 | if (ret) { |
| 375 | kfree(sdev); |
| 376 | goto out; |
| 377 | } |
David Woodhouse | 2f26e0a | 2015-09-09 11:40:47 +0100 | [diff] [blame] | 378 | } |
| 379 | list_add_rcu(&sdev->list, &svm->devs); |
| 380 | |
| 381 | success: |
| 382 | *pasid = svm->pasid; |
| 383 | ret = 0; |
| 384 | out: |
| 385 | mutex_unlock(&pasid_mutex); |
David Woodhouse | 5cec753 | 2015-10-15 15:52:15 +0100 | [diff] [blame] | 386 | if (mm) |
| 387 | mmput(mm); |
David Woodhouse | 2f26e0a | 2015-09-09 11:40:47 +0100 | [diff] [blame] | 388 | return ret; |
| 389 | } |
| 390 | EXPORT_SYMBOL_GPL(intel_svm_bind_mm); |
| 391 | |
| 392 | int intel_svm_unbind_mm(struct device *dev, int pasid) |
| 393 | { |
| 394 | struct intel_svm_dev *sdev; |
| 395 | struct intel_iommu *iommu; |
| 396 | struct intel_svm *svm; |
| 397 | int ret = -EINVAL; |
| 398 | |
| 399 | mutex_lock(&pasid_mutex); |
| 400 | iommu = intel_svm_device_to_iommu(dev); |
Lu Baolu | 4774cc5 | 2018-07-14 15:47:01 +0800 | [diff] [blame] | 401 | if (!iommu) |
David Woodhouse | 2f26e0a | 2015-09-09 11:40:47 +0100 | [diff] [blame] | 402 | goto out; |
| 403 | |
Lu Baolu | af39507 | 2018-07-14 15:46:56 +0800 | [diff] [blame] | 404 | svm = intel_pasid_lookup_id(pasid); |
David Woodhouse | 2f26e0a | 2015-09-09 11:40:47 +0100 | [diff] [blame] | 405 | if (!svm) |
| 406 | goto out; |
| 407 | |
| 408 | list_for_each_entry(sdev, &svm->devs, list) { |
| 409 | if (dev == sdev->dev) { |
| 410 | ret = 0; |
| 411 | sdev->users--; |
| 412 | if (!sdev->users) { |
| 413 | list_del_rcu(&sdev->list); |
| 414 | /* Flush the PASID cache and IOTLB for this device. |
| 415 | * Note that we do depend on the hardware *not* using |
| 416 | * the PASID any more. Just as we depend on other |
| 417 | * devices never using PASIDs that they have no right |
| 418 | * to use. We have a *shared* PASID table, because it's |
| 419 | * large and has to be physically contiguous. So it's |
| 420 | * hard to be as defensive as we might like. */ |
Lu Baolu | 1c4f88b | 2018-12-10 09:59:05 +0800 | [diff] [blame] | 421 | intel_pasid_tear_down_entry(iommu, dev, svm->pasid); |
Jacob Pan | 8744daf | 2019-08-26 08:53:29 -0700 | [diff] [blame] | 422 | intel_flush_svm_range_dev(svm, sdev, 0, -1, 0); |
David Woodhouse | 2f26e0a | 2015-09-09 11:40:47 +0100 | [diff] [blame] | 423 | kfree_rcu(sdev, rcu); |
| 424 | |
| 425 | if (list_empty(&svm->devs)) { |
Lu Baolu | af39507 | 2018-07-14 15:46:56 +0800 | [diff] [blame] | 426 | intel_pasid_free_id(svm->pasid); |
David Woodhouse | 5cec753 | 2015-10-15 15:52:15 +0100 | [diff] [blame] | 427 | if (svm->mm) |
David Woodhouse | e57e58b | 2016-01-12 19:18:06 +0000 | [diff] [blame] | 428 | mmu_notifier_unregister(&svm->notifier, svm->mm); |
| 429 | |
Lu Baolu | 51261aa | 2018-07-14 15:46:55 +0800 | [diff] [blame] | 430 | list_del(&svm->list); |
| 431 | |
David Woodhouse | 2f26e0a | 2015-09-09 11:40:47 +0100 | [diff] [blame] | 432 | /* We mandate that no page faults may be outstanding |
| 433 | * for the PASID when intel_svm_unbind_mm() is called. |
| 434 | * If that is not obeyed, subtle errors will happen. |
| 435 | * Let's make them less subtle... */ |
| 436 | memset(svm, 0x6b, sizeof(*svm)); |
| 437 | kfree(svm); |
| 438 | } |
| 439 | } |
| 440 | break; |
| 441 | } |
| 442 | } |
| 443 | out: |
| 444 | mutex_unlock(&pasid_mutex); |
| 445 | |
| 446 | return ret; |
| 447 | } |
| 448 | EXPORT_SYMBOL_GPL(intel_svm_unbind_mm); |
David Woodhouse | a222a7f | 2015-10-07 23:35:18 +0100 | [diff] [blame] | 449 | |
CQ Tang | 15060ab | 2017-05-10 11:39:03 -0700 | [diff] [blame] | 450 | int intel_svm_is_pasid_valid(struct device *dev, int pasid) |
| 451 | { |
| 452 | struct intel_iommu *iommu; |
| 453 | struct intel_svm *svm; |
| 454 | int ret = -EINVAL; |
| 455 | |
| 456 | mutex_lock(&pasid_mutex); |
| 457 | iommu = intel_svm_device_to_iommu(dev); |
Lu Baolu | 4774cc5 | 2018-07-14 15:47:01 +0800 | [diff] [blame] | 458 | if (!iommu) |
CQ Tang | 15060ab | 2017-05-10 11:39:03 -0700 | [diff] [blame] | 459 | goto out; |
| 460 | |
Lu Baolu | af39507 | 2018-07-14 15:46:56 +0800 | [diff] [blame] | 461 | svm = intel_pasid_lookup_id(pasid); |
CQ Tang | 15060ab | 2017-05-10 11:39:03 -0700 | [diff] [blame] | 462 | if (!svm) |
| 463 | goto out; |
| 464 | |
| 465 | /* init_mm is used in this case */ |
| 466 | if (!svm->mm) |
| 467 | ret = 1; |
| 468 | else if (atomic_read(&svm->mm->mm_users) > 0) |
| 469 | ret = 1; |
| 470 | else |
| 471 | ret = 0; |
| 472 | |
| 473 | out: |
| 474 | mutex_unlock(&pasid_mutex); |
| 475 | |
| 476 | return ret; |
| 477 | } |
| 478 | EXPORT_SYMBOL_GPL(intel_svm_is_pasid_valid); |
| 479 | |
David Woodhouse | a222a7f | 2015-10-07 23:35:18 +0100 | [diff] [blame] | 480 | /* Page request queue descriptor */ |
| 481 | struct page_req_dsc { |
Jacob Pan | 5b438f4 | 2019-01-11 13:04:57 +0800 | [diff] [blame] | 482 | union { |
| 483 | struct { |
| 484 | u64 type:8; |
| 485 | u64 pasid_present:1; |
| 486 | u64 priv_data_present:1; |
| 487 | u64 rsvd:6; |
| 488 | u64 rid:16; |
| 489 | u64 pasid:20; |
| 490 | u64 exe_req:1; |
| 491 | u64 pm_req:1; |
| 492 | u64 rsvd2:10; |
| 493 | }; |
| 494 | u64 qw_0; |
| 495 | }; |
| 496 | union { |
| 497 | struct { |
| 498 | u64 rd_req:1; |
| 499 | u64 wr_req:1; |
| 500 | u64 lpig:1; |
| 501 | u64 prg_index:9; |
| 502 | u64 addr:52; |
| 503 | }; |
| 504 | u64 qw_1; |
| 505 | }; |
| 506 | u64 priv_data[2]; |
David Woodhouse | a222a7f | 2015-10-07 23:35:18 +0100 | [diff] [blame] | 507 | }; |
| 508 | |
| 509 | #define PRQ_RING_MASK ((0x1000 << PRQ_ORDER) - 0x10) |
Joerg Roedel | 7f8312a | 2015-11-17 16:11:39 +0100 | [diff] [blame] | 510 | |
| 511 | static bool access_error(struct vm_area_struct *vma, struct page_req_dsc *req) |
| 512 | { |
| 513 | unsigned long requested = 0; |
| 514 | |
| 515 | if (req->exe_req) |
| 516 | requested |= VM_EXEC; |
| 517 | |
| 518 | if (req->rd_req) |
| 519 | requested |= VM_READ; |
| 520 | |
| 521 | if (req->wr_req) |
| 522 | requested |= VM_WRITE; |
| 523 | |
| 524 | return (requested & ~vma->vm_flags) != 0; |
| 525 | } |
| 526 | |
Ashok Raj | 9d8c3af | 2017-08-08 13:29:27 -0700 | [diff] [blame] | 527 | static bool is_canonical_address(u64 addr) |
| 528 | { |
| 529 | int shift = 64 - (__VIRTUAL_MASK_SHIFT + 1); |
| 530 | long saddr = (long) addr; |
| 531 | |
| 532 | return (((saddr << shift) >> shift) == saddr); |
| 533 | } |
| 534 | |
David Woodhouse | a222a7f | 2015-10-07 23:35:18 +0100 | [diff] [blame] | 535 | static irqreturn_t prq_event_thread(int irq, void *d) |
| 536 | { |
| 537 | struct intel_iommu *iommu = d; |
| 538 | struct intel_svm *svm = NULL; |
| 539 | int head, tail, handled = 0; |
| 540 | |
David Woodhouse | 4692400 | 2016-02-15 12:42:38 +0000 | [diff] [blame] | 541 | /* Clear PPR bit before reading head/tail registers, to |
| 542 | * ensure that we get a new interrupt if needed. */ |
| 543 | writel(DMA_PRS_PPR, iommu->reg + DMAR_PRS_REG); |
| 544 | |
David Woodhouse | a222a7f | 2015-10-07 23:35:18 +0100 | [diff] [blame] | 545 | tail = dmar_readq(iommu->reg + DMAR_PQT_REG) & PRQ_RING_MASK; |
| 546 | head = dmar_readq(iommu->reg + DMAR_PQH_REG) & PRQ_RING_MASK; |
| 547 | while (head != tail) { |
David Woodhouse | 0204a49 | 2015-10-13 17:18:10 +0100 | [diff] [blame] | 548 | struct intel_svm_dev *sdev; |
David Woodhouse | a222a7f | 2015-10-07 23:35:18 +0100 | [diff] [blame] | 549 | struct vm_area_struct *vma; |
| 550 | struct page_req_dsc *req; |
| 551 | struct qi_desc resp; |
Souptick Joarder | 50a7ca3 | 2018-08-17 15:44:47 -0700 | [diff] [blame] | 552 | int result; |
| 553 | vm_fault_t ret; |
David Woodhouse | a222a7f | 2015-10-07 23:35:18 +0100 | [diff] [blame] | 554 | u64 address; |
| 555 | |
| 556 | handled = 1; |
| 557 | |
| 558 | req = &iommu->prq[head / sizeof(*req)]; |
| 559 | |
| 560 | result = QI_RESP_FAILURE; |
David Woodhouse | 7f92a2e | 2015-10-16 17:22:31 +0100 | [diff] [blame] | 561 | address = (u64)req->addr << VTD_PAGE_SHIFT; |
David Woodhouse | a222a7f | 2015-10-07 23:35:18 +0100 | [diff] [blame] | 562 | if (!req->pasid_present) { |
| 563 | pr_err("%s: Page request without PASID: %08llx %08llx\n", |
| 564 | iommu->name, ((unsigned long long *)req)[0], |
| 565 | ((unsigned long long *)req)[1]); |
Lu Baolu | 19ed3e2 | 2018-11-05 10:18:58 +0800 | [diff] [blame] | 566 | goto no_pasid; |
David Woodhouse | a222a7f | 2015-10-07 23:35:18 +0100 | [diff] [blame] | 567 | } |
| 568 | |
| 569 | if (!svm || svm->pasid != req->pasid) { |
| 570 | rcu_read_lock(); |
Lu Baolu | af39507 | 2018-07-14 15:46:56 +0800 | [diff] [blame] | 571 | svm = intel_pasid_lookup_id(req->pasid); |
David Woodhouse | a222a7f | 2015-10-07 23:35:18 +0100 | [diff] [blame] | 572 | /* It *can't* go away, because the driver is not permitted |
| 573 | * to unbind the mm while any page faults are outstanding. |
| 574 | * So we only need RCU to protect the internal idr code. */ |
| 575 | rcu_read_unlock(); |
| 576 | |
| 577 | if (!svm) { |
| 578 | pr_err("%s: Page request for invalid PASID %d: %08llx %08llx\n", |
| 579 | iommu->name, req->pasid, ((unsigned long long *)req)[0], |
| 580 | ((unsigned long long *)req)[1]); |
David Woodhouse | 26322ab | 2015-10-15 21:12:56 +0100 | [diff] [blame] | 581 | goto no_pasid; |
David Woodhouse | a222a7f | 2015-10-07 23:35:18 +0100 | [diff] [blame] | 582 | } |
| 583 | } |
| 584 | |
| 585 | result = QI_RESP_INVALID; |
David Woodhouse | 5cec753 | 2015-10-15 15:52:15 +0100 | [diff] [blame] | 586 | /* Since we're using init_mm.pgd directly, we should never take |
| 587 | * any faults on kernel addresses. */ |
| 588 | if (!svm->mm) |
| 589 | goto bad_req; |
David Woodhouse | e57e58b | 2016-01-12 19:18:06 +0000 | [diff] [blame] | 590 | /* If the mm is already defunct, don't handle faults. */ |
Vegard Nossum | 388f793 | 2017-02-27 14:30:13 -0800 | [diff] [blame] | 591 | if (!mmget_not_zero(svm->mm)) |
David Woodhouse | e57e58b | 2016-01-12 19:18:06 +0000 | [diff] [blame] | 592 | goto bad_req; |
Ashok Raj | 9d8c3af | 2017-08-08 13:29:27 -0700 | [diff] [blame] | 593 | |
| 594 | /* If address is not canonical, return invalid response */ |
| 595 | if (!is_canonical_address(address)) |
| 596 | goto bad_req; |
| 597 | |
David Woodhouse | a222a7f | 2015-10-07 23:35:18 +0100 | [diff] [blame] | 598 | down_read(&svm->mm->mmap_sem); |
| 599 | vma = find_extend_vma(svm->mm, address); |
| 600 | if (!vma || address < vma->vm_start) |
| 601 | goto invalid; |
| 602 | |
Joerg Roedel | 7f8312a | 2015-11-17 16:11:39 +0100 | [diff] [blame] | 603 | if (access_error(vma, req)) |
| 604 | goto invalid; |
| 605 | |
Kirill A. Shutemov | dcddffd | 2016-07-26 15:25:18 -0700 | [diff] [blame] | 606 | ret = handle_mm_fault(vma, address, |
David Woodhouse | a222a7f | 2015-10-07 23:35:18 +0100 | [diff] [blame] | 607 | req->wr_req ? FAULT_FLAG_WRITE : 0); |
| 608 | if (ret & VM_FAULT_ERROR) |
| 609 | goto invalid; |
| 610 | |
| 611 | result = QI_RESP_SUCCESS; |
| 612 | invalid: |
| 613 | up_read(&svm->mm->mmap_sem); |
David Woodhouse | e57e58b | 2016-01-12 19:18:06 +0000 | [diff] [blame] | 614 | mmput(svm->mm); |
David Woodhouse | a222a7f | 2015-10-07 23:35:18 +0100 | [diff] [blame] | 615 | bad_req: |
| 616 | /* Accounting for major/minor faults? */ |
David Woodhouse | 0204a49 | 2015-10-13 17:18:10 +0100 | [diff] [blame] | 617 | rcu_read_lock(); |
| 618 | list_for_each_entry_rcu(sdev, &svm->devs, list) { |
Jacob Pan | 5b438f4 | 2019-01-11 13:04:57 +0800 | [diff] [blame] | 619 | if (sdev->sid == req->rid) |
David Woodhouse | 0204a49 | 2015-10-13 17:18:10 +0100 | [diff] [blame] | 620 | break; |
| 621 | } |
| 622 | /* Other devices can go away, but the drivers are not permitted |
| 623 | * to unbind while any page faults might be in flight. So it's |
| 624 | * OK to drop the 'lock' here now we have it. */ |
| 625 | rcu_read_unlock(); |
| 626 | |
| 627 | if (WARN_ON(&sdev->list == &svm->devs)) |
| 628 | sdev = NULL; |
| 629 | |
| 630 | if (sdev && sdev->ops && sdev->ops->fault_cb) { |
| 631 | int rwxp = (req->rd_req << 3) | (req->wr_req << 2) | |
Jacob Pan | 5b438f4 | 2019-01-11 13:04:57 +0800 | [diff] [blame] | 632 | (req->exe_req << 1) | (req->pm_req); |
| 633 | sdev->ops->fault_cb(sdev->dev, req->pasid, req->addr, |
| 634 | req->priv_data, rwxp, result); |
David Woodhouse | 0204a49 | 2015-10-13 17:18:10 +0100 | [diff] [blame] | 635 | } |
David Woodhouse | 26322ab | 2015-10-15 21:12:56 +0100 | [diff] [blame] | 636 | /* We get here in the error case where the PASID lookup failed, |
| 637 | and these can be NULL. Do not use them below this point! */ |
| 638 | sdev = NULL; |
| 639 | svm = NULL; |
| 640 | no_pasid: |
Jacob Pan | 5b438f4 | 2019-01-11 13:04:57 +0800 | [diff] [blame] | 641 | if (req->lpig || req->priv_data_present) { |
| 642 | /* |
| 643 | * Per VT-d spec. v3.0 ch7.7, system software must |
| 644 | * respond with page group response if private data |
| 645 | * is present (PDP) or last page in group (LPIG) bit |
| 646 | * is set. This is an additional VT-d feature beyond |
| 647 | * PCI ATS spec. |
| 648 | */ |
Lu Baolu | 5d308fc | 2018-12-10 09:58:58 +0800 | [diff] [blame] | 649 | resp.qw0 = QI_PGRP_PASID(req->pasid) | |
Jacob Pan | 5b438f4 | 2019-01-11 13:04:57 +0800 | [diff] [blame] | 650 | QI_PGRP_DID(req->rid) | |
David Woodhouse | a222a7f | 2015-10-07 23:35:18 +0100 | [diff] [blame] | 651 | QI_PGRP_PASID_P(req->pasid_present) | |
Jacob Pan | 5b438f4 | 2019-01-11 13:04:57 +0800 | [diff] [blame] | 652 | QI_PGRP_PDP(req->pasid_present) | |
| 653 | QI_PGRP_RESP_CODE(result) | |
David Woodhouse | a222a7f | 2015-10-07 23:35:18 +0100 | [diff] [blame] | 654 | QI_PGRP_RESP_TYPE; |
Lu Baolu | 5d308fc | 2018-12-10 09:58:58 +0800 | [diff] [blame] | 655 | resp.qw1 = QI_PGRP_IDX(req->prg_index) | |
Jacob Pan | 5b438f4 | 2019-01-11 13:04:57 +0800 | [diff] [blame] | 656 | QI_PGRP_LPIG(req->lpig); |
| 657 | |
| 658 | if (req->priv_data_present) |
| 659 | memcpy(&resp.qw2, req->priv_data, |
| 660 | sizeof(req->priv_data)); |
David Woodhouse | a222a7f | 2015-10-07 23:35:18 +0100 | [diff] [blame] | 661 | } |
Lu Baolu | 5d308fc | 2018-12-10 09:58:58 +0800 | [diff] [blame] | 662 | resp.qw2 = 0; |
| 663 | resp.qw3 = 0; |
| 664 | qi_submit_sync(&resp, iommu); |
David Woodhouse | a222a7f | 2015-10-07 23:35:18 +0100 | [diff] [blame] | 665 | |
| 666 | head = (head + sizeof(*req)) & PRQ_RING_MASK; |
| 667 | } |
| 668 | |
| 669 | dmar_writeq(iommu->reg + DMAR_PQH_REG, tail); |
| 670 | |
| 671 | return IRQ_RETVAL(handled); |
| 672 | } |