From patchwork Tue May 13 15:50:18 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Julien Grall X-Patchwork-Id: 30089 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-qg0-f69.google.com (mail-qg0-f69.google.com [209.85.192.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 5F8B120446 for ; Tue, 13 May 2014 15:52:38 +0000 (UTC) Received: by mail-qg0-f69.google.com with SMTP id f51sf1002999qge.0 for ; Tue, 13 May 2014 08:52:38 -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=z5sUsoyyOtEvlIgAVtDkw9e/8zynxWKYbXLlPJgwXzM=; b=LIzp8wLaCljoDT77A6Rd/Dk0P48ueaO+7AaDBUf7tkZztv2ABwZ/JBev2kKuyLcGLi PF0o+vCFdafF2TyIMTGaImHHugcxEkGS9TxABZQZLIov0T2Gg/rH4FN2H2jCeyTCEKXp ZCMWzL54f88F76uC+u9+JWJDVBV/wJ9Lu36afYwLFwKZa+zqRkLeXHERMWiCno6jn9Ki PxLo2AMVtZ09K7utXSFL92F5IYXqYhi0lVuEKZKiwMjFv9I+dzCzvdG06drzcsb+hwll kwGH695x9w9/4CEAoVPtOzwaAqCMUtKB7Tq3B57jzeNC1QHzrVnXB3nsmXNsgv+qCvr/ OTuw== X-Gm-Message-State: ALoCoQlBG9xJoc3Y+7b/1LEUVgpc40FasyE54zShW5/UcQ2ssY8RQ9yc7q4J0ZDMCgufB+4FCcFp X-Received: by 10.236.231.52 with SMTP id k50mr15475235yhq.52.1399996358153; Tue, 13 May 2014 08:52:38 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.27.38 with SMTP id 35ls1913257qgw.77.gmail; Tue, 13 May 2014 08:52:38 -0700 (PDT) X-Received: by 10.52.76.134 with SMTP id k6mr780429vdw.62.1399996357981; Tue, 13 May 2014 08:52:37 -0700 (PDT) Received: from mail-vc0-f179.google.com (mail-vc0-f179.google.com [209.85.220.179]) by mx.google.com with ESMTPS id tv3si2711190vdc.162.2014.05.13.08.52.37 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 13 May 2014 08:52:37 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.179 as permitted sender) client-ip=209.85.220.179; Received: by mail-vc0-f179.google.com with SMTP id im17so708905vcb.38 for ; Tue, 13 May 2014 08:52:37 -0700 (PDT) X-Received: by 10.220.5.129 with SMTP id 1mr784576vcv.71.1399996357874; Tue, 13 May 2014 08:52:37 -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 ib8csp162118vcb; Tue, 13 May 2014 08:52:37 -0700 (PDT) X-Received: by 10.224.95.9 with SMTP id b9mr31090033qan.11.1399996357263; Tue, 13 May 2014 08:52:37 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id l110si8026847qgf.159.2014.05.13.08.52.36 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 13 May 2014 08:52:37 -0700 (PDT) Received-SPF: none (google.com: xen-devel-bounces@lists.xen.org does not designate permitted sender hosts) 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 1WkEyX-0008K8-EM; Tue, 13 May 2014 15:50:41 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1WkEyV-0008Ix-7X for xen-devel@lists.xenproject.org; Tue, 13 May 2014 15:50:39 +0000 Received: from [85.158.137.68:15167] by server-2.bemta-3.messagelabs.com id 3F/11-23530-E4F32735; Tue, 13 May 2014 15:50:38 +0000 X-Env-Sender: julien.grall@linaro.org X-Msg-Ref: server-9.tower-31.messagelabs.com!1399996237!3645322!1 X-Originating-IP: [74.125.83.42] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 6.11.3; banners=-,-,- X-VirusChecked: Checked Received: (qmail 27822 invoked from network); 13 May 2014 15:50:37 -0000 Received: from mail-ee0-f42.google.com (HELO mail-ee0-f42.google.com) (74.125.83.42) by server-9.tower-31.messagelabs.com with RC4-SHA encrypted SMTP; 13 May 2014 15:50:37 -0000 Received: by mail-ee0-f42.google.com with SMTP id d49so562815eek.1 for ; Tue, 13 May 2014 08:50:37 -0700 (PDT) X-Received: by 10.14.223.70 with SMTP id u46mr4214983eep.100.1399996237285; Tue, 13 May 2014 08:50:37 -0700 (PDT) Received: from belegaer.uk.xensource.com ([185.25.64.249]) by mx.google.com with ESMTPSA id m44sm41054917eeh.14.2014.05.13.08.50.35 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 13 May 2014 08:50:36 -0700 (PDT) From: Julien Grall To: xen-devel@lists.xenproject.org Date: Tue, 13 May 2014 16:50:18 +0100 Message-Id: <1399996230-18201-3-git-send-email-julien.grall@linaro.org> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1399996230-18201-1-git-send-email-julien.grall@linaro.org> References: <1399996230-18201-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 v5 02/14] 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=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.179 as permitted sender) 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 Acked-by: Suravee Suthikulpanit Cc: Jan Beulich --- 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;