From patchwork Thu Mar 2 15:13:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Brijesh Singh X-Patchwork-Id: 9600457 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1923F60414 for ; Thu, 2 Mar 2017 15:31:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 093BA28592 for ; Thu, 2 Mar 2017 15:31:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EEF92285A9; Thu, 2 Mar 2017 15:31:51 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 607F128592 for ; Thu, 2 Mar 2017 15:31:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753203AbdCBP35 (ORCPT ); Thu, 2 Mar 2017 10:29:57 -0500 Received: from mail-by2nam01on0068.outbound.protection.outlook.com ([104.47.34.68]:47072 "EHLO NAM01-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752970AbdCBP3v (ORCPT ); Thu, 2 Mar 2017 10:29:51 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=HG/tNlyPZhWjlUWk8uqiN/JwDug4JP+wnTRYPA11xCY=; b=iod1AksiVfF5cDLeYvAQktJES6IKWw4UPtIm1Pi+4iJigaQ+e1JGNK3wyOeIQU4hlnQhmqCJ8OkcdwjVNeviUygTwDSFIWzjfjP0bmfrTR/hUE4/od6atdNSgQ7fmPlWFTLoqhyI27vL5L5btCbLgMmEgBzcfay32Ou8zC9esAA= Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none; vger.kernel.org; dmarc=none action=none header.from=amd.com; Received: from [127.0.1.1] (165.204.77.1) by BN6PR12MB1603.namprd12.prod.outlook.com (10.172.21.151) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.947.12; Thu, 2 Mar 2017 15:13:12 +0000 Subject: [RFC PATCH v2 06/32] x86/pci: Use memremap when walking setup data From: Brijesh Singh To: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Date: Thu, 2 Mar 2017 10:13:10 -0500 Message-ID: <148846759008.2349.8274808454274279039.stgit@brijesh-build-machine> In-Reply-To: <148846752022.2349.13667498174822419498.stgit@brijesh-build-machine> References: <148846752022.2349.13667498174822419498.stgit@brijesh-build-machine> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: DM5PR18CA0035.namprd18.prod.outlook.com (10.173.208.21) To BN6PR12MB1603.namprd12.prod.outlook.com (10.172.21.151) X-MS-Office365-Filtering-Correlation-Id: fb82a3d8-4854-49d7-ed89-08d4617ea6d2 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(48565401081); SRVR:BN6PR12MB1603; X-Microsoft-Exchange-Diagnostics: 1; BN6PR12MB1603; 3:5pSHsTrXBPZSNscme/z8L0cuJmmO31Nq/fekD05ud0P1QtWbeaQpBfwQ+Ukx6Ah7seEtUSmgeSsQt3KTe5974TZfiJIMLX7g7odxXyuQOjhRJusBbzH4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yj/B5/ZT68BKTvP1grwHBt9Pzg7pAmgTV0DelqwEfi1Vou4yYfpSUaxyUPZ+1CKLb1c3XCt7DE0VJx1tHXALedvDOb7lfKxwYg11Vms5vE3Zh/yU26nlHMZyyTmT7RR40uBYMRpKuMKAEaeUuhpkL9zGsjiPQHykPXE09SwzmT9c33WF23OfQouzNZCyQLOkYgdV2SiF0ufC0dT6OY0Avfh+Fj5T5adxG1fcUiMY66bHAe/bh0sq+l52nyaT6Y57Y42uEZrFXlURy5ZG8lZF//HEjSOKnE7Klwt95ExJdA8RShxS2VBqos7P3PlstPWLYsnXFyg4pjtCCPL1n02fGxUm2tK6iax2EAyMdzv5Ckzx+JYftAa2FUHLzzVGoMeIVDh0tDA9eCyPwq7yPHLegQ X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(8121501046)(5005006)(3002001)(10201501046)(6055026)(6041248)(20161123562025)(20161123564025)(20161123560025)(20161123555025)(20161123558025)(6072148); SRVR:BN6PR12MB1603; BCL:0; PCL:0; RULEID:; SRVR:BN6PR12MB1603; X-Microsoft-Exchange-Diagnostics: 1; BN6PR12MB1603; 4:w+WNDg2KExQ0XkH2131cP9cRqPPxZL8fC2WlDmwadb8/PfPz029KBjBS5UWHcGvBGVa9UxO9vqudMNo58nphoz8Qn2Nnacd7RFmCB79jE1pIj2yUf9BHPlcGJu4QJtA517P/y0eo74mJoDyq8R0ZqGDUtM2F+EaOV2VcSohcy3EVYNsHleEOgAWrcLwWsLEeNuz7twKf7VvBIN5741PdjdVSVHIV+kvA2qTbjwF4WU+j7ZwQkc2iXe/kDAI29kfapoon4JnzIOTK//NVSBQxZESnliec256mpnVqMxP+khPUQVmcmikOxmv/Z3pa/QPCBsysIk65Ufz/NShWVpFmYawCT5l7mc7iWo/PlZ9MaP2YnPkLJhs56R+gbITrMe6z+5nf43nIo0Lh8CeP0LPdcTUVCt20m8FFyAUDPFEhSfdXB1TwJIRJQJ4kFzg4t7R0eInmPtOdhHYxep0iPrDbZM79ogxMaUCXLNzPgcGa6P7AwOOu8y1Tnh8HEAgF3TDTkJ5TWbkSe60G3F9xfcBlhQJy/A+tUlg4nI7HOZNPOpjiBXVpBIqyU0AqWE7vqBz8fXlKAxwtVDGTGtUBk4W2j1p/dKP1cusT4l6hBbX+CZoDftjEovm0Ft6+WJQBPOyIVPeo2SUWevjsw0fpa737ZvCdYJ9NViDW0OOYl90eIFA= X-Forefront-PRVS: 023495660C X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(6049001)(7916002)(39860400002)(39840400002)(39850400002)(39450400003)(39410400002)(9686003)(23676002)(86362001)(5660300001)(305945005)(103116003)(7366002)(7416002)(42186005)(7406005)(25786008)(77096006)(1191002)(6486002)(90366009)(81166006)(3846002)(230700001)(6116002)(8676002)(33646002)(2201001)(38730400002)(189998001)(7736002)(2950100002)(92566002)(66066001)(50466002)(54356999)(50986999)(33716001)(53936002)(2906002)(47776003)(76176999)(83506001)(921003)(2101003)(83996005)(1121003)(217873001)(84006005); DIR:OUT; SFP:1101; SCL:1; SRVR:BN6PR12MB1603; H:[127.0.1.1]; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtCTjZQUjEyTUIxNjAzOzIzOnQzMlAxbFNyeXJUTjhPeW5UNEFVM0dJY2h0?= =?utf-8?B?R0l3akQzUUtFUG1kdDBBbW1HM3hXcjZFTzhCYS9wQ0F4UUQvTjFiZjBPYXFG?= =?utf-8?B?SmlScmZsYVM0STZXbElJcVlqcVZkUzROc2ZzZHlsbWtoQS95cFV1TDFKM1Fa?= =?utf-8?B?OFJmYnBON0FybDdnM29QK09zYzRzQU1aN0xkOEQ4MHVrN2k5aXUwVWpDcmQ2?= =?utf-8?B?WlYvUVlSRWswTSs4WGd4eFdiY1FrQUhkMkMrQStVZ0Y3Q2FGcUN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3bToihTPjNCgSLEFpIm5OlQ7Wt8erksyLzJjGjALBugF6FOWoKhQ=; 5:amX+EjMYwnvlulbrY2h6Dz6ECX1qwCVkjp7g1VVuSkhoGJuID4hF/p8SQ+gso//yNL5mjJBMTkoiuEL70osZXvpOi6fNjXHKlqxy9p8DUpHXbX2zP3ALrDn3eUpY8g2LqtLakEARinNLdZ+HF9HbrQ==; 24:nTpXSBKJgcnnqk6D2aTt8THssfp/gYRkchvMeQWfb7ybbcgk2fJkos/Z/RdBjTuVCAE0zDEK+/G4HK5wjOl1w0pKUe6yomjo0F+R31Btvlg= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BN6PR12MB1603; 7:glnuslJr466DgUeP6r/CaqfmeYiTy2hgb+YT2l6IEnoVKvURyw29P2x4Tcd0QtD23dApub/H3Ub9xKoYO1heobuUTBXoh4DYzPKa6q8TR9OO/I4ZpkjWoi9BDPEj9n/UjsPTPNlhJUotiwvyM7dW4zMdbrINAB0gkSAl4g2ri4bZalihAtRTun1x0snvhc2yx4m4zf5db9LTZkOZ7hQ/fKYi2QYXkUe3lJrzLU2/NVSsNiOV6UGLot4p9Oe7rb5He/wm4ClZPAaISdiVp2mTLMAxXinw57aoIv5SOO2qURlBJchuivedvxGAJlQ5Ke26K+HnMLSP+KLySxBJrka7Aw==; 20:qUZBDDG/E7N9X1FS1HmnQYkILJXAMdQ4MDKuGsOBhm+6dIq2inYrmGoyrhEyB94lWeyR33ieDFpj3hpsnXU+iQVRDkAX1srgyayRR4D5hyAO+9bORUpqTB/9kcu71L5jQj+zWl6xbjHIMFt4DJkSe5y9VFpzAQvWpXDS6ff07V3G48tcZhPW1JABeqkv1ACa1xdg0HApKkNjxvmupi0gcKjLoYIfaSoDqIdjOPvxr2rhAsLll88GkUNhzL2Ed35t X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 02 Mar 2017 15:13:12.6665 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR12MB1603 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Tom Lendacky The use of ioremap will force the setup data to be mapped decrypted even though setup data is encrypted. Switch to using memremap which will be able to perform the proper mapping. Signed-off-by: Tom Lendacky Acked-by: Bjorn Helgaas --- arch/x86/pci/common.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/x86/pci/common.c b/arch/x86/pci/common.c index a4fdfa7..0b06670 100644 --- a/arch/x86/pci/common.c +++ b/arch/x86/pci/common.c @@ -691,7 +691,7 @@ int pcibios_add_device(struct pci_dev *dev) pa_data = boot_params.hdr.setup_data; while (pa_data) { - data = ioremap(pa_data, sizeof(*rom)); + data = memremap(pa_data, sizeof(*rom), MEMREMAP_WB); if (!data) return -ENOMEM; @@ -710,7 +710,7 @@ int pcibios_add_device(struct pci_dev *dev) } } pa_data = data->next; - iounmap(data); + memunmap(data); } set_dma_domain_ops(dev); set_dev_domain_options(dev);