From patchwork Tue Mar 11 15:49:48 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 26033 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ve0-f200.google.com (mail-ve0-f200.google.com [209.85.128.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id EB9CF202E5 for ; Tue, 11 Mar 2014 15:51:27 +0000 (UTC) Received: by mail-ve0-f200.google.com with SMTP id oy12sf22092772veb.3 for ; Tue, 11 Mar 2014 08:51:27 -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=fR6AgfKbO8dc/Dja/higVqGU+suoi84nz8X1qc1s1Ls=; b=QokQCe8JBO2DiLtdAoIqQH41+ieI7apsaAF9PTHwJqTdAJqbOMMKeeFcimDiTm1lcF NdUw4fh21CWLTOLmH/Soz1+L05WA8S8OQBk04ujDUhHjXQYCqZC3ZjdfFcAw6uaYtlx9 5sqWpwuOVO66Q6mgLrQ6ybcvtPTfd8lOjEmKqFHhyIZmMT1EysBqpjAu+w0Mu4gbDRds UQX+ruE4qbINRzpnkK0m2bjeQg7DPjYaOTRmW9OsDeOE+U2arsbadW8eqMQ8/Rzx/0B2 keUmxm8m/73lq9IzBGHyMvWyvkQVZYlqG3RF+EzecneUslNTpciXRBG4nzrtqmbGOoj3 kgOg== X-Gm-Message-State: ALoCoQnuh86PswJEP0Zr+L8VxZUAApjpXrPFKh7BmVfXUrjbyUTUIcsQzAwFSAS4hxswcLF/worA X-Received: by 10.58.39.202 with SMTP id r10mr15196905vek.12.1394553087753; Tue, 11 Mar 2014 08:51:27 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.84.239 with SMTP id l102ls2525750qgd.5.gmail; Tue, 11 Mar 2014 08:51:27 -0700 (PDT) X-Received: by 10.52.241.106 with SMTP id wh10mr27357331vdc.16.1394553087621; Tue, 11 Mar 2014 08:51:27 -0700 (PDT) Received: from mail-ve0-f177.google.com (mail-ve0-f177.google.com [209.85.128.177]) by mx.google.com with ESMTPS id si3si5858514vcb.28.2014.03.11.08.51.27 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 11 Mar 2014 08:51:27 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.177 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.177; Received: by mail-ve0-f177.google.com with SMTP id sa20so8599205veb.8 for ; Tue, 11 Mar 2014 08:51:27 -0700 (PDT) X-Received: by 10.52.26.17 with SMTP id h17mr84698vdg.65.1394553087534; Tue, 11 Mar 2014 08:51:27 -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.78.9 with SMTP id i9csp215040vck; Tue, 11 Mar 2014 08:51:27 -0700 (PDT) X-Received: by 10.140.41.134 with SMTP id z6mr2351911qgz.112.1394553085916; Tue, 11 Mar 2014 08:51:25 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id q1si11424602qab.111.2014.03.11.08.51.25 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 11 Mar 2014 08:51:25 -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 1WNOwW-0006lo-JG; Tue, 11 Mar 2014 15:50:12 +0000 Received: from mail6.bemta4.messagelabs.com ([85.158.143.247]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WNOwW-0006lX-1z for xen-devel@lists.xenproject.org; Tue, 11 Mar 2014 15:50:12 +0000 Received: from [85.158.143.35:20656] by server-3.bemta-4.messagelabs.com id 7A/AB-13602-3B03F135; Tue, 11 Mar 2014 15:50:11 +0000 X-Env-Sender: julien.grall@linaro.org X-Msg-Ref: server-4.tower-21.messagelabs.com!1394553010!1267593!1 X-Originating-IP: [74.125.82.45] 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 23377 invoked from network); 11 Mar 2014 15:50:10 -0000 Received: from mail-wg0-f45.google.com (HELO mail-wg0-f45.google.com) (74.125.82.45) by server-4.tower-21.messagelabs.com with RC4-SHA encrypted SMTP; 11 Mar 2014 15:50:10 -0000 Received: by mail-wg0-f45.google.com with SMTP id l18so9765618wgh.28 for ; Tue, 11 Mar 2014 08:50:09 -0700 (PDT) X-Received: by 10.180.12.115 with SMTP id x19mr3765053wib.19.1394553009883; Tue, 11 Mar 2014 08:50:09 -0700 (PDT) Received: from belegaer.uk.xensource.com. ([185.25.64.249]) by mx.google.com with ESMTPSA id bm8sm62454537wjc.12.2014.03.11.08.50.08 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Mar 2014 08:50:09 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Tue, 11 Mar 2014 15:49:48 +0000 Message-Id: <1394552999-14171-3-git-send-email-julien.grall@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1394552999-14171-1-git-send-email-julien.grall@linaro.org> References: <1394552999-14171-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 v3 02/13] 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.128.177 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 Cc: Suravee Suthikulpanit Cc: Jan Beulich Reviewed-by: Ian Campbell --- 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 c26aabc..79f4a77 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); @@ -273,8 +273,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; @@ -333,7 +331,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 26539e0..6ab684e 100644 --- a/xen/include/xen/hvm/iommu.h +++ b/xen/include/xen/hvm/iommu.h @@ -44,7 +44,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;