From patchwork Tue Jan 26 23:14:33 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vincent Wan X-Patchwork-Id: 60465 Delivered-To: patch@linaro.org Received: by 10.112.130.2 with SMTP id oa2csp2034261lbb; Tue, 26 Jan 2016 07:38:44 -0800 (PST) X-Received: by 10.98.13.150 with SMTP id 22mr27667401pfn.143.1453822724664; Tue, 26 Jan 2016 07:38:44 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n13si2668367pfa.122.2016.01.26.07.38.44; Tue, 26 Jan 2016 07:38:44 -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 S934671AbcAZPim (ORCPT + 30 others); Tue, 26 Jan 2016 10:38:42 -0500 Received: from mail-bn1bon0063.outbound.protection.outlook.com ([157.56.111.63]:39584 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S966545AbcAZPg7 (ORCPT ); Tue, 26 Jan 2016 10:36:59 -0500 Received: from BY2PR12CA0029.namprd12.prod.outlook.com (10.160.121.39) by BN4PR12MB0851.namprd12.prod.outlook.com (10.164.59.13) with Microsoft SMTP Server (TLS) id 15.1.390.13; Tue, 26 Jan 2016 15:36:56 +0000 Received: from CO1NAM03FT014.eop-NAM03.prod.protection.outlook.com (2a01:111:f400:7e48::203) by BY2PR12CA0029.outlook.office365.com (2a01:111:e400:2c84::39) with Microsoft SMTP Server (TLS) id 15.1.390.13 via Frontend Transport; Tue, 26 Jan 2016 15:36:56 +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 CO1NAM03FT014.mail.protection.outlook.com (10.152.80.101) with Microsoft SMTP Server id 15.1.390.12 via Frontend Transport; Tue, 26 Jan 2016 15:36:54 +0000 X-WSS-ID: 0O1KGPG-07-8TA-02 X-M-MSG: Received: from satlvexedge02.amd.com (satlvexedge02.amd.com [10.177.96.29]) (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 2589012C12D4; Tue, 26 Jan 2016 10:36:51 -0500 (EST) Received: from SATLEXDAG03.amd.com (10.181.40.7) by SATLVEXEDGE02.amd.com (10.177.96.29) with Microsoft SMTP Server (TLS) id 14.3.195.1; Tue, 26 Jan 2016 09:37:02 -0600 Received: from SCYBEXDAG03.amd.com (10.34.11.13) by satlexdag03.amd.com (10.181.40.7) with Microsoft SMTP Server (TLS) id 14.3.266.1; Tue, 26 Jan 2016 10:36:46 -0500 Received: from viwan-emmc.amd.com (10.237.75.161) by SCYBEXDAG03.amd.com (10.34.11.13) with Microsoft SMTP Server id 14.3.266.1; Tue, 26 Jan 2016 23:36:43 +0800 From: Wan Zongshun To: Joerg Roedel , CC: Suravee Suthikulpanit , Borislav Petkov , Ray Huang , , , , , "Wan Zongshun" Subject: [PATCH V2 4/8] iommu/amd: Introduces ivrs_acpihid kernel parameter Date: Tue, 26 Jan 2016 18:14:33 -0500 Message-ID: <1453850077-2539-5-git-send-email-vincent.wan@amd.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1453850077-2539-1-git-send-email-vincent.wan@amd.com> References: <1453850077-2539-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)(189002)(199003)(4326007)(19580405001)(53416004)(2906002)(87936001)(50466002)(5001770100001)(33646002)(86362001)(50226001)(5003940100001)(36756003)(92566002)(97736004)(1220700001)(1096002)(77096005)(11100500001)(229853001)(48376002)(2950100001)(106466001)(5008740100001)(189998001)(19580395003)(5003600100002)(50986999)(105586002)(586003)(101416001)(76176999)(47776003); DIR:OUT; SFP:1101; SCL:1; SRVR:BN4PR12MB0851; H:atltwp01.amd.com; FPR:; SPF:None; PTR:InfoDomainNonexistent; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; BN4PR12MB0851; 2:WG81kix173aQE1ireL0zBOpL76/qemk4FWhstQNwOreNhvH+rRziv2zTwAYNC4teT+bQ70rO3QMdx86aC9FnQ00BbvwdrJx8KddNFsb84vgzaNoRqIgOBZ3lTiHQf9l047dXJOrYzYFvZyKN43s3GQ==; 3:TaUFNsInzacRVPSPXiSMcMAIjIic92yGr4ocvRqxVRFGv88nGfNjqsjVb+1nJVqZ3TlJt7mTfmrZ7g5CjXUQSzhFzQRmyS2mHxPehMlHDm3Kbvq9BKyJpC5EUuVrEyd74O6X06Zk91dXAoMyk/9XmmBe6UJocz9+c/Wr33fLhZNcae4I0S8xcaFt2+KhUKQk3nqRbyValj1C8p/Qnenpm7pWAivw9HO9UsFlFa0zfQo=; 25:PSurpuR2F5QuGbsAUHeR6XEHJYH+4XMOV00O4VOBFwDKchVyDf7HQnQmw6x+8JCcGR1z6MPgR+XpwIT887r3dca55IQaCS2Dh4VMudg9zFemu++gSHk1k8mUoUkokwi9Y0ibRTKQSaureFsAp0ESOCcoD3jIRWYNY5hrnxfmF8BipvQfFe2Y2qvTiEQHecT7GCrMRD6IWSJMM1cHyR8weGDQ6WfBmbAfd4hhDWepuTJ6IWcPwA/u2OMgMUfk14kp X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BN4PR12MB0851; X-MS-Office365-Filtering-Correlation-Id: a55429a4-5dce-4f5b-88a7-08d3266684ff X-Microsoft-Exchange-Diagnostics: 1; BN4PR12MB0851; 20:nYQCTLq5im74tOZK1EKbYNDl22aryz3PVrupXyAkErk86c6ibqJWBguoX5RbGWtEjO17y97yq4362QrCE4bCxngoEqQIc5sgnDbTMl//bJiGWR4OO2vo57hREPlDeUF91dPHQAVQRaqnAVWscHxNW12Hig0ZpxnE0TuISzZqOgEBWYmmpS5AwxZIygGNzxFkU20xEf+lzuAaqqy7YljBHso+jOyFOso9cnpUdXtmgf4Njah40fNWPiEiQcMKWmPdXJ4n4sDa9O8cAqAQYb6gvdMaGWsi9B7zszFKcszzZtRoCHgxFQoJeo/rc0sxUZnr8bPz3esdS6YOJEnjQYxc4Jlm8NnEONTJD/Va7byuheRTboUPBlVRB/CIlmvPpwQeyEnfy1oHNrLhSIlezbYV1v78gbAOujfWNDl+nUbhgaWPZTvLyEcqVpAGPTxQA9gVPdiLCZnXyLJxUdlZZGVCqq2nTi7kgikbm3pzOmtfaHTX+vhs2UbGR2gmbAEOywLz X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(123027)(601004)(2401047)(8121501046)(520078)(13018025)(13023025)(13015025)(13017025)(5005006)(13024025)(10201501046)(3002001); SRVR:BN4PR12MB0851; BCL:0; PCL:0; RULEID:; SRVR:BN4PR12MB0851; X-Microsoft-Exchange-Diagnostics: 1; BN4PR12MB0851; 4:nFTX5IDZyDFEcosYD739f07TrBbXVa7BSOdbzRTHglKwUngOnMbNLGtZZZOv2xdVVlLIjl47tFHFpdxDzhaQVxoV8xxsJiSFTM3TJ21grc9vXXdC204dfUl/MYfgJ1CYwkLF0AEhEmxfq/JlRHaOXH4n0/x9YdD7flaiGbH/7TCbNqI6PDJj34M+9qLDZNRb/BI9/BjBVAfgfbLJTX/D8IU6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f1ojdtr+Xv+w69i1QCLGpYuhuMriNFVfnBTakihVuiH8ia17a SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Jan 2016 15:36:54.0764 (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: BN4PR12MB0851 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 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,