From patchwork Tue Jan 5 10:07:22 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Wan X-Patchwork-Id: 59166 Delivered-To: patch@linaro.org Received: by 10.112.130.2 with SMTP id oa2csp5710110lbb; Mon, 4 Jan 2016 18:29:28 -0800 (PST) X-Received: by 10.66.185.225 with SMTP id ff1mr119672137pac.97.1451960968524; Mon, 04 Jan 2016 18:29:28 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n88si44849802pfb.107.2016.01.04.18.29.27; Mon, 04 Jan 2016 18:29:28 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754088AbcAEC30 (ORCPT + 29 others); Mon, 4 Jan 2016 21:29:26 -0500 Received: from mail-by2on0088.outbound.protection.outlook.com ([207.46.100.88]:63328 "EHLO na01-by2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753841AbcAEC3M (ORCPT ); Mon, 4 Jan 2016 21:29:12 -0500 Received: from BY2PR12CA0010.namprd12.prod.outlook.com (10.160.121.20) by SN1PR12MB0863.namprd12.prod.outlook.com (10.164.27.13) with Microsoft SMTP Server (TLS) id 15.1.361.13; Tue, 5 Jan 2016 02:29:08 +0000 Received: from CO1NAM03FT011.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e48::204) by BY2PR12CA0010.outlook.office365.com (2a01:111:e400:2c84::20) with Microsoft SMTP Server (TLS) id 15.1.361.13 via Frontend Transport; Tue, 5 Jan 2016 02:29:09 +0000 Authentication-Results: spf=none (sender IP is 165.204.84.221) smtp.mailfrom=amd.com; 8bytes.org; dkim=none (message not signed) header.d=none; 8bytes.org; dmarc=permerror action=none header.from=amd.com; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) Received: from atltwp01.amd.com (165.204.84.221) by CO1NAM03FT011.mail.protection.outlook.com (10.152.80.87) with Microsoft SMTP Server id 15.1.355.15 via Frontend Transport; Tue, 5 Jan 2016 02:29:07 +0000 X-WSS-ID: 0O0GK8I-07-1AR-02 X-M-MSG: Received: from satlvexedge01.amd.com (satlvexedge01.amd.com [10.177.96.28]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by atltwp01.amd.com (Axway MailGate 5.3.1) with ESMTPS id 26E3012C08D2; Mon, 4 Jan 2016 21:29:05 -0500 (EST) Received: from SATLEXCHOV01.amd.com (10.181.40.71) by satlvexedge01.amd.com (10.177.96.28) with Microsoft SMTP Server (TLS) id 14.3.195.1; Mon, 4 Jan 2016 20:29:58 -0600 Received: from SCYBEXDAG04.amd.com (10.34.11.14) by SATLEXCHOV01.amd.com (10.181.40.71) with Microsoft SMTP Server (TLS) id 14.3.266.1; Mon, 4 Jan 2016 20:29:05 -0600 Received: from viwan-emmc.amd.com (10.237.75.243) by SCYBEXDAG04.amd.com (10.34.11.14) with Microsoft SMTP Server id 14.3.266.1; Tue, 5 Jan 2016 10:28:59 +0800 From: Wan Zongshun To: Joerg Roedel , CC: Suravee Suthikulpanit , Borislav Petkov , Ray Huang , , , Wan Zongshun Subject: [PATCH 4/6] iommu/amd: Introduces ivrs_acpihid kernel parameter Date: Tue, 5 Jan 2016 05:07:22 -0500 Message-ID: <1451988444-4694-5-git-send-email-vincent.wan@amd.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1451988444-4694-1-git-send-email-vincent.wan@amd.com> References: <1451988444-4694-1-git-send-email-vincent.wan@amd.com> MIME-Version: 1.0 X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:165.204.84.221; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(2980300002)(428002)(199003)(189002)(19580395003)(4326007)(50986999)(86362001)(87936001)(50466002)(1096002)(586003)(229853001)(1220700001)(50226001)(101416001)(33646002)(48376002)(105586002)(76176999)(92566002)(2950100001)(77096005)(47776003)(53416004)(97736004)(5003940100001)(5003600100002)(5001770100001)(189998001)(5008740100001)(19580405001)(36756003)(106466001); DIR:OUT; SFP:1101; SCL:1; SRVR:SN1PR12MB0863; H:atltwp01.amd.com; FPR:; SPF:None; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0863; 2:fWUkvPuGJeYz+/zrPU1rWTAP5AgjFKdNGSDhVA+E4qWvqgtwXOYQSssuw4S6tvAeg9pjrVIMsIVdc6MYEYh8PagkiadSs/yjwsGQQp03pRvVVZQO14rauDl4O3JvwWXaUyo7C2tddK1cTcuK/916ZA==; 3:Yy4op/+tmT9Hef+DBaR0hZthFbMEoQIrO+PmxAiap8ntDLywikvap3/ti+gLRkBIWYNouJejytyQBjCtmAA59pW/B4hdIzXoSYrGWdqHj9MRPDlRebeVb2f16czW4huG0Dgu/FiNG31sSRlu9ARSOnnbCVT95WlaqPDuUpYT7c9Hv0XevMujPAftowFe6z7LDwOFXVglPgW8JT346OP5KaLiSpMmc0zp1wK9gyC8B4Y=; 25:7uH2dRfy0/KLREuw98r24rP3SYGsqSRSLT+10k4NPhss03kVX+KP+o8HVwmKnObt5UmRxwDqAVPQH/cExpb9fjG2XTKMPwmgBPDNcHRcOP1d0ZmsSBD68LL0uP9fPIHb1RCqRN9zxw81hHh3xh2PFEajKpvidvf873GVCUaIbXIcuuRe/3sOAKUjiBjeY10/HDwoB/z7ij0Ty4pKoO5tCcNXi5lXuCAEWsvxb4GPRbFfafITtWMsNmOdmeB4oofTPOSzMr2GuMtjm+y8mpBOMg== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:SN1PR12MB0863; X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0863; 20:4orCMApZiQBoGKf5FSpr//SlqTfWGhoA9azRkfZvi0/i8aqeVXBlbqcS4ADBuRu54h6lef69BTZZEO6wqBwlNo0FSpPWJcrLxXmxJSdM0zMD/00nkKtzOH5mHq0XL0GiRZbR6TfgjqJ8/VZm/D9vUHAIEXxXaQyVjNw0Dc8kNB+bINeNKp/2RzioHKb/MxSklUD+mLFiCzWSghxXCFUTeRtAJTyUbp3AgnIgIfHwpGcs/8DlIgW2acCIE2hOu1nAg0Rwx/JwQTPO4y+c4jcgh105nQnV9tDiV5ORgdAgF8mLDDM3UE/ZjLitjOqmVEj02ps4/ImkRH52/6unvmiCYknfil7FOstrdrA93oh6XX87/21F98Go5N6BvFzc0q86hHW0rcy+Dl1jsZXavtehaJEZH4+EcFeX6zSGpl02Ua39ACaN0rVzSsPuxCO43hnkaetYtq+MZtG/pkij6XJ+odiRxDlyuneVsg5WWb2AtDQ6jIme/hteE4unfVQ9xVRm; 4:kMb6kx7MFCb9NgHaqWqqK//85wkihZpVnxlsOYKHpTq6j596b0DjAAMQyKzwj5VV3kUrfh23dkfLa8egvyMUhfD2s/F1acJC4hiIFbkFfzUnps1A3s4OjSVRaLyox3WqAyPNLE8CcvBbmVAmN3Fk222P22AcpcXkfa60SxAPKXhb5h70XZ2aPQocibYSveFhKzPDQnl21+kkrIe+ZVkt3MOd5R6dGaFpkhPfOYL0n2WLcdW7xpZazSfK7myE89OpxsaZ3sXupB4OJFeAYFxLbKB/fliMgEMQfl9KviDtYbTombnWrUcZ2k9IyEulYwSlSoLNEOxZazMZC2JbbIrXHGedL9QpoWf91OCpBkpb8hVIiNp1a5OoXukKV9wEvjg1C6XWC6Bn5c9UnrUvogtcX4kFO7LrTe1eyriu555h7kI= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(520078)(5005006)(8121501046)(3002001)(10201501046); SRVR:SN1PR12MB0863; BCL:0; PCL:0; RULEID:; SRVR:SN1PR12MB0863; X-Forefront-PRVS: 0812095267 X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; SN1PR12MB0863; 23:OOY1LLTVRIiIkoOXqFjPWcn26IyFKvrf+Y6X/EpBA?= =?us-ascii?Q?kqqbiHKl2CsLUpjz5yYj++ro508ShcHXIPQ5qWiyk74UvL9bI+bxaYIepgtV?= =?us-ascii?Q?jcV1SsgNdeBb0gEXsrskh8URN/DfUcHDLw+asdGl0/wD44MRhyCxeDm9NZ65?= =?us-ascii?Q?d3KfHv0uH5ymODXYWV5747lnrb4sDYnvC/eFX7mKnWICtkKtGWJFDDtTOCQ/?= =?us-ascii?Q?FkjOHrwUL9IYnWZfP0LqF790D8nrJgKdsYd0TwugixZZeHIeiXr7zth8axVK?= =?us-ascii?Q?L+694lAvB0++QvHYNTt9IkjWFCHDggW6dO3CDQGwxyjxpLvxYjiDhwX24I4r?= =?us-ascii?Q?gDSDuc4wzQrI1F89fTvcZ3jWQdFIDFThiem/qtkELWNh9RiifSfkU4cq3I/u?= =?us-ascii?Q?yB8J2jxKBxjjfdSIlT7ct9x9BPzd37ScfHPVY/bXzFnC7VrDDBHuC38jApLm?= =?us-ascii?Q?FSdLtXmdeSGHroyHAvXMsem/ezgyUiCD1o9NixHOBT0WHcKCrqbbdrpGp2KA?= =?us-ascii?Q?8cld/JR6IfUH2HaLrlm68cWmsDsYH0L4rvCbz9/Iy+z7SI6LHWzO6YfUoCIE?= =?us-ascii?Q?ZO7bS6nrKuicK7LCcxmGP1CRgk345Shvk7sjr9DGJ8QHBeWLJhnU0SN2nU0L?= =?us-ascii?Q?wgLtmrQom69RYj/tPMK3WhohsI2sV2rFHfkmIlJzKgMTp9/pv2ex7nVC4y78?= =?us-ascii?Q?zdx/DqGuTLb/TRr9mwJkZFXzv0NGM64U+U2yAI1/Lm9OxWxnbisQHaDMuQUF?= =?us-ascii?Q?/6WVlFubEq5/7A3J3Usu9v81YKqfbh6zRE9VkOlCAdBZYG7zbrQxYhTFxykT?= =?us-ascii?Q?5oq0HBr1WX0pwIfCz/WeCD7zRfuWirkBqVz74h9Fo9PSV+nGkJc2+AkvG1ME?= =?us-ascii?Q?fx4iFPTc89wSMHpv964YgLWyv+CPUtEx79gAhq+Dkp4WPC2zSa3lftzyiPR8?= =?us-ascii?Q?T3zQlTtFX3m0qJWDQ1K7noSnNaSmyW5ungv3isnlg=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0863; 5:kSny8hORdFXnrrjO/JlMuNf/CbnL1khaniK59QKQ/MUPOlMVhOqkZNfrOO7zbcgOwxv/NKhxkvUjTmDy1jvdgmAlwRqrEGSP7fYiYRpeBDUZWBWkE8D6WZBYXYjeTLa0Iaa2tttuzAOKIm9zDGU4Yg==; 24:bTpdd9cX8pzAy8VqCrlLtXrQ1sC9kMIeunMst+HeRmyFORNWT2V8WLYObDRvqthyt9+/3ERj63EBDS6nXgFHE9o20ZBREZ2ZY8/BFrLv7Fw=; 20:mECU8U5kuQtREMpmpNT9tLHtCWK+smDNfFNd1b2NXNecrWSvphrjS7sfvzsh0SUMOjg9Fmk1LyyX3C3ghNOfolJ1b3M2XIYseBv1iKgN9XOqaH82kv3OehAH60rRTpleJbBkV3Dza8G2NRtU0qLYs3OxWBmLRaCZC5aB6W98kSTV+kCh2EkA2qRV8W2NRoNhGFITyyJGzQ5ZXja9S58OBTUFlo2tKy70fzVO1/H+C+EGv08NoqDGlgY2lBnH567o SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jan 2016 02:29:07.8711 (UTC) X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d; Ip=[165.204.84.221]; Helo=[atltwp01.amd.com] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR12MB0863 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Suravee Suthikulpanit This patch introduces a new kernel parameter, ivrs_acpihid. This is used to override existing ACPI-HID IVHD device entry, or add an entry in case it is missing in the IVHD. Signed-off-by: Wan Zongshun Signed-off-by: Suravee Suthikulpanit --- Documentation/kernel-parameters.txt | 7 +++++++ drivers/iommu/amd_iommu_init.c | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/ diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index 742f69d..5c364c6 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt @@ -1680,6 +1680,13 @@ bytes respectively. Such letter suffixes can also be entirely omitted. PCI device 00:14.0 write the parameter as: ivrs_hpet[0]=00:14.0 + ivrs_acpihid [HW,X86_64] + Provide an override to the ACPI-HID:UID<->DEVICE-ID + mapping provided in the IVRS ACPI table. For + example, to map UART-HID:UID AMD0020:0 to + PCI device 00:14.5 write the parameter as: + ivrs_acpihid[00:14.5]=AMD0020:0 + js= [HW,JOY] Analog joystick See Documentation/input/joystick.txt. diff --git a/drivers/iommu/amd_iommu_init.c b/drivers/iommu/amd_iommu_init.c index 0a8e033..ad05614 100644 --- a/drivers/iommu/amd_iommu_init.c +++ b/drivers/iommu/amd_iommu_init.c @@ -2430,10 +2430,43 @@ static int __init parse_ivrs_hpet(char *str) return 1; } +static int __init parse_ivrs_acpihid(char *str) +{ + u32 bus, dev, fn; + char *hid, *uid, *p; + char acpiid[ACPIHID_UID_LEN + ACPIHID_HID_LEN] = {0}; + int ret, i; + + ret = sscanf(str, "[%x:%x.%x]=%s", &bus, &dev, &fn, acpiid); + if (ret != 4) { + pr_err("AMD-Vi: Invalid command line: ivrs_acpihid(%s)\n", str); + return 1; + } + + p = acpiid; + hid = strsep(&p, ":"); + uid = p; + + if (!hid || !(*hid) || !uid) { + pr_err("AMD-Vi: Invalid command line: hid or uid\n"); + return 1; + } + + i = early_acpihid_map_size++; + memcpy(early_acpihid_map[i].hid, hid, strlen(hid)); + memcpy(early_acpihid_map[i].uid, uid, strlen(uid)); + early_acpihid_map[i].devid = + ((bus & 0xff) << 8) | ((dev & 0x1f) << 3) | (fn & 0x7); + early_acpihid_map[i].cmd_line = true; + + return 1; +} + __setup("amd_iommu_dump", parse_amd_iommu_dump); __setup("amd_iommu=", parse_amd_iommu_options); __setup("ivrs_ioapic", parse_ivrs_ioapic); __setup("ivrs_hpet", parse_ivrs_hpet); +__setup("ivrs_acpihid", parse_ivrs_acpihid); IOMMU_INIT_FINISH(amd_iommu_detect, gart_iommu_hole_init,