Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932131AbcDAF3A (ORCPT ); Fri, 1 Apr 2016 01:29:00 -0400 Received: from mail-bn1bn0100.outbound.protection.outlook.com ([157.56.110.100]:1376 "EHLO na01-bn1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753115AbcDAF24 (ORCPT ); Fri, 1 Apr 2016 01:28:56 -0400 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; X-WSS-ID: 0O4XWK0-07-GXR-02 X-M-MSG: From: Wan Zongshun To: Joerg Roedel , CC: Suravee Suthikulpanit , Borislav Petkov , Ray Huang , , , , Wan Zongshun Subject: [PATCH V3 5/9] iommu/amd: Introduces ivrs_acpihid kernel parameter Date: Fri, 1 Apr 2016 09:06:01 -0400 Message-ID: <1459515965-2865-6-git-send-email-vincent.wan@amd.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1459515965-2865-1-git-send-email-vincent.wan@amd.com> References: <1459515965-2865-1-git-send-email-vincent.wan@amd.com> MIME-Version: 1.0 Content-Type: text/plain X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:165.204.84.221;IPV:NLI;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(979002)(6009001)(2980300002)(428002)(189002)(199003)(5003600100002)(1220700001)(1096002)(229853001)(53416004)(77096005)(5003940100001)(2906002)(48376002)(92566002)(4326007)(47776003)(586003)(189998001)(50466002)(81166005)(105586002)(2950100001)(5008740100001)(19580395003)(106466001)(11100500001)(50226001)(36756003)(101416001)(19580405001)(33646002)(87936001)(50986999)(76176999)(5001770100001)(86362001)(969003)(989001)(999001)(1009001)(1019001);DIR:OUT;SFP:1101;SCL:1;SRVR:CY1PR1201MB1083;H:atltwp01.amd.com;FPR:;SPF:None;MLV:ovrnspm;MX:1;A:1;PTR:InfoDomainNonexistent;LANG:en; X-MS-Office365-Filtering-Correlation-Id: c6e4eca0-8785-49ae-2e9b-08d359ee81bb X-Microsoft-Exchange-Diagnostics: 1;CY1PR1201MB1083;2:3PtiahruFW7RX6cGRXFzBIZkgHT7bsTf1sWuxcX1bCT+MzZm1S3gP+XsSPOQqFYW/uclLsKeSaGPe1DqHGG2G6gP7zkUEXSLZRfQAIzsYp9XTm4FL469gjOt69wGm/+1/pRKUNrlbdNqYPVbyTeKX0MK+0OaYu7uqQfNstXAzohdcfm3/1XigKrsHmzN04K7;3:x9LPkaLQUYuTmi26gtHfaFtE4IjXkLqeYdu7LOcLdna9t8iBVxGR1WfwH9yiRqmHKTKWH+CTJo2xMEksJ8Luc4457W4EY2YXbQcY5VbLIcRO28krsaJNZ8Eme5gggssc0LFwkzQO/kAgDkDchwYe8csmZ9eMZm9f6fTJ89qCu8gQUyEao4HltFhgwowWbwRFm7g93wXq5w0XdD42ygGeu1wWGfgB0nGShSkqPCsZNtE= X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:CY1PR1201MB1083; X-Microsoft-Exchange-Diagnostics: 1;CY1PR1201MB1083;25:xyHSZTepzTTGHIUw/xarWaA/FkyECMg9ptKOTv2RnOWh7cD/fEWOZi9SyUsBCpsnD7AXT5Npq96IlWjExLBvz2AJs3friG3cGsrBJ+0XoHM154209L7+3lFU2Yu5cES8xXO3jnShUQKHpHa+3kGKeBQdNhAXN0/5DxeQMMTzmpsuzecEHLLtvT/OVtZwQmLVPJ15/8tFp8h1rBdpXykyAcRElfKlVsRo6giQyGCD8x7uDlBm59DbS4qxGKu6QSrz1lTgoaZK6bGqi0mXiGRaKk/gxKQra2sAvs++BFjOllIz1sQVN5nwn9JHJgXBJs8Z5AAl3pIvpEO9IlSpBJkbmea9wghTfU3W0xQ6/yuqFC6Ui41eNbXWu7MghtuRNreSn/fP1o7e62efvQZYBJXXWvPTyxr4IlryJLg+6EHJVC6ygpd67hT+v14pPG1RyTMSYpDoSY1HoatSsPJLDT8PNnD9/0zi8fZWoB0QtCRiGKOwHapJQ+gT1Ncw/8oIzZevh8kglESa2NOt7Pxf/rxP4hCcEFBai2X/bCXC+bFQBeJhHDkEKHKFBo6q1KO/hcOm5JyFrGhEeENPBScRX9ulH1fWPGitMdlbcwZ1oV2Uif51OQpSH0kbF38obvShSIvLhO2iFUAPeqBFhihCJhdooQ== X-Microsoft-Exchange-Diagnostics: 1;CY1PR1201MB1083;20:AMNa6vPpPVidHRU59k6v0KybMsfCFdw+op/OzyvprJj4roW3ErrqPlBO9er8uASSqzlodlPdCnqIlsMs7bVm28JJ4UyKnWNl93sqizlZeShG6STQvOYySfcYDE0aOqFIsITGA8f+R6Whdsl8D3ipP1Ovwm+FjW06v0ZVMdplgCScp66KeSoc1rG84c1bqg3NGx0GBytZJh2zlSUIAVE7ezT8AJm9i1sTcSpCHKjL9EbnozabAiKKb8lBfHtNQCsO/78f9sSpEa9aXFhHI79nb3NHP+jdhg9FaAb+0FifJCmaIVBDCsbpYQmr/nk5BQ/Du1SoDLB5B8h0KocoXMo4GyVF47pBY2P9uDzQV05JoMzDkH+gmIYDojde1J4Htl3p1zCGNj0eQ8HYWCLzxMtH1c8MReuRhP6iBQNkLlYvSukxN2fmZZH8qgY124b4aMIciXNfe4QblFPgMl4dw7UaFFNJpQ3/9gLB3UweGONmnJiHIF+Np+5GrF1wg0uZFkyp X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(2401047)(13023025)(8121501046)(13015025)(5005006)(13017025)(13024025)(13018025)(10201501046)(3002001);SRVR:CY1PR1201MB1083;BCL:0;PCL:0;RULEID:;SRVR:CY1PR1201MB1083; X-Microsoft-Exchange-Diagnostics: 1;CY1PR1201MB1083;4:/scZ4Ms838d3oQdTBQPm04Qs+ol4ENahw4At8F82/QG/nJz6ieXXhPOmJQOhXzFaGsGeEQq70znB6eG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GNtCH1L6PVtUgXbb3ZCe+CnsuQ9EEVHX4gyiZVeeWBc9N1pH6J/C08lt+bVVmS5sZJmtjf0/DTHEHiT9GNaEBCPjnQCTlPfZTTMPQqLTtf3/VXivMxj3AakDWkkITcfpenFZv/M5liFzBgyh7butTG8yrdjaHrw0fXLEpSbCURUZTC2KmSvo4SIbs67lMW0bxng2gVLO2NWEi6l5Yo3E9bIU43W0L4WyTGq3maRqeiu8YU SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Apr 2016 05:28:49.6738 (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: CY1PR1201MB1083 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2591 Lines: 81 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(+) diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index ecc74fa..8c881a5 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt @@ -1767,6 +1767,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 e7ebfa2..9e00341 100644 --- a/drivers/iommu/amd_iommu_init.c +++ b/drivers/iommu/amd_iommu_init.c @@ -2477,10 +2477,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, -- 1.9.1