From patchwork Tue Mar 19 23:21:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 160618 Delivered-To: patch@linaro.org Received: by 2002:a02:5cc1:0:0:0:0:0 with SMTP id w62csp129102jad; Tue, 19 Mar 2019 16:22:57 -0700 (PDT) X-Google-Smtp-Source: APXvYqz7M87oxbZVKRVfZYmpGHN/mRkf7rS2Wuqda8mZZm/TB9LaxcBfoPnJ/VJCCZGH1vI8HL+Y X-Received: by 2002:a81:3dd5:: with SMTP id k204mr4338266ywa.502.1553037777232; Tue, 19 Mar 2019 16:22:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553037777; cv=none; d=google.com; s=arc-20160816; b=VRTZNIbVWzgLtrAPxczFIGEHLYi7mgeD023r3HAfw3TFT3EBhpItfzY+6PAmKsTo/v o/yLhgWdN0xwipbYp3pNKWovL/gs/NuDKU65HpBpG2Awt0YatkYc7I8gV+7Ev6TiKg0a zq7qbbycxzorsZcAGnieovW1HbnCmsin0ZSnjUHZdh0avOg0rWBaKOQVcIF1lbrwUkGx f+I1P4oOFlesmaN4ZnW0Uf7TD7nKaB2O5dPLQfO+gOwwRhbK4k4esb/gz2mB/L/IS8N4 8YeTo3AMt+WM3MXZsLb1PP7dy//aEGp0Mlm8d6fxChMe4JsZHh3DkK1cIgRqvNrUIN4n QeFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:references:in-reply-to:message-id:date:to:from; bh=Zxll3An7ibXBt6hSFA5L96dKsRyqacvcAWGQyShbgEo=; b=RenBdu+9E5q1OyCb3PTSkuGe3V5Lw3Vn4BodQ98ivbON+SWeosTl2v6vFOei8T3qhm YU9z4jPizrYUQ4N0V4a50Czevs9nwPCFBULJedAWymyNZ9nnA1X7PuEgf8G0i2SZ/+zK cUiHeoFn7zWyTxBZsfDyJKeyBTe9IX2pq2T8roqsQu0NfWSQ2YxB7hV8ZcjumhxupH4e PnzbFsc0O9psl377zAbIZKw6cY0B4HOlGNDyaQR0HeXisiyymiPEzx/fhuCNPg+ZGPjr 8JcUfzVwlrDNR1b6gDj5G5bNAwcfmAHZksiJfR2chiOZXNeVMtiXc/zYNfZanker3MMB RSUQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id x128si192500ywa.299.2019.03.19.16.22.57 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 19 Mar 2019 16:22:57 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1h6O3A-0001P4-G2; Tue, 19 Mar 2019 23:21:40 +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 1h6O38-0001OQ-OY for xen-devel@lists.xenproject.org; Tue, 19 Mar 2019 23:21:38 +0000 X-Inumbo-ID: bea01590-4a9d-11e9-9c18-ebb5a94d69d8 Received: from foss.arm.com (unknown [217.140.101.70]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTP id bea01590-4a9d-11e9-9c18-ebb5a94d69d8; Tue, 19 Mar 2019 23:21:38 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id CF59D1596; Tue, 19 Mar 2019 16:21:37 -0700 (PDT) Received: from e108454-lin.cambridge.arm.com (e108454-lin.cambridge.arm.com [10.1.196.50]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 546943F575; Tue, 19 Mar 2019 16:21:36 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Tue, 19 Mar 2019 23:21:30 +0000 Message-Id: <20190319232130.24172-2-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190319232130.24172-1-julien.grall@arm.com> References: <20190319232130.24172-1-julien.grall@arm.com> Subject: [Xen-devel] [PATCH] xen: passthrough/amd: Remove unused function guest_iommu_set_base 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: Wei Liu , Suravee Suthikulpanit , Andrew Cooper , Julien Grall , Jan Beulich , Brian Woods , =?utf-8?q?Roger_Pau_Monn=C3=A9?= MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" The function is unused and could potentially lead a to trigger the BUG_ON() in p2m_change_type_one if misused as the p2m type is not sanitized. So remove it. Signed-off-by: Julien Grall --- xen/drivers/passthrough/amd/iommu_guest.c | 23 ----------------------- xen/include/asm-x86/hvm/svm/amd-iommu-proto.h | 1 - 2 files changed, 24 deletions(-) diff --git a/xen/drivers/passthrough/amd/iommu_guest.c b/xen/drivers/passthrough/amd/iommu_guest.c index 96175bb9ac..dbb7526025 100644 --- a/xen/drivers/passthrough/amd/iommu_guest.c +++ b/xen/drivers/passthrough/amd/iommu_guest.c @@ -805,29 +805,6 @@ static int guest_iommu_mmio_write(struct vcpu *v, unsigned long addr, return X86EMUL_OKAY; } -int guest_iommu_set_base(struct domain *d, uint64_t base) -{ - p2m_type_t t; - struct guest_iommu *iommu = domain_iommu(d); - - if ( !iommu ) - return -EACCES; - - iommu->mmio_base = base; - base >>= PAGE_SHIFT; - - for ( int i = 0; i < IOMMU_MMIO_PAGE_NR; i++ ) - { - unsigned long gfn = base + i; - - get_gfn_query(d, gfn, &t); - p2m_change_type_one(d, gfn, t, p2m_mmio_dm); - put_gfn(d, gfn); - } - - return 0; -} - /* Initialize mmio read only bits */ static void guest_iommu_reg_init(struct guest_iommu *iommu) { 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 c5697565d6..0129ffe5a9 100644 --- a/xen/include/asm-x86/hvm/svm/amd-iommu-proto.h +++ b/xen/include/asm-x86/hvm/svm/amd-iommu-proto.h @@ -142,7 +142,6 @@ void guest_iommu_add_ppr_log(struct domain *d, u32 entry[]); void guest_iommu_add_event_log(struct domain *d, u32 entry[]); int guest_iommu_init(struct domain* d); void guest_iommu_destroy(struct domain *d); -int guest_iommu_set_base(struct domain *d, uint64_t base); static inline u32 get_field_from_reg_u32(u32 reg_value, u32 mask, u32 shift) {