diff options
| author | Dmitry Torokhov <[email protected]> | 2023-08-30 16:06:38 -0700 | 
|---|---|---|
| committer | Dmitry Torokhov <[email protected]> | 2023-08-30 16:06:38 -0700 | 
| commit | 1ac731c529cd4d6adbce134754b51ff7d822b145 (patch) | |
| tree | 143ab3f35ca5f3b69f583c84e6964b17139c2ec1 /drivers/iommu/intel/dmar.c | |
| parent | 07b4c950f27bef0362dc6ad7ee713aab61d58149 (diff) | |
| parent | 54116d442e001e1b6bd482122043b1870998a1f3 (diff) | |
Merge branch 'next' into for-linus
Prepare input updates for 6.6 merge window.
Diffstat (limited to 'drivers/iommu/intel/dmar.c')
| -rw-r--r-- | drivers/iommu/intel/dmar.c | 16 | 
1 files changed, 7 insertions, 9 deletions
diff --git a/drivers/iommu/intel/dmar.c b/drivers/iommu/intel/dmar.c index 6acfe879589c..a3414afe11b0 100644 --- a/drivers/iommu/intel/dmar.c +++ b/drivers/iommu/intel/dmar.c @@ -127,8 +127,6 @@ dmar_alloc_pci_notify_info(struct pci_dev *dev, unsigned long event)  	struct pci_dev *tmp;  	struct dmar_pci_notify_info *info; -	BUG_ON(dev->is_virtfn); -  	/*  	 * Ignore devices that have a domain number higher than what can  	 * be looked up in DMAR, e.g. VMD subdevices with domain 0x10000 @@ -264,7 +262,8 @@ int dmar_insert_dev_scope(struct dmar_pci_notify_info *info,  						   get_device(dev));  				return 1;  			} -		BUG_ON(i >= devices_cnt); +		if (WARN_ON(i >= devices_cnt)) +			return -EINVAL;  	}  	return 0; @@ -993,8 +992,6 @@ static int map_iommu(struct intel_iommu *iommu, struct dmar_drhd_unit *drhd)  		warn_invalid_dmar(phys_addr, " returns all ones");  		goto unmap;  	} -	if (ecap_vcs(iommu->ecap)) -		iommu->vccap = dmar_readq(iommu->reg + DMAR_VCCAP_REG);  	/* the registers might be more than one page */  	map_size = max_t(int, ecap_max_iotlb_offset(iommu->ecap), @@ -1071,7 +1068,8 @@ static int alloc_iommu(struct dmar_drhd_unit *drhd)  	}  	err = -EINVAL; -	if (cap_sagaw(iommu->cap) == 0) { +	if (!cap_sagaw(iommu->cap) && +	    (!ecap_smts(iommu->ecap) || ecap_slts(iommu->ecap))) {  		pr_info("%s: No supported address widths. Not attempting DMA translation.\n",  			iommu->name);  		drhd->ignored = 1; @@ -1689,7 +1687,7 @@ static void __dmar_enable_qi(struct intel_iommu *iommu)  	 * is present.  	 */  	if (ecap_smts(iommu->ecap)) -		val |= (1 << 11) | 1; +		val |= BIT_ULL(11) | BIT_ULL(0);  	raw_spin_lock_irqsave(&iommu->register_lock, flags); @@ -1960,7 +1958,7 @@ static int dmar_fault_do_one(struct intel_iommu *iommu, int type,  		return 0;  	} -	if (pasid == INVALID_IOASID) +	if (pasid == IOMMU_PASID_INVALID)  		pr_err("[%s NO_PASID] Request device [%02x:%02x.%d] fault addr 0x%llx [fault reason 0x%02x] %s\n",  		       type ? "DMA Read" : "DMA Write",  		       source_id >> 8, PCI_SLOT(source_id & 0xFF), @@ -2041,7 +2039,7 @@ irqreturn_t dmar_fault(int irq, void *dev_id)  		if (!ratelimited)  			/* Using pasid -1 if pasid is not present */  			dmar_fault_do_one(iommu, type, fault_reason, -					  pasid_present ? pasid : INVALID_IOASID, +					  pasid_present ? pasid : IOMMU_PASID_INVALID,  					  source_id, guest_addr);  		fault_index++;  |