svm.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /*
  3. * Copyright © 2015 Intel Corporation.
  4. *
  5. * Authors: David Woodhouse <dwmw2@infradead.org>
  6. */
  7. #include <linux/mmu_notifier.h>
  8. #include <linux/sched.h>
  9. #include <linux/sched/mm.h>
  10. #include <linux/slab.h>
  11. #include <linux/rculist.h>
  12. #include <linux/pci.h>
  13. #include <linux/pci-ats.h>
  14. #include <linux/dmar.h>
  15. #include <linux/interrupt.h>
  16. #include <linux/mm_types.h>
  17. #include <linux/xarray.h>
  18. #include <asm/page.h>
  19. #include <asm/fpu/api.h>
  20. #include "iommu.h"
  21. #include "pasid.h"
  22. #include "perf.h"
  23. #include "../iommu-pages.h"
  24. #include "trace.h"
  25. static irqreturn_t prq_event_thread(int irq, void *d);
  26. int intel_svm_enable_prq(struct intel_iommu *iommu)
  27. {
  28. struct iopf_queue *iopfq;
  29. int irq, ret;
  30. iommu->prq = iommu_alloc_pages_node(iommu->node, GFP_KERNEL, PRQ_ORDER);
  31. if (!iommu->prq) {
  32. pr_warn("IOMMU: %s: Failed to allocate page request queue\n",
  33. iommu->name);
  34. return -ENOMEM;
  35. }
  36. irq = dmar_alloc_hwirq(IOMMU_IRQ_ID_OFFSET_PRQ + iommu->seq_id, iommu->node, iommu);
  37. if (irq <= 0) {
  38. pr_err("IOMMU: %s: Failed to create IRQ vector for page request queue\n",
  39. iommu->name);
  40. ret = -EINVAL;
  41. goto free_prq;
  42. }
  43. iommu->pr_irq = irq;
  44. snprintf(iommu->iopfq_name, sizeof(iommu->iopfq_name),
  45. "dmar%d-iopfq", iommu->seq_id);
  46. iopfq = iopf_queue_alloc(iommu->iopfq_name);
  47. if (!iopfq) {
  48. pr_err("IOMMU: %s: Failed to allocate iopf queue\n", iommu->name);
  49. ret = -ENOMEM;
  50. goto free_hwirq;
  51. }
  52. iommu->iopf_queue = iopfq;
  53. snprintf(iommu->prq_name, sizeof(iommu->prq_name), "dmar%d-prq", iommu->seq_id);
  54. ret = request_threaded_irq(irq, NULL, prq_event_thread, IRQF_ONESHOT,
  55. iommu->prq_name, iommu);
  56. if (ret) {
  57. pr_err("IOMMU: %s: Failed to request IRQ for page request queue\n",
  58. iommu->name);
  59. goto free_iopfq;
  60. }
  61. dmar_writeq(iommu->reg + DMAR_PQH_REG, 0ULL);
  62. dmar_writeq(iommu->reg + DMAR_PQT_REG, 0ULL);
  63. dmar_writeq(iommu->reg + DMAR_PQA_REG, virt_to_phys(iommu->prq) | PRQ_ORDER);
  64. init_completion(&iommu->prq_complete);
  65. return 0;
  66. free_iopfq:
  67. iopf_queue_free(iommu->iopf_queue);
  68. iommu->iopf_queue = NULL;
  69. free_hwirq:
  70. dmar_free_hwirq(irq);
  71. iommu->pr_irq = 0;
  72. free_prq:
  73. iommu_free_pages(iommu->prq, PRQ_ORDER);
  74. iommu->prq = NULL;
  75. return ret;
  76. }
  77. int intel_svm_finish_prq(struct intel_iommu *iommu)
  78. {
  79. dmar_writeq(iommu->reg + DMAR_PQH_REG, 0ULL);
  80. dmar_writeq(iommu->reg + DMAR_PQT_REG, 0ULL);
  81. dmar_writeq(iommu->reg + DMAR_PQA_REG, 0ULL);
  82. if (iommu->pr_irq) {
  83. free_irq(iommu->pr_irq, iommu);
  84. dmar_free_hwirq(iommu->pr_irq);
  85. iommu->pr_irq = 0;
  86. }
  87. if (iommu->iopf_queue) {
  88. iopf_queue_free(iommu->iopf_queue);
  89. iommu->iopf_queue = NULL;
  90. }
  91. iommu_free_pages(iommu->prq, PRQ_ORDER);
  92. iommu->prq = NULL;
  93. return 0;
  94. }
  95. void intel_svm_check(struct intel_iommu *iommu)
  96. {
  97. if (!pasid_supported(iommu))
  98. return;
  99. if (cpu_feature_enabled(X86_FEATURE_GBPAGES) &&
  100. !cap_fl1gp_support(iommu->cap)) {
  101. pr_err("%s SVM disabled, incompatible 1GB page capability\n",
  102. iommu->name);
  103. return;
  104. }
  105. if (cpu_feature_enabled(X86_FEATURE_LA57) &&
  106. !cap_fl5lp_support(iommu->cap)) {
  107. pr_err("%s SVM disabled, incompatible paging mode\n",
  108. iommu->name);
  109. return;
  110. }
  111. iommu->flags |= VTD_FLAG_SVM_CAPABLE;
  112. }
  113. /* Pages have been freed at this point */
  114. static void intel_arch_invalidate_secondary_tlbs(struct mmu_notifier *mn,
  115. struct mm_struct *mm,
  116. unsigned long start, unsigned long end)
  117. {
  118. struct dmar_domain *domain = container_of(mn, struct dmar_domain, notifier);
  119. if (start == 0 && end == ULONG_MAX) {
  120. cache_tag_flush_all(domain);
  121. return;
  122. }
  123. /*
  124. * The mm_types defines vm_end as the first byte after the end address,
  125. * different from IOMMU subsystem using the last address of an address
  126. * range.
  127. */
  128. cache_tag_flush_range(domain, start, end - 1, 0);
  129. }
  130. static void intel_mm_release(struct mmu_notifier *mn, struct mm_struct *mm)
  131. {
  132. struct dmar_domain *domain = container_of(mn, struct dmar_domain, notifier);
  133. struct dev_pasid_info *dev_pasid;
  134. struct device_domain_info *info;
  135. unsigned long flags;
  136. /* This might end up being called from exit_mmap(), *before* the page
  137. * tables are cleared. And __mmu_notifier_release() will delete us from
  138. * the list of notifiers so that our invalidate_range() callback doesn't
  139. * get called when the page tables are cleared. So we need to protect
  140. * against hardware accessing those page tables.
  141. *
  142. * We do it by clearing the entry in the PASID table and then flushing
  143. * the IOTLB and the PASID table caches. This might upset hardware;
  144. * perhaps we'll want to point the PASID to a dummy PGD (like the zero
  145. * page) so that we end up taking a fault that the hardware really
  146. * *has* to handle gracefully without affecting other processes.
  147. */
  148. spin_lock_irqsave(&domain->lock, flags);
  149. list_for_each_entry(dev_pasid, &domain->dev_pasids, link_domain) {
  150. info = dev_iommu_priv_get(dev_pasid->dev);
  151. intel_pasid_tear_down_entry(info->iommu, dev_pasid->dev,
  152. dev_pasid->pasid, true);
  153. }
  154. spin_unlock_irqrestore(&domain->lock, flags);
  155. }
  156. static void intel_mm_free_notifier(struct mmu_notifier *mn)
  157. {
  158. struct dmar_domain *domain = container_of(mn, struct dmar_domain, notifier);
  159. kfree(domain->qi_batch);
  160. kfree(domain);
  161. }
  162. static const struct mmu_notifier_ops intel_mmuops = {
  163. .release = intel_mm_release,
  164. .arch_invalidate_secondary_tlbs = intel_arch_invalidate_secondary_tlbs,
  165. .free_notifier = intel_mm_free_notifier,
  166. };
  167. static int intel_svm_set_dev_pasid(struct iommu_domain *domain,
  168. struct device *dev, ioasid_t pasid)
  169. {
  170. struct device_domain_info *info = dev_iommu_priv_get(dev);
  171. struct dmar_domain *dmar_domain = to_dmar_domain(domain);
  172. struct intel_iommu *iommu = info->iommu;
  173. struct mm_struct *mm = domain->mm;
  174. struct dev_pasid_info *dev_pasid;
  175. unsigned long sflags;
  176. unsigned long flags;
  177. int ret = 0;
  178. dev_pasid = kzalloc(sizeof(*dev_pasid), GFP_KERNEL);
  179. if (!dev_pasid)
  180. return -ENOMEM;
  181. dev_pasid->dev = dev;
  182. dev_pasid->pasid = pasid;
  183. ret = cache_tag_assign_domain(to_dmar_domain(domain), dev, pasid);
  184. if (ret)
  185. goto free_dev_pasid;
  186. /* Setup the pasid table: */
  187. sflags = cpu_feature_enabled(X86_FEATURE_LA57) ? PASID_FLAG_FL5LP : 0;
  188. ret = intel_pasid_setup_first_level(iommu, dev, mm->pgd, pasid,
  189. FLPT_DEFAULT_DID, sflags);
  190. if (ret)
  191. goto unassign_tag;
  192. spin_lock_irqsave(&dmar_domain->lock, flags);
  193. list_add(&dev_pasid->link_domain, &dmar_domain->dev_pasids);
  194. spin_unlock_irqrestore(&dmar_domain->lock, flags);
  195. return 0;
  196. unassign_tag:
  197. cache_tag_unassign_domain(to_dmar_domain(domain), dev, pasid);
  198. free_dev_pasid:
  199. kfree(dev_pasid);
  200. return ret;
  201. }
  202. /* Page request queue descriptor */
  203. struct page_req_dsc {
  204. union {
  205. struct {
  206. u64 type:8;
  207. u64 pasid_present:1;
  208. u64 rsvd:7;
  209. u64 rid:16;
  210. u64 pasid:20;
  211. u64 exe_req:1;
  212. u64 pm_req:1;
  213. u64 rsvd2:10;
  214. };
  215. u64 qw_0;
  216. };
  217. union {
  218. struct {
  219. u64 rd_req:1;
  220. u64 wr_req:1;
  221. u64 lpig:1;
  222. u64 prg_index:9;
  223. u64 addr:52;
  224. };
  225. u64 qw_1;
  226. };
  227. u64 qw_2;
  228. u64 qw_3;
  229. };
  230. static bool is_canonical_address(u64 addr)
  231. {
  232. int shift = 64 - (__VIRTUAL_MASK_SHIFT + 1);
  233. long saddr = (long) addr;
  234. return (((saddr << shift) >> shift) == saddr);
  235. }
  236. /**
  237. * intel_drain_pasid_prq - Drain page requests and responses for a pasid
  238. * @dev: target device
  239. * @pasid: pasid for draining
  240. *
  241. * Drain all pending page requests and responses related to @pasid in both
  242. * software and hardware. This is supposed to be called after the device
  243. * driver has stopped DMA, the pasid entry has been cleared, and both IOTLB
  244. * and DevTLB have been invalidated.
  245. *
  246. * It waits until all pending page requests for @pasid in the page fault
  247. * queue are completed by the prq handling thread. Then follow the steps
  248. * described in VT-d spec CH7.10 to drain all page requests and page
  249. * responses pending in the hardware.
  250. */
  251. void intel_drain_pasid_prq(struct device *dev, u32 pasid)
  252. {
  253. struct device_domain_info *info;
  254. struct dmar_domain *domain;
  255. struct intel_iommu *iommu;
  256. struct qi_desc desc[3];
  257. struct pci_dev *pdev;
  258. int head, tail;
  259. u16 sid, did;
  260. int qdep;
  261. info = dev_iommu_priv_get(dev);
  262. if (WARN_ON(!info || !dev_is_pci(dev)))
  263. return;
  264. if (!info->pri_enabled)
  265. return;
  266. iommu = info->iommu;
  267. domain = info->domain;
  268. pdev = to_pci_dev(dev);
  269. sid = PCI_DEVID(info->bus, info->devfn);
  270. did = domain ? domain_id_iommu(domain, iommu) : FLPT_DEFAULT_DID;
  271. qdep = pci_ats_queue_depth(pdev);
  272. /*
  273. * Check and wait until all pending page requests in the queue are
  274. * handled by the prq handling thread.
  275. */
  276. prq_retry:
  277. reinit_completion(&iommu->prq_complete);
  278. tail = dmar_readq(iommu->reg + DMAR_PQT_REG) & PRQ_RING_MASK;
  279. head = dmar_readq(iommu->reg + DMAR_PQH_REG) & PRQ_RING_MASK;
  280. while (head != tail) {
  281. struct page_req_dsc *req;
  282. req = &iommu->prq[head / sizeof(*req)];
  283. if (!req->pasid_present || req->pasid != pasid) {
  284. head = (head + sizeof(*req)) & PRQ_RING_MASK;
  285. continue;
  286. }
  287. wait_for_completion(&iommu->prq_complete);
  288. goto prq_retry;
  289. }
  290. iopf_queue_flush_dev(dev);
  291. /*
  292. * Perform steps described in VT-d spec CH7.10 to drain page
  293. * requests and responses in hardware.
  294. */
  295. memset(desc, 0, sizeof(desc));
  296. desc[0].qw0 = QI_IWD_STATUS_DATA(QI_DONE) |
  297. QI_IWD_FENCE |
  298. QI_IWD_TYPE;
  299. desc[1].qw0 = QI_EIOTLB_PASID(pasid) |
  300. QI_EIOTLB_DID(did) |
  301. QI_EIOTLB_GRAN(QI_GRAN_NONG_PASID) |
  302. QI_EIOTLB_TYPE;
  303. desc[2].qw0 = QI_DEV_EIOTLB_PASID(pasid) |
  304. QI_DEV_EIOTLB_SID(sid) |
  305. QI_DEV_EIOTLB_QDEP(qdep) |
  306. QI_DEIOTLB_TYPE |
  307. QI_DEV_IOTLB_PFSID(info->pfsid);
  308. qi_retry:
  309. reinit_completion(&iommu->prq_complete);
  310. qi_submit_sync(iommu, desc, 3, QI_OPT_WAIT_DRAIN);
  311. if (readl(iommu->reg + DMAR_PRS_REG) & DMA_PRS_PRO) {
  312. wait_for_completion(&iommu->prq_complete);
  313. goto qi_retry;
  314. }
  315. }
  316. static int prq_to_iommu_prot(struct page_req_dsc *req)
  317. {
  318. int prot = 0;
  319. if (req->rd_req)
  320. prot |= IOMMU_FAULT_PERM_READ;
  321. if (req->wr_req)
  322. prot |= IOMMU_FAULT_PERM_WRITE;
  323. if (req->exe_req)
  324. prot |= IOMMU_FAULT_PERM_EXEC;
  325. if (req->pm_req)
  326. prot |= IOMMU_FAULT_PERM_PRIV;
  327. return prot;
  328. }
  329. static void intel_svm_prq_report(struct intel_iommu *iommu, struct device *dev,
  330. struct page_req_dsc *desc)
  331. {
  332. struct iopf_fault event = { };
  333. /* Fill in event data for device specific processing */
  334. event.fault.type = IOMMU_FAULT_PAGE_REQ;
  335. event.fault.prm.addr = (u64)desc->addr << VTD_PAGE_SHIFT;
  336. event.fault.prm.pasid = desc->pasid;
  337. event.fault.prm.grpid = desc->prg_index;
  338. event.fault.prm.perm = prq_to_iommu_prot(desc);
  339. if (desc->lpig)
  340. event.fault.prm.flags |= IOMMU_FAULT_PAGE_REQUEST_LAST_PAGE;
  341. if (desc->pasid_present) {
  342. event.fault.prm.flags |= IOMMU_FAULT_PAGE_REQUEST_PASID_VALID;
  343. event.fault.prm.flags |= IOMMU_FAULT_PAGE_RESPONSE_NEEDS_PASID;
  344. }
  345. iommu_report_device_fault(dev, &event);
  346. }
  347. static void handle_bad_prq_event(struct intel_iommu *iommu,
  348. struct page_req_dsc *req, int result)
  349. {
  350. struct qi_desc desc = { };
  351. pr_err("%s: Invalid page request: %08llx %08llx\n",
  352. iommu->name, ((unsigned long long *)req)[0],
  353. ((unsigned long long *)req)[1]);
  354. if (!req->lpig)
  355. return;
  356. desc.qw0 = QI_PGRP_PASID(req->pasid) |
  357. QI_PGRP_DID(req->rid) |
  358. QI_PGRP_PASID_P(req->pasid_present) |
  359. QI_PGRP_RESP_CODE(result) |
  360. QI_PGRP_RESP_TYPE;
  361. desc.qw1 = QI_PGRP_IDX(req->prg_index) |
  362. QI_PGRP_LPIG(req->lpig);
  363. qi_submit_sync(iommu, &desc, 1, 0);
  364. }
  365. static irqreturn_t prq_event_thread(int irq, void *d)
  366. {
  367. struct intel_iommu *iommu = d;
  368. struct page_req_dsc *req;
  369. int head, tail, handled;
  370. struct device *dev;
  371. u64 address;
  372. /*
  373. * Clear PPR bit before reading head/tail registers, to ensure that
  374. * we get a new interrupt if needed.
  375. */
  376. writel(DMA_PRS_PPR, iommu->reg + DMAR_PRS_REG);
  377. tail = dmar_readq(iommu->reg + DMAR_PQT_REG) & PRQ_RING_MASK;
  378. head = dmar_readq(iommu->reg + DMAR_PQH_REG) & PRQ_RING_MASK;
  379. handled = (head != tail);
  380. while (head != tail) {
  381. req = &iommu->prq[head / sizeof(*req)];
  382. address = (u64)req->addr << VTD_PAGE_SHIFT;
  383. if (unlikely(!req->pasid_present)) {
  384. pr_err("IOMMU: %s: Page request without PASID\n",
  385. iommu->name);
  386. bad_req:
  387. handle_bad_prq_event(iommu, req, QI_RESP_INVALID);
  388. goto prq_advance;
  389. }
  390. if (unlikely(!is_canonical_address(address))) {
  391. pr_err("IOMMU: %s: Address is not canonical\n",
  392. iommu->name);
  393. goto bad_req;
  394. }
  395. if (unlikely(req->pm_req && (req->rd_req | req->wr_req))) {
  396. pr_err("IOMMU: %s: Page request in Privilege Mode\n",
  397. iommu->name);
  398. goto bad_req;
  399. }
  400. if (unlikely(req->exe_req && req->rd_req)) {
  401. pr_err("IOMMU: %s: Execution request not supported\n",
  402. iommu->name);
  403. goto bad_req;
  404. }
  405. /* Drop Stop Marker message. No need for a response. */
  406. if (unlikely(req->lpig && !req->rd_req && !req->wr_req))
  407. goto prq_advance;
  408. /*
  409. * If prq is to be handled outside iommu driver via receiver of
  410. * the fault notifiers, we skip the page response here.
  411. */
  412. mutex_lock(&iommu->iopf_lock);
  413. dev = device_rbtree_find(iommu, req->rid);
  414. if (!dev) {
  415. mutex_unlock(&iommu->iopf_lock);
  416. goto bad_req;
  417. }
  418. intel_svm_prq_report(iommu, dev, req);
  419. trace_prq_report(iommu, dev, req->qw_0, req->qw_1,
  420. req->qw_2, req->qw_3,
  421. iommu->prq_seq_number++);
  422. mutex_unlock(&iommu->iopf_lock);
  423. prq_advance:
  424. head = (head + sizeof(*req)) & PRQ_RING_MASK;
  425. }
  426. dmar_writeq(iommu->reg + DMAR_PQH_REG, tail);
  427. /*
  428. * Clear the page request overflow bit and wake up all threads that
  429. * are waiting for the completion of this handling.
  430. */
  431. if (readl(iommu->reg + DMAR_PRS_REG) & DMA_PRS_PRO) {
  432. pr_info_ratelimited("IOMMU: %s: PRQ overflow detected\n",
  433. iommu->name);
  434. head = dmar_readq(iommu->reg + DMAR_PQH_REG) & PRQ_RING_MASK;
  435. tail = dmar_readq(iommu->reg + DMAR_PQT_REG) & PRQ_RING_MASK;
  436. if (head == tail) {
  437. iopf_queue_discard_partial(iommu->iopf_queue);
  438. writel(DMA_PRS_PRO, iommu->reg + DMAR_PRS_REG);
  439. pr_info_ratelimited("IOMMU: %s: PRQ overflow cleared",
  440. iommu->name);
  441. }
  442. }
  443. if (!completion_done(&iommu->prq_complete))
  444. complete(&iommu->prq_complete);
  445. return IRQ_RETVAL(handled);
  446. }
  447. void intel_svm_page_response(struct device *dev, struct iopf_fault *evt,
  448. struct iommu_page_response *msg)
  449. {
  450. struct device_domain_info *info = dev_iommu_priv_get(dev);
  451. struct intel_iommu *iommu = info->iommu;
  452. u8 bus = info->bus, devfn = info->devfn;
  453. struct iommu_fault_page_request *prm;
  454. struct qi_desc desc;
  455. bool pasid_present;
  456. bool last_page;
  457. u16 sid;
  458. prm = &evt->fault.prm;
  459. sid = PCI_DEVID(bus, devfn);
  460. pasid_present = prm->flags & IOMMU_FAULT_PAGE_REQUEST_PASID_VALID;
  461. last_page = prm->flags & IOMMU_FAULT_PAGE_REQUEST_LAST_PAGE;
  462. desc.qw0 = QI_PGRP_PASID(prm->pasid) | QI_PGRP_DID(sid) |
  463. QI_PGRP_PASID_P(pasid_present) |
  464. QI_PGRP_RESP_CODE(msg->code) |
  465. QI_PGRP_RESP_TYPE;
  466. desc.qw1 = QI_PGRP_IDX(prm->grpid) | QI_PGRP_LPIG(last_page);
  467. desc.qw2 = 0;
  468. desc.qw3 = 0;
  469. qi_submit_sync(iommu, &desc, 1, 0);
  470. }
  471. static void intel_svm_domain_free(struct iommu_domain *domain)
  472. {
  473. struct dmar_domain *dmar_domain = to_dmar_domain(domain);
  474. /* dmar_domain free is deferred to the mmu free_notifier callback. */
  475. mmu_notifier_put(&dmar_domain->notifier);
  476. }
  477. static const struct iommu_domain_ops intel_svm_domain_ops = {
  478. .set_dev_pasid = intel_svm_set_dev_pasid,
  479. .free = intel_svm_domain_free
  480. };
  481. struct iommu_domain *intel_svm_domain_alloc(struct device *dev,
  482. struct mm_struct *mm)
  483. {
  484. struct dmar_domain *domain;
  485. int ret;
  486. domain = kzalloc(sizeof(*domain), GFP_KERNEL);
  487. if (!domain)
  488. return ERR_PTR(-ENOMEM);
  489. domain->domain.ops = &intel_svm_domain_ops;
  490. domain->use_first_level = true;
  491. INIT_LIST_HEAD(&domain->dev_pasids);
  492. INIT_LIST_HEAD(&domain->cache_tags);
  493. spin_lock_init(&domain->cache_lock);
  494. spin_lock_init(&domain->lock);
  495. domain->notifier.ops = &intel_mmuops;
  496. ret = mmu_notifier_register(&domain->notifier, mm);
  497. if (ret) {
  498. kfree(domain);
  499. return ERR_PTR(ret);
  500. }
  501. return &domain->domain;
  502. }