Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp3719821imm; Mon, 8 Oct 2018 08:28:39 -0700 (PDT) X-Google-Smtp-Source: ACcGV628CA+BT+9wBABj5zE8sHN4SDQ8Wlh1EEu9XdwBejAhoLSZ6iKdkmtVnTef9/oSVepSaHZQ X-Received: by 2002:a62:6344:: with SMTP id x65-v6mr14567143pfb.13.1539012519750; Mon, 08 Oct 2018 08:28:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539012519; cv=none; d=google.com; s=arc-20160816; b=bOo8ICwBwYkCqfr7Hnaq6SvrWMfEPacJGr+JFRocloCj/6Uv8QvJus3MUGHp1LBdg3 Y47zfJgV1tyKMtiE6wjCftNy233NKAELRvk50A3lqJbmNTRHom4l194NDsybwNQFvNcO 5fsqc3caBQI5jEnn2uXSt4bd9/BOdYrtRgYH2H6uR9fX1dHi6eFqS329RdnWDWqu58Et QoM1QlgPEP5AjyDVh+CJ/iOYu8WVqxuZ3JDBwIuE/2XpKeOwL7jdPajk0bSKgJpqF+Ny iWstcAoMeD0L7Q4JFHSyZIpD/hJ3HeJ1L1rA4UKArmxqvSRPVp+L0lHPOlna0Rq/u0DO QeRQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=FGGmBfv2BstJ4A1+4MHAqw3AewzAPwcSWTrVp7lvdzs=; b=0JZxEj9J2qdo2549HT4XONfzZRX8X+OJMnkVpQ3hUs3sgUEu5tUkGmCQsluEFzb5L7 +9V0fQVPY+2YiCoaG8SkASeFCAVZbic7kf8FVl9UzzGCt66GBfWRjEXmVsxjmZ7+83qJ oHY1phfu5yMCm8UomTUtkjK53OJQn4L2vHNGrWGvo93bJEOQpNDIpcjZ0iC5xY+9JUID 3IcxzWrqm0zGYLelLzbQ5gMGciQEmPwEp9B97p21Km3cLaM3ZmCebjPhN1Gzi6XXT3vW sPY3bsRPsoLrZqMUPM+YUAI79bMWbJPAE6xYRpXZnefnSd77AvXOA7mzR1FVZcFvnCY1 pwbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=IdbGZGpg; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d66-v6si18148792pfc.250.2018.10.08.08.28.24; Mon, 08 Oct 2018 08:28:39 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=IdbGZGpg; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728190AbeJHWif (ORCPT + 99 others); Mon, 8 Oct 2018 18:38:35 -0400 Received: from mail.kernel.org ([198.145.29.99]:57282 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728164AbeJHWif (ORCPT ); Mon, 8 Oct 2018 18:38:35 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6A98F2152D; Mon, 8 Oct 2018 15:26:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1539012380; bh=tBtdXwvmrdDCKShARp1tLL1qz8S/LJTZ91JwziBltL4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IdbGZGpgTLOkkQ0TKQmAyzgA+P+NBqqJmRcidMrFXGyd/2pz7lBbx1bZCRPP2reFL euyXbe2jLhE+b1NPeSF+R3b6vGnt8dJ99V/2Hvu3nc0d+4ErBBwph1gssC50zjUVMu eu9r2DtDoVjHrF3gtdwtjn1kDU3Uiy97AGQ4NvjU= From: Sasha Levin To: stable@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Arindam Nath , Joerg Roedel , Sasha Levin Subject: [PATCH AUTOSEL 4.18 57/58] iommu/amd: Return devid as alias for ACPI HID devices Date: Mon, 8 Oct 2018 11:25:22 -0400 Message-Id: <20181008152523.70705-57-sashal@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181008152523.70705-1-sashal@kernel.org> References: <20181008152523.70705-1-sashal@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Arindam Nath [ Upstream commit 5ebb1bc2d63d90dd204169e21fd7a0b4bb8c776e ] ACPI HID devices do not actually have an alias for them in the IVRS. But dev_data->alias is still used for indexing into the IOMMU device table for devices being handled by the IOMMU. So for ACPI HID devices, we simply return the corresponding devid as an alias, as parsed from IVRS table. Signed-off-by: Arindam Nath Fixes: 2bf9a0a12749 ('iommu/amd: Add iommu support for ACPI HID devices') Signed-off-by: Joerg Roedel Signed-off-by: Sasha Levin --- drivers/iommu/amd_iommu.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c index d77c97fe4a23..e6995cf3d6dd 100644 --- a/drivers/iommu/amd_iommu.c +++ b/drivers/iommu/amd_iommu.c @@ -246,7 +246,13 @@ static u16 get_alias(struct device *dev) /* The callers make sure that get_device_id() does not fail here */ devid = get_device_id(dev); + + /* For ACPI HID devices, we simply return the devid as such */ + if (!dev_is_pci(dev)) + return devid; + ivrs_alias = amd_iommu_alias_table[devid]; + pci_for_each_dma_alias(pdev, __last_alias, &pci_alias); if (ivrs_alias == pci_alias) -- 2.17.1