From patchwork Tue Apr 22 13:14:20 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 28797 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qc0-f200.google.com (mail-qc0-f200.google.com [209.85.216.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 466BE203C3 for ; Tue, 22 Apr 2014 13:16:03 +0000 (UTC) Received: by mail-qc0-f200.google.com with SMTP id i17sf23770272qcy.3 for ; Tue, 22 Apr 2014 06:16:02 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:cc:subject:precedence:list-id:list-unsubscribe:list-post :list-help:list-subscribe:mime-version:sender:errors-to :x-original-sender:x-original-authentication-results:mailing-list :list-archive:content-type:content-transfer-encoding; bh=sVcojo03bHcYIjAO/qSCfMWOgoFds0tIU7+8P/wge7s=; b=b3RumkvpxLTjEEfYZuFti0T6emYJwmndNELhLMNcKGHT/p/0vZCM1ghmTmnKy1JjL/ Gmexj4YDshdspXbHu6r5gkYt1IvkUq2UpRmZIaP1ujGsJ3HONk7CutAI9wJJjbq1iHXn mDHvzU/WGE8cTO12+lgKWgwl3KqTxVvlsSGfiCdr6qV7joodTqN0WreWGP8c1U68BSjf XGeMtLGsmb8o6kTVEK6zM/V4JtdsX/UhYAkg+TC9mo/hSRg7GCRbC4ECjrvVd76ir+mX 1/fJRaaYGtRZT5v85fhTtrF4lz29/wlxF87MP4NSlHGGXZz5q6L9x6SrRkWCJ3/oHPO3 U04Q== X-Gm-Message-State: ALoCoQk570dtZFwNr57Y7pNQGeLv2N9ZMyMzGu5M9lb7EQtAsrhL8ECl48I9FBNv0pEq8bk/dVIo X-Received: by 10.58.199.170 with SMTP id jl10mr22601156vec.1.1398172562880; Tue, 22 Apr 2014 06:16:02 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.84.103 with SMTP id k94ls92463qgd.30.gmail; Tue, 22 Apr 2014 06:16:02 -0700 (PDT) X-Received: by 10.58.24.231 with SMTP id x7mr22704vef.71.1398172562722; Tue, 22 Apr 2014 06:16:02 -0700 (PDT) Received: from mail-vc0-f172.google.com (mail-vc0-f172.google.com [209.85.220.172]) by mx.google.com with ESMTPS id sh5si6873851vdc.50.2014.04.22.06.16.02 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 22 Apr 2014 06:16:02 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.172 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.172; Received: by mail-vc0-f172.google.com with SMTP id la4so2565153vcb.3 for ; Tue, 22 Apr 2014 06:16:02 -0700 (PDT) X-Received: by 10.58.169.97 with SMTP id ad1mr60853vec.45.1398172562640; Tue, 22 Apr 2014 06:16:02 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.221.72 with SMTP id ib8csp23824vcb; Tue, 22 Apr 2014 06:16:02 -0700 (PDT) X-Received: by 10.140.42.165 with SMTP id c34mr43211537qga.40.1398172561652; Tue, 22 Apr 2014 06:16:01 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id gq5si16823477qab.118.2014.04.22.06.16.01 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 22 Apr 2014 06:16:01 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of xen-devel-bounces@lists.xen.org designates 50.57.142.19 as permitted sender) client-ip=50.57.142.19; Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WcaXK-0005v7-Uj; Tue, 22 Apr 2014 13:14:58 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WcaXE-0005qr-8Q for xen-devel@lists.xenproject.org; Tue, 22 Apr 2014 13:14:52 +0000 Received: from [85.158.139.211:33214] by server-13.bemta-5.messagelabs.com id C3/31-16341-B4B66535; Tue, 22 Apr 2014 13:14:51 +0000 X-Env-Sender: julien.grall@linaro.org X-Msg-Ref: server-8.tower-206.messagelabs.com!1398172490!8522917!1 X-Originating-IP: [74.125.83.50] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 6.11.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 7691 invoked from network); 22 Apr 2014 13:14:50 -0000 Received: from mail-ee0-f50.google.com (HELO mail-ee0-f50.google.com) (74.125.83.50) by server-8.tower-206.messagelabs.com with RC4-SHA encrypted SMTP; 22 Apr 2014 13:14:50 -0000 Received: by mail-ee0-f50.google.com with SMTP id c13so4566048eek.23 for ; Tue, 22 Apr 2014 06:14:50 -0700 (PDT) X-Received: by 10.15.67.142 with SMTP id u14mr55541599eex.19.1398172490505; Tue, 22 Apr 2014 06:14:50 -0700 (PDT) Received: from belegaer.uk.xensource.com ([185.25.64.249]) by mx.google.com with ESMTPSA id 45sm112969867eeh.9.2014.04.22.06.14.49 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 Apr 2014 06:14:49 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Tue, 22 Apr 2014 14:14:20 +0100 Message-Id: <1398172475-27873-7-git-send-email-julien.grall@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1398172475-27873-1-git-send-email-julien.grall@linaro.org> References: <1398172475-27873-1-git-send-email-julien.grall@linaro.org> Cc: ian.campbell@citrix.com, Julien Grall , tim@xen.org, stefano.stabellini@citrix.com, Jan Beulich , Suravee Suthikulpanit Subject: [Xen-devel] [PATCH v4 06/21] xen/passthrough: amd: Remove domain_id from hvm_iommu X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: julien.grall@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.172 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Archive: The structure hvm_iommu contains a shadow value of domain->domain_id. There is no reason to not directly use domain->domain_id. Signed-off-by: Julien Grall Acked-by: Ian Campbell Cc: Suravee Suthikulpanit Cc: Jan Beulich Acked-by: Suravee Suthikulpanit --- Changes in v3: - Patch added --- xen/drivers/passthrough/amd/iommu_cmd.c | 3 +-- xen/drivers/passthrough/amd/iommu_map.c | 2 +- xen/drivers/passthrough/amd/pci_amd_iommu.c | 8 +++----- xen/include/xen/hvm/iommu.h | 1 - 4 files changed, 5 insertions(+), 9 deletions(-) diff --git a/xen/drivers/passthrough/amd/iommu_cmd.c b/xen/drivers/passthrough/amd/iommu_cmd.c index d27bd3c..4faa01b 100644 --- a/xen/drivers/passthrough/amd/iommu_cmd.c +++ b/xen/drivers/passthrough/amd/iommu_cmd.c @@ -354,8 +354,7 @@ static void _amd_iommu_flush_pages(struct domain *d, { unsigned long flags; struct amd_iommu *iommu; - struct hvm_iommu *hd = domain_hvm_iommu(d); - unsigned int dom_id = hd->domain_id; + unsigned int dom_id = d->domain_id; /* send INVALIDATE_IOMMU_PAGES command */ for_each_amd_iommu ( iommu ) diff --git a/xen/drivers/passthrough/amd/iommu_map.c b/xen/drivers/passthrough/amd/iommu_map.c index 1294561..b79e470 100644 --- a/xen/drivers/passthrough/amd/iommu_map.c +++ b/xen/drivers/passthrough/amd/iommu_map.c @@ -614,7 +614,7 @@ static int update_paging_mode(struct domain *d, unsigned long gfn) /* valid = 0 only works for dom0 passthrough mode */ amd_iommu_set_root_page_table((u32 *)device_entry, page_to_maddr(hd->root_table), - hd->domain_id, + d->domain_id, hd->paging_mode, 1); amd_iommu_flush_device(iommu, req_id); diff --git a/xen/drivers/passthrough/amd/pci_amd_iommu.c b/xen/drivers/passthrough/amd/pci_amd_iommu.c index 366c750..51b75fc 100644 --- a/xen/drivers/passthrough/amd/pci_amd_iommu.c +++ b/xen/drivers/passthrough/amd/pci_amd_iommu.c @@ -138,7 +138,7 @@ static void amd_iommu_setup_domain_device( { /* bind DTE to domain page-tables */ amd_iommu_set_root_page_table( - (u32 *)dte, page_to_maddr(hd->root_table), hd->domain_id, + (u32 *)dte, page_to_maddr(hd->root_table), domain->domain_id, hd->paging_mode, valid); if ( pci_ats_device(iommu->seg, bus, pdev->devfn) && @@ -152,7 +152,7 @@ static void amd_iommu_setup_domain_device( "domain = %d, paging mode = %d\n", req_id, pdev->type, page_to_maddr(hd->root_table), - hd->domain_id, hd->paging_mode); + domain->domain_id, hd->paging_mode); } spin_unlock_irqrestore(&iommu->lock, flags); @@ -274,8 +274,6 @@ static int amd_iommu_domain_init(struct domain *d) IOMMU_PAGING_MODE_LEVEL_2 : get_paging_mode(max_page); - hd->domain_id = d->domain_id; - guest_iommu_init(d); return 0; @@ -334,7 +332,7 @@ void amd_iommu_disable_domain_device(struct domain *domain, AMD_IOMMU_DEBUG("Disable: device id = %#x, " "domain = %d, paging mode = %d\n", - req_id, domain_hvm_iommu(domain)->domain_id, + req_id, domain->domain_id, domain_hvm_iommu(domain)->paging_mode); } spin_unlock_irqrestore(&iommu->lock, flags); diff --git a/xen/include/xen/hvm/iommu.h b/xen/include/xen/hvm/iommu.h index 8c98274..dc9c766 100644 --- a/xen/include/xen/hvm/iommu.h +++ b/xen/include/xen/hvm/iommu.h @@ -38,7 +38,6 @@ struct hvm_iommu { struct list_head mapped_rmrrs; /* amd iommu support */ - int domain_id; int paging_mode; struct page_info *root_table; struct guest_iommu *g_iommu;