On Tue, Mar 26, 2013 at 04:20:54PM +0100, Andreas Degert wrote:
> There is a third sound device:
> 
> 04:00.0 Multimedia audio controller: Xilinx Corporation RME Hammerfall
> DSP (rev 35)
> 
> (at the end of the lspci listing in my first mail). This is the one that 
> doesn't
> work, it's connected via cardbus (yenta driver), so it appears a bit further
> down in the dmesg output.

Ah, I see. But still, this device is in the alias range and thus also
covered by IVRS. It should use 00:14.4 as the request-id.

Can you try the attached debug-patch, boot and send me dmesg again? This
should sched some light onto the problem.

Thanks,

        Joerg
diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c
index c1c74e0..b96af8a 100644
--- a/drivers/iommu/amd_iommu.c
+++ b/drivers/iommu/amd_iommu.c
@@ -244,21 +244,29 @@ static bool check_device(struct device *dev)
 {
 	u16 devid;
 
-	if (!dev || !dev->dma_mask)
+	if (!dev || !dev->dma_mask) {
+		pr_err("AMD-Vi: Device %s has no dma_mask\n", dev_name(dev));
 		return false;
+	}
 
 	/* No device or no PCI device */
-	if (dev->bus != &pci_bus_type)
+	if (dev->bus != &pci_bus_type) {
+		pr_err("AMD-Vi: Device %s is not PCI\n", dev_name(dev));
 		return false;
+	}
 
 	devid = get_device_id(dev);
 
 	/* Out of our scope? */
-	if (devid > amd_iommu_last_bdf)
+	if (devid > amd_iommu_last_bdf) {
+		pr_err("AMD-Vi: Device %s is out of range\n", dev_name(dev));
 		return false;
+	}
 
-	if (amd_iommu_rlookup_table[devid] == NULL)
+	if (amd_iommu_rlookup_table[devid] == NULL) {
+		pr_err("AMD-Vi: Device %s has no responsible IOMMU\n", dev_name(dev));
 		return false;
+	}
 
 	return true;
 }
@@ -2448,6 +2456,8 @@ static int device_change_notifier(struct notifier_block *nb,
 		break;
 	case BUS_NOTIFY_ADD_DEVICE:
 
+		pr_info("AMD-Vi: Adding device %s\n", dev_name(dev));
+
 		iommu_init_device(dev);
 
 		/*
@@ -2457,6 +2467,7 @@ static int device_change_notifier(struct notifier_block *nb,
 		dev_data = get_dev_data(dev);
 
 		if (iommu_pass_through || dev_data->iommu_v2) {
+			pr_info("AMD-Vi: Using pt-domain for %s\n", dev_name(dev));
 			dev_data->passthrough = true;
 			attach_device(dev, pt_domain);
 			break;
@@ -2466,11 +2477,15 @@ static int device_change_notifier(struct notifier_block *nb,
 
 		/* allocate a protection domain if a device is added */
 		dma_domain = find_protection_domain(devid);
-		if (dma_domain)
+		if (dma_domain) {
+			pr_info("AMD-Vi: Already dma_domain for %s\n", dev_name(dev));
 			goto out;
+		}
 		dma_domain = dma_ops_domain_alloc();
-		if (!dma_domain)
+		if (!dma_domain) {
+			pr_info("AMD-Vi: Can't alloc dma_domain for %s\n", dev_name(dev));
 			goto out;
+		}
 		dma_domain->target_dev = devid;
 
 		spin_lock_irqsave(&iommu_pd_list_lock, flags);
@@ -2484,6 +2499,8 @@ static int device_change_notifier(struct notifier_block *nb,
 		break;
 	case BUS_NOTIFY_DEL_DEVICE:
 
+		pr_info("AMD-Vi: Removing device %s\n", dev_name(dev));
+
 		iommu_uninit_device(dev);
 
 	default:
@@ -3122,10 +3139,13 @@ static unsigned device_dma_ops_init(void)
 
 		dev_data = get_dev_data(&pdev->dev);
 
-		if (!dev_data->passthrough)
+		if (!dev_data->passthrough) {
+			pr_info("AMD-Vi: Initializing %s to amd_iommu_dma_ops\n", dev_name(&pdev->dev));
 			pdev->dev.archdata.dma_ops = &amd_iommu_dma_ops;
-		else
+		} else {
+			pr_info("AMD-Vi: Initializing %s to nommu_dma_ops\n", dev_name(&pdev->dev));
 			pdev->dev.archdata.dma_ops = &nommu_dma_ops;
+		}
 	}
 
 	return unhandled;
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu

Reply via email to