init.c (6f47c7ae8c7afaf9ad291d39f0d3974f191a7946) init.c (14678219cf4093e897ab353fd78eab7994d1be7d)
1// SPDX-License-Identifier: GPL-2.0
2/* Copyright(c) 2019 Intel Corporation. All rights rsvd. */
3#include <linux/init.h>
4#include <linux/kernel.h>
5#include <linux/module.h>
6#include <linux/slab.h>
7#include <linux/pci.h>
8#include <linux/interrupt.h>

--- 33 unchanged lines hidden (view full) ---

42static struct idxd_driver_data idxd_driver_data[] = {
43 [IDXD_TYPE_DSA] = {
44 .name_prefix = "dsa",
45 .type = IDXD_TYPE_DSA,
46 .compl_size = sizeof(struct dsa_completion_record),
47 .align = 32,
48 .dev_type = &dsa_device_type,
49 .evl_cr_off = offsetof(struct dsa_evl_entry, cr),
1// SPDX-License-Identifier: GPL-2.0
2/* Copyright(c) 2019 Intel Corporation. All rights rsvd. */
3#include <linux/init.h>
4#include <linux/kernel.h>
5#include <linux/module.h>
6#include <linux/slab.h>
7#include <linux/pci.h>
8#include <linux/interrupt.h>

--- 33 unchanged lines hidden (view full) ---

42static struct idxd_driver_data idxd_driver_data[] = {
43 [IDXD_TYPE_DSA] = {
44 .name_prefix = "dsa",
45 .type = IDXD_TYPE_DSA,
46 .compl_size = sizeof(struct dsa_completion_record),
47 .align = 32,
48 .dev_type = &dsa_device_type,
49 .evl_cr_off = offsetof(struct dsa_evl_entry, cr),
50 .user_submission_safe = false, /* See INTEL-SA-01084 security advisory */
50 .cr_status_off = offsetof(struct dsa_completion_record, status),
51 .cr_result_off = offsetof(struct dsa_completion_record, result),
52 },
53 [IDXD_TYPE_IAX] = {
54 .name_prefix = "iax",
55 .type = IDXD_TYPE_IAX,
56 .compl_size = sizeof(struct iax_completion_record),
57 .align = 64,
58 .dev_type = &iax_device_type,
59 .evl_cr_off = offsetof(struct iax_evl_entry, cr),
51 .cr_status_off = offsetof(struct dsa_completion_record, status),
52 .cr_result_off = offsetof(struct dsa_completion_record, result),
53 },
54 [IDXD_TYPE_IAX] = {
55 .name_prefix = "iax",
56 .type = IDXD_TYPE_IAX,
57 .compl_size = sizeof(struct iax_completion_record),
58 .align = 64,
59 .dev_type = &iax_device_type,
60 .evl_cr_off = offsetof(struct iax_evl_entry, cr),
61 .user_submission_safe = false, /* See INTEL-SA-01084 security advisory */
60 .cr_status_off = offsetof(struct iax_completion_record, status),
61 .cr_result_off = offsetof(struct iax_completion_record, error_code),
62 .load_device_defaults = idxd_load_iaa_device_defaults,
63 },
64};
65
66static struct pci_device_id idxd_pci_tbl[] = {
67 /* DSA ver 1.0 platforms */

--- 509 unchanged lines hidden (view full) ---

577 pasid = iommu_alloc_global_pasid(dev);
578 if (pasid == IOMMU_PASID_INVALID)
579 return -ENOSPC;
580
581 /*
582 * DMA domain is owned by the driver, it should support all valid
583 * types such as DMA-FQ, identity, etc.
584 */
62 .cr_status_off = offsetof(struct iax_completion_record, status),
63 .cr_result_off = offsetof(struct iax_completion_record, error_code),
64 .load_device_defaults = idxd_load_iaa_device_defaults,
65 },
66};
67
68static struct pci_device_id idxd_pci_tbl[] = {
69 /* DSA ver 1.0 platforms */

--- 509 unchanged lines hidden (view full) ---

579 pasid = iommu_alloc_global_pasid(dev);
580 if (pasid == IOMMU_PASID_INVALID)
581 return -ENOSPC;
582
583 /*
584 * DMA domain is owned by the driver, it should support all valid
585 * types such as DMA-FQ, identity, etc.
586 */
585 ret = iommu_attach_device_pasid(domain, dev, pasid);
587 ret = iommu_attach_device_pasid(domain, dev, pasid, NULL);
586 if (ret) {
587 dev_err(dev, "failed to attach device pasid %d, domain type %d",
588 pasid, domain->type);
589 iommu_free_global_pasid(pasid);
590 return ret;
591 }
592
593 /* Since we set user privilege for kernel DMA, enable completion IRQ */

--- 175 unchanged lines hidden (view full) ---

769
770 rc = idxd_device_init_debugfs(idxd);
771 if (rc)
772 dev_warn(dev, "IDXD debugfs failed to setup\n");
773
774 dev_info(&pdev->dev, "Intel(R) Accelerator Device (v%x)\n",
775 idxd->hw.version);
776
588 if (ret) {
589 dev_err(dev, "failed to attach device pasid %d, domain type %d",
590 pasid, domain->type);
591 iommu_free_global_pasid(pasid);
592 return ret;
593 }
594
595 /* Since we set user privilege for kernel DMA, enable completion IRQ */

--- 175 unchanged lines hidden (view full) ---

771
772 rc = idxd_device_init_debugfs(idxd);
773 if (rc)
774 dev_warn(dev, "IDXD debugfs failed to setup\n");
775
776 dev_info(&pdev->dev, "Intel(R) Accelerator Device (v%x)\n",
777 idxd->hw.version);
778
779 idxd->user_submission_safe = data->user_submission_safe;
780
777 return 0;
778
779 err_dev_register:
780 idxd_cleanup(idxd);
781 err:
782 pci_iounmap(pdev, idxd->reg_base);
783 err_iomap:
784 put_device(idxd_confdev(idxd));

--- 145 unchanged lines hidden ---
781 return 0;
782
783 err_dev_register:
784 idxd_cleanup(idxd);
785 err:
786 pci_iounmap(pdev, idxd->reg_base);
787 err_iomap:
788 put_device(idxd_confdev(idxd));

--- 145 unchanged lines hidden ---