From patchwork Tue Jul 16 12:01:15 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru Stefan ISAILA X-Patchwork-Id: 11046005 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 53E16912 for ; Tue, 16 Jul 2019 12:02:59 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 42EFF2843B for ; Tue, 16 Jul 2019 12:02:59 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 370CE28450; Tue, 16 Jul 2019 12:02:59 +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=-5.0 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id B0EC32843B for ; Tue, 16 Jul 2019 12:02:58 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hnM93-0007bx-L2; Tue, 16 Jul 2019 12:01:21 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hnM91-0007bq-Kl for xen-devel@lists.xenproject.org; Tue, 16 Jul 2019 12:01:19 +0000 X-Inumbo-ID: 6a8ea90e-a7c1-11e9-8d66-a3d60b171205 Received: from EUR03-AM5-obe.outbound.protection.outlook.com (unknown [40.107.3.90]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 6a8ea90e-a7c1-11e9-8d66-a3d60b171205; Tue, 16 Jul 2019 12:01:17 +0000 (UTC) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JgodckOPJ5In/3ewN/YvOYy+huDpemvLhNy+FaO4b/ac5+GBDbpg5IoeGuJeaFbF84ILSFX/Wxmw/nhDsg9x6WEdEAXTdhUuHZU/509FTuKYO3RDVSdirYcnN44RuVy47WY16c6SYjEKKj2xSdsL2rOmrfOCIaGk3dCSJggiolGsBDtVI4ewR4LQYAirE9IC52bVsglhowTs7bGQDnn1+MX909sBWQVoA8PuQBhceGuGtRPGuCykdYiP6/ra9UbZoQfABPMKqAFd2w/bU34GB2eDOqi/B3oYQ9Mi89L1JEhk4NwZlAmIPfw+hC5EthwS/7jpc84WHS1qwi/B5QRIrA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=mT4pUL7Op8cau8E5xnSogVuSDk1SIsK4jUVnbro1BbE=; b=oECg7uBJ5b87OoE+iqoEseiCne+nXFCs+Nrj3C2qZBenz97LK7WjdesypyI2sH3RCJ+tcqkodrBH9ajVbKdt2P57pL5ZGp+EmayHwJGsJ9hkXan+s+zQSO4d4kMQrcblROJJaT/TV9D927G8rNWlwIw6kYS/SOWC31ksPKAGSbBK5ybclBLTIfeTEBLg6YrT4ncJuCPXhqIENiaitIraRXL8iz+NCSPzIjNGED24Zc1xlC2IYMldDz/jocKF1htWCi3CvDdxQZD3nQTT/UoaAxWcsW9lBapb6SbngQDUruc60CqmLLyOKAKlZ4SC46fq4aiCVtICAAkKnWMuRvFmqA== ARC-Authentication-Results: i=1; mx.microsoft.com 1;spf=pass smtp.mailfrom=bitdefender.com;dmarc=pass action=none header.from=bitdefender.com;dkim=pass header.d=bitdefender.com;arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bitdefender.onmicrosoft.com; s=selector1-bitdefender-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=mT4pUL7Op8cau8E5xnSogVuSDk1SIsK4jUVnbro1BbE=; b=HVknhnVXyW3QR+VuhjJLvv9tJxY5z1SWIsoQQKHLWUMilcZK0b3bXfuNV+FU+bW28JbFPLI7sTQxlmTTBabevPHpKSR+Ie2NGKS9rR+l93RqiL2MeUO0GG//f1datCteGvBl9AIRT+23nzJTMx6AhiVG9wSjqXP9K/hNtcnIicI= Received: from VI1PR0202MB2928.eurprd02.prod.outlook.com (10.171.106.11) by VI1PR0202MB3552.eurprd02.prod.outlook.com (52.134.19.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2073.14; Tue, 16 Jul 2019 12:01:15 +0000 Received: from VI1PR0202MB2928.eurprd02.prod.outlook.com ([fe80::299d:c795:8b09:fc03]) by VI1PR0202MB2928.eurprd02.prod.outlook.com ([fe80::299d:c795:8b09:fc03%8]) with mapi id 15.20.2073.012; Tue, 16 Jul 2019 12:01:15 +0000 From: Alexandru Stefan ISAILA To: "xen-devel@lists.xenproject.org" Thread-Topic: [PATCH v3 2/2] passthrough/amd: Clean iommu_hap_pt_share enabled code Thread-Index: AQHVO84r6T9zTbFQDUyTB09YmF8j8w== Date: Tue, 16 Jul 2019 12:01:15 +0000 Message-ID: <20190716120056.1723-2-aisaila@bitdefender.com> References: <20190716120056.1723-1-aisaila@bitdefender.com> In-Reply-To: <20190716120056.1723-1-aisaila@bitdefender.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: PR0P264CA0163.FRAP264.PROD.OUTLOOK.COM (2603:10a6:100:1b::31) To VI1PR0202MB2928.eurprd02.prod.outlook.com (2603:10a6:800:e3::11) authentication-results: spf=none (sender IP is ) smtp.mailfrom=aisaila@bitdefender.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.17.1 x-originating-ip: [91.199.104.6] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: cec6edf4-4de1-42d5-ea64-08d709e54df0 x-microsoft-antispam: BCL:0; PCL:0; RULEID:(2390118)(7020095)(4652040)(8989299)(5600148)(711020)(4605104)(1401327)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7193020); SRVR:VI1PR0202MB3552; x-ms-traffictypediagnostic: VI1PR0202MB3552:|VI1PR0202MB3552: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:158; x-forefront-prvs: 0100732B76 x-forefront-antispam-report: SFV:NSPM; SFS:(10019020)(396003)(346002)(136003)(39860400002)(376002)(366004)(199004)(189003)(7736002)(66946007)(66446008)(64756008)(66556008)(66476007)(14454004)(76176011)(486006)(50226002)(6506007)(5660300002)(8676002)(102836004)(386003)(1076003)(2501003)(81166006)(5640700003)(68736007)(8936002)(52116002)(81156014)(66066001)(6436002)(478600001)(6512007)(99286004)(446003)(316002)(6116002)(3846002)(476003)(25786009)(54906003)(2616005)(86362001)(11346002)(6486002)(26005)(6916009)(2351001)(2906002)(36756003)(4326008)(186003)(107886003)(14444005)(53936002)(305945005)(256004)(71190400001)(71200400001); DIR:OUT; SFP:1102; SCL:1; SRVR:VI1PR0202MB3552; H:VI1PR0202MB2928.eurprd02.prod.outlook.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; received-spf: None (protection.outlook.com: bitdefender.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: YQFIvYz2clx7r3N2s6yZVrn3claCtAGdvZvCxApSg31JuvzRE8dMUkebBAVA6gusiTukCfhOzGZTuH4TroKvPN0xhcpKKESfayzNf+hKW6YxMjG2OY9wYhx4px4agux8GnjFKMjLk2Kw6LC12eTdmzE4sPh9TthqT/55UQWGDPhReOX387wanLrSnI1EgTr81Cd3qTlQV0mkkHtV32AMd9H00TcHJZp0cb1aB3q99Em2B9FrkY2mYhv3kAWhHs0pgcaVRyh1AMc4K1G0uFcIG7FAq2c3ZTvZaeXnrYRsH8SEVQ9fIr+3Bdgt4UW0+tsr8h7QjA00iCGKVPQ3ILZ5xjYlJ5DWfLRIkaKgQB0mJB/GoXh88+ttreIRy2BxQOIlBKe/xGw2U5Wi3VVLGK1DfpO7X/u8o0Bz4C+funJNb8k= MIME-Version: 1.0 X-OriginatorOrg: bitdefender.com X-MS-Exchange-CrossTenant-Network-Message-Id: cec6edf4-4de1-42d5-ea64-08d709e54df0 X-MS-Exchange-CrossTenant-originalarrivaltime: 16 Jul 2019 12:01:15.8001 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 487baf29-f1da-469a-9221-243f830c36f3 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: aisaila@bbu.bitdefender.biz X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0202MB3552 Subject: [Xen-devel] [PATCH v3 2/2] passthrough/amd: Clean iommu_hap_pt_share enabled code X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: "jbeulich@suse.com" , "wl@xen.org" , "george.dunlap@eu.citrix.com" , "andrew.cooper3@citrix.com" , "suravee.suthikulpanit@amd.com" , Alexandru Stefan ISAILA , "brian.woods@amd.com" , "roger.pau@citrix.com" Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP At this moment IOMMU pt sharing is disabled by commit [1]. This patch cleans the unreachable code garded by iommu_hap_pt_share. [1] c2ba3db31ef2d9f1e40e7b6c16cf3be3d671d555 Signed-off-by: Alexandru Isaila Reviewed-by: Jan Beulich Acked-by: Brian Woods --- xen/drivers/passthrough/amd/iommu_map.c | 28 ------------------- xen/drivers/passthrough/amd/pci_amd_iommu.c | 4 --- xen/include/asm-x86/hvm/svm/amd-iommu-proto.h | 3 -- 3 files changed, 35 deletions(-) diff --git a/xen/drivers/passthrough/amd/iommu_map.c b/xen/drivers/passthrough/amd/iommu_map.c index cbf00e9e72..90cc7075c2 100644 --- a/xen/drivers/passthrough/amd/iommu_map.c +++ b/xen/drivers/passthrough/amd/iommu_map.c @@ -364,9 +364,6 @@ int amd_iommu_map_page(struct domain *d, dfn_t dfn, mfn_t mfn, int rc; unsigned long pt_mfn[7]; - if ( iommu_use_hap_pt(d) ) - return 0; - memset(pt_mfn, 0, sizeof(pt_mfn)); spin_lock(&hd->arch.mapping_lock); @@ -420,9 +417,6 @@ int amd_iommu_unmap_page(struct domain *d, dfn_t dfn, unsigned long pt_mfn[7]; struct domain_iommu *hd = dom_iommu(d); - if ( iommu_use_hap_pt(d) ) - return 0; - memset(pt_mfn, 0, sizeof(pt_mfn)); spin_lock(&hd->arch.mapping_lock); @@ -558,28 +552,6 @@ int amd_iommu_reserve_domain_unity_map(struct domain *domain, return rt; } -/* Share p2m table with iommu. */ -void amd_iommu_share_p2m(struct domain *d) -{ - struct domain_iommu *hd = dom_iommu(d); - struct page_info *p2m_table; - mfn_t pgd_mfn; - - pgd_mfn = pagetable_get_mfn(p2m_get_pagetable(p2m_get_hostp2m(d))); - p2m_table = mfn_to_page(pgd_mfn); - - if ( hd->arch.root_table != p2m_table ) - { - free_amd_iommu_pgtable(hd->arch.root_table); - hd->arch.root_table = p2m_table; - - /* When sharing p2m with iommu, paging mode = 4 */ - hd->arch.paging_mode = 4; - AMD_IOMMU_DEBUG("Share p2m table with iommu: p2m table = %#lx\n", - mfn_x(pgd_mfn)); - } -} - /* * Local variables: * mode: C diff --git a/xen/drivers/passthrough/amd/pci_amd_iommu.c b/xen/drivers/passthrough/amd/pci_amd_iommu.c index 4afbcd1609..be076210b6 100644 --- a/xen/drivers/passthrough/amd/pci_amd_iommu.c +++ b/xen/drivers/passthrough/amd/pci_amd_iommu.c @@ -396,9 +396,6 @@ static void deallocate_iommu_page_tables(struct domain *d) { struct domain_iommu *hd = dom_iommu(d); - if ( iommu_use_hap_pt(d) ) - return; - spin_lock(&hd->arch.mapping_lock); if ( hd->arch.root_table ) { @@ -566,7 +563,6 @@ static const struct iommu_ops __initconstrel _iommu_ops = { .setup_hpet_msi = amd_setup_hpet_msi, .suspend = amd_iommu_suspend, .resume = amd_iommu_resume, - .share_p2m = amd_iommu_share_p2m, .crash_shutdown = amd_iommu_crash_shutdown, .dump_p2m_table = amd_dump_p2m_table, }; diff --git a/xen/include/asm-x86/hvm/svm/amd-iommu-proto.h b/xen/include/asm-x86/hvm/svm/amd-iommu-proto.h index e0d5d23978..b832f564a7 100644 --- a/xen/include/asm-x86/hvm/svm/amd-iommu-proto.h +++ b/xen/include/asm-x86/hvm/svm/amd-iommu-proto.h @@ -66,9 +66,6 @@ int __must_check amd_iommu_flush_iotlb_pages(struct domain *d, dfn_t dfn, unsigned int flush_flags); int __must_check amd_iommu_flush_iotlb_all(struct domain *d); -/* Share p2m table with iommu */ -void amd_iommu_share_p2m(struct domain *d); - /* device table functions */ int get_dma_requestor_id(uint16_t seg, uint16_t bdf); void amd_iommu_set_intremap_table(struct amd_iommu_dte *dte,