Skip to content

Commit 02a2aa3

Browse files
committed
Merge tag 'iommu-fixes-v5.10-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu
Pull iommu fixes from Joerg Roedel: - Fix a NULL-ptr dereference in the Intel VT-d driver - Two fixes for Intel SVM support - Increase IRQ remapping table size in the AMD IOMMU driver. The old number of 128 turned out to be too low for some recent devices. - Fix a mask check in generic IOMMU code * tag 'iommu-fixes-v5.10-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/joro/iommu: iommu: Fix a check in iommu_check_bind_data() iommu/vt-d: Fix a bug for PDP check in prq_event_thread iommu/vt-d: Fix sid not set issue in intel_svm_bind_gpasid() iommu/vt-d: Fix kernel NULL pointer dereference in find_domain() iommu/amd: Increase interrupt remapping table limit to 512 entries
2 parents 1669ecf + 4dd6ce4 commit 02a2aa3

4 files changed

Lines changed: 16 additions & 3 deletions

File tree

drivers/iommu/amd/amd_iommu_types.h

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,11 @@ extern bool amd_iommu_np_cache;
409409
/* Only true if all IOMMUs support device IOTLBs */
410410
extern bool amd_iommu_iotlb_sup;
411411

412-
#define MAX_IRQS_PER_TABLE 256
412+
/*
413+
* AMD IOMMU hardware only support 512 IRTEs despite
414+
* the architectural limitation of 2048 entries.
415+
*/
416+
#define MAX_IRQS_PER_TABLE 512
413417
#define IRQ_TABLE_ALIGNMENT 128
414418

415419
struct irq_remap_table {

drivers/iommu/intel/iommu.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2525,6 +2525,9 @@ struct dmar_domain *find_domain(struct device *dev)
25252525
{
25262526
struct device_domain_info *info;
25272527

2528+
if (unlikely(!dev || !dev->iommu))
2529+
return NULL;
2530+
25282531
if (unlikely(attach_deferred(dev)))
25292532
return NULL;
25302533

drivers/iommu/intel/svm.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,7 @@ int intel_svm_bind_gpasid(struct iommu_domain *domain, struct device *dev,
279279
struct intel_iommu *iommu = device_to_iommu(dev, NULL, NULL);
280280
struct intel_svm_dev *sdev = NULL;
281281
struct dmar_domain *dmar_domain;
282+
struct device_domain_info *info;
282283
struct intel_svm *svm = NULL;
283284
int ret = 0;
284285

@@ -310,6 +311,10 @@ int intel_svm_bind_gpasid(struct iommu_domain *domain, struct device *dev,
310311
if (data->hpasid <= 0 || data->hpasid >= PASID_MAX)
311312
return -EINVAL;
312313

314+
info = get_domain_info(dev);
315+
if (!info)
316+
return -EINVAL;
317+
313318
dmar_domain = to_dmar_domain(domain);
314319

315320
mutex_lock(&pasid_mutex);
@@ -357,6 +362,7 @@ int intel_svm_bind_gpasid(struct iommu_domain *domain, struct device *dev,
357362
goto out;
358363
}
359364
sdev->dev = dev;
365+
sdev->sid = PCI_DEVID(info->bus, info->devfn);
360366

361367
/* Only count users if device has aux domains */
362368
if (iommu_dev_feature_enabled(dev, IOMMU_DEV_FEAT_AUX))
@@ -1029,7 +1035,7 @@ static irqreturn_t prq_event_thread(int irq, void *d)
10291035
resp.qw0 = QI_PGRP_PASID(req->pasid) |
10301036
QI_PGRP_DID(req->rid) |
10311037
QI_PGRP_PASID_P(req->pasid_present) |
1032-
QI_PGRP_PDP(req->pasid_present) |
1038+
QI_PGRP_PDP(req->priv_data_present) |
10331039
QI_PGRP_RESP_CODE(result) |
10341040
QI_PGRP_RESP_TYPE;
10351041
resp.qw1 = QI_PGRP_IDX(req->prg_index) |

drivers/iommu/iommu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2071,7 +2071,7 @@ EXPORT_SYMBOL_GPL(iommu_uapi_cache_invalidate);
20712071

20722072
static int iommu_check_bind_data(struct iommu_gpasid_bind_data *data)
20732073
{
2074-
u32 mask;
2074+
u64 mask;
20752075
int i;
20762076

20772077
if (data->version != IOMMU_GPASID_BIND_VERSION_1)

0 commit comments

Comments
 (0)