From patchwork Tue Mar 19 23:20:55 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 160617 Delivered-To: patch@linaro.org Received: by 2002:a02:5cc1:0:0:0:0:0 with SMTP id w62csp128715jad; Tue, 19 Mar 2019 16:22:26 -0700 (PDT) X-Google-Smtp-Source: APXvYqwc2xHG/ebwEGGhekziwEcxxDMlGxN3lP1T0/Phsc8RbrU6IxNHMLGdh8J4/4AJ99gBvGb2 X-Received: by 2002:a25:7c06:: with SMTP id x6mr4276635ybc.387.1553037746272; Tue, 19 Mar 2019 16:22:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553037746; cv=none; d=google.com; s=arc-20160816; b=S4xPoz6fA9Uq/MzX/8aezzWzPRPVAG8AGxxXDNpWjCHqQdAUiuYtTlf8WEIQfnB9VM t6wdWpGTC5lTISaIufCSyRARztM/0ub3a2kR50aVHoXF+edeHVsPSFRJ6CzbZyUULVu9 f/M5N3zBh7zFSM4MNAW5M/D5WCYJTc6Yd0P2J6Lu2l9m+LBZBlSgyFp5cXQtbPAXQF33 0wuQTq0zFe4X0MivqdeoDzQAyc7nr30Xw2ZrlYOVY1YE4SBNp59URG8WAEgZUllvfgLh eMbH9TSykpbHV63j9/9Zaz40TaCGiF7nhrbrb0U9x/cWcyAnmzQhP3k9EjGJy+IrwpQe S8Sw== 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:message-id:date:to:from; bh=Zxll3An7ibXBt6hSFA5L96dKsRyqacvcAWGQyShbgEo=; b=vovZB6/s3mnfV4M93R8CH24CHSLiJUvtTs+TxPQl577Itwyn5sHELw2n1D9DWnvf+O M/dADG0HHBRFRjALBugI4H5NO6K7PvhqG+nShmrHHOOtRX7YeNMCYEK0n1Uufq91DzSo 0/CdkJB653wwe9rMR1emJHIKJfqiMLNqdGBZu90GqaXu6CyAFE0y3Db7srcCoY7pQluU SxgkIGw52BgtQbUQ6SyiKgmQsXgJBKtIgyNGuWCREDHMEGXzN3H1Tq0GYjY1Sgeev3tK UXuIBTIjeE3ZZZfzQIcn38Uz+Ka+zoNS1iumIsgVaDEEvvdoEw/FvVAsY6nvNF4cv7Zg JRPA== 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 y64si212006ywe.122.2019.03.19.16.22.26 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 19 Mar 2019 16:22:26 -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 1h6O2Z-0001Jo-R5; Tue, 19 Mar 2019 23:21:03 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1h6O2Z-0001Jg-0d for xen-devel@lists.xenproject.org; Tue, 19 Mar 2019 23:21:03 +0000 X-Inumbo-ID: a912f1c6-4a9d-11e9-bc90-bc764e045a96 Received: from foss.arm.com (unknown [217.140.101.70]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTP id a912f1c6-4a9d-11e9-bc90-bc764e045a96; Tue, 19 Mar 2019 23:21:01 +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 A86671596; Tue, 19 Mar 2019 16:21:01 -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 2DEE73F575; Tue, 19 Mar 2019 16:21:00 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Tue, 19 Mar 2019 23:20:55 +0000 Message-Id: <20190319232055.23993-1-julien.grall@arm.com> X-Mailer: git-send-email 2.11.0 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) {