From patchwork Thu May 19 05:22:06 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suravee Suthikulpanit X-Patchwork-Id: 9124381 Return-Path: X-Original-To: patchwork-xen-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 5A2C7BF29F for ; Thu, 19 May 2016 05:24:38 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6F1D9201ED for ; Thu, 19 May 2016 05:24:37 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 72832201BB for ; Thu, 19 May 2016 05:24:36 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b3GPY-0002RJ-PQ; Thu, 19 May 2016 05:22:16 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b3GPX-0002RD-3g for xen-devel@lists.xen.org; Thu, 19 May 2016 05:22:15 +0000 Received: from [85.158.139.211] by server-15.bemta-5.messagelabs.com id F9/01-26599-68D4D375; Thu, 19 May 2016 05:22:14 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpjk+JIrShJLcpLzFFi42I5r5cSodvqaxt usOOFpsWSj4tZHBg9ju7+zRTAGMWamZeUX5HAmvHg6n72gmWiFd2tOQ2MvwS6GLk4WATamSWO HWxjAXEYBToZJU5tbgZzhAR2M0qca3rA1MXIwSEskCTReZqni5GTQ0RgFqPEnFXqEDVnGSX27 Z3CDJJgE7CWOPN/OSOIzSygI3G3/TdYnFdATWLCvCfMIHNYBFQl9q9NAzFFBcIl1mx3h6gQlD g58wkLiM0p4CHx5/xOsGpmAXuJB1vLIAbKS2x/OwdsoISAgsT279/ZQC6QEGgDuvLlbXaQhJC AlsScRyvZIIp8JSb+P8kMUfSDSaL9fwdUwk3ifs81dojENjaJz0dXQjkX2SVOnlnEClGVI3Fn 8nEmCFtLYt3Vj1CjdjJK7NrbCTVKRuLYxH9QiT8sEjveN7JCOJ95Je4vmMoIUdXCJvH+QAyIL SwgJXG/+S4bhC0jsWHGHJYJjCqzkAJhFsLjs5A8voCReRWjRnFqUVlqka6hiV5SUWZ6RkluYm aOrqGBqV5uanFxYnpqTmJSsV5yfu4mRmCaYACCHYxnT3seYpTkYFIS5d1vaxsuxJeUn1KZkVi cEV9UmpNafIhRhoNDSYJ3rw9QTrAoNT21Ii0zB5iwYNISHDxKIrxCIGne4oLE3OLMdIjUKUZd jm9T761lEmLJy89LlRLn7QMpEgApyijNgxsBS56XGGWlhHkZgY4S4ilILcrNLEGVf8UozsGoJ My7BGQKT2ZeCdymV0BHMAEdcUvMBuSIkkSElFQDo4qc+55ne53k/Sy+ORaW1m59Wa9z44HirL Vn2LYy3DO5WFg5269DXKXqj9j6Qn/xXxE1G+4sv+s38YBJe/f791bffnH8+rpQJXXNQ/kNfEb q5xKnR/x8fW4ed/XznYHcEa17Vufdl3+kIrchbg3Pq/Dtx/XiVas/mrbc+7Hk5c3diwzlPRt8 4pVYijMSDbWYi4oTATMrx56ZAwAA X-Env-Sender: Suravee.Suthikulpanit@amd.com X-Msg-Ref: server-8.tower-206.messagelabs.com!1463635331!40203026!1 X-Originating-IP: [207.46.100.88] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 8.34; banners=-,-,- X-VirusChecked: Checked Received: (qmail 7580 invoked from network); 19 May 2016 05:22:13 -0000 Received: from mail-by2on0088.outbound.protection.outlook.com (HELO na01-by2-obe.outbound.protection.outlook.com) (207.46.100.88) by server-8.tower-206.messagelabs.com with AES256-SHA256 encrypted SMTP; 19 May 2016 05:22:13 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:To:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=e3JE9Mr1eu8Jx2Prj5mApPmZHrubvFy7DhwB4FajZvU=; b=NrivVHm3LVu4NBwh66fn3sRse0yTjTn0vvTYdGUqqXqkeVcixxv8o5E91hrWk0uyn0eUaYJc32/BRXNM2cmmJ87q46J1hkOtXSN3QZvNFLv1ELg94bEsKLF3/J+xJv+boWM8AH78Jbb9Tq//dPaUdhKWp6WcptRnpg8Pr71s3dU= Received: from [10.236.69.175] (165.204.77.1) by SN1PR12MB0446.namprd12.prod.outlook.com (10.162.105.14) with Microsoft SMTP Server (TLS) id 15.1.497.12; Thu, 19 May 2016 05:22:10 +0000 To: Paul Durrant , "xen-devel@lists.xen.org" , "jbeulich@suse.com" , References: <1463168217-16080-1-git-send-email-suravee.suthikulpanit@amd.com> <1463168217-16080-3-git-send-email-suravee.suthikulpanit@amd.com> <867d4c600369470f833fc41a3c35112d@AMSPEX02CL03.citrite.net> From: Suravee Suthikulpanit Message-ID: <573D4D7E.3080208@amd.com> Date: Thu, 19 May 2016 00:22:06 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.2 MIME-Version: 1.0 In-Reply-To: <867d4c600369470f833fc41a3c35112d@AMSPEX02CL03.citrite.net> X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: BLUPR11CA0011.namprd11.prod.outlook.com (10.141.240.21) To SN1PR12MB0446.namprd12.prod.outlook.com (10.162.105.14) X-MS-Office365-Filtering-Correlation-Id: b2dd2664-a282-4bab-e6cd-08d37fa5877d X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0446; 2:zns2BXcrOH1b1/qxGNI4h7BrFVeaP0GjKDzc+Br3zkjZzu7sEItb8+cHo0p40RQ83DCOKvz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35Q/KMvjR5alZ4oJG/xQkxze8hyao X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0446; 20:tV0pq6HwNeg6c78gIJw0wz0gMDq8z2Wt6eiHAoneesUjYNNrQ9eKpVG/ZPlNvJg3frv9ap3GdtjX5Sp5NW0ChkmXurSAqdtlXTqU7BKfjt16GzJTJEex7+h1YihGvC1dj+9Ghg49HSPHc7i9wW8iF8mzTG1CeThZUy+4r86EjEbVuaFhFGyuPFDnx1hAoN9YMzDZxyoDqTwKAARNWiG+7mezMbhaLpcMrz0xp7nuxzMGygQjJU0ziOPRZOQ0sYmBqI8NIqtxOyeGezNVQCZns6APeyjHNfZLnBb+gQK4BmVh9m8fUuCTnVpL8Az+l7R+Bj8n2A10Qs77tgnQdaq+pVFkvZvkhgzC6/hbOqIhZ5RdTBvhKJ64c1u517rXOQyYvMbXLNjBT+FM+r0HBwuykwij4JkPAqbSUyB+voIo99utWS/n+MY1ztmJoncIOIzjG01VaILSempDN9yw61YsvYSKW3eSME3wkli4CZAcvAh8eH9+mT0lNeStyFjAHBhe; 4:Pyn36RTYrkhu42na0Js5ZVvqkTVj6h6uDbIOQWGsFrylYG+aivQJC+ZeQpc5B3MXEUibgjHNdhX1V5vVOH84XXcZ4NZ3Cc1VNFPLGrWo2X8uxzi7uNaz01xg6ziS24Mj9i59evAU6RMH84pDRR5eVuONiOyL35xfS1HiHRPaGG9Mac0sGugD+tCjdwNmaZ9ZzCVuffiKPnKYj4a0ydtcDJbf2a4LufvkBtxua4FR0BklXMDDy4XEvnY6wFMR4RojyhbT0BXH8B+PLYOHPB3leU1JD5Wr+TAsCI8vWeE3qTMnql40BFKbaU9BLIBWG8KTOJByl9PTZWmH6+x6wtJREySHhcHjZNJvN5GRC3BeBJ0m/tGs8OyOx1fuQpVnmu63j8DKjugKaaUN15hWT2zfHA== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046)(6055026); SRVR:SN1PR12MB0446; BCL:0; PCL:0; RULEID:; SRVR:SN1PR12MB0446; X-Forefront-PRVS: 094700CA91 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(6049001)(24454002)(377454003)(13464003)(3846002)(2201001)(6116002)(64126003)(81166006)(33656002)(230700001)(77096005)(4001350100001)(19580395003)(80316001)(19580405001)(47776003)(5008740100001)(65956001)(83506001)(65806001)(23746002)(5004730100002)(2501003)(86362001)(87266999)(54356999)(4326007)(50466002)(76176999)(65816999)(50986999)(42186005)(66066001)(189998001)(92566002)(586003)(2950100001)(36756003)(5001770100001)(575784001)(8676002)(59896002)(2906002)(7059030); DIR:OUT; SFP:1101; SCL:1; SRVR:SN1PR12MB0446; H:[10.236.69.175]; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: =?Windows-1252?Q?1; SN1PR12MB0446; 23:gmR9Z+ykSgnPgTp3ctTj6qRP2f0Z9fNiGLp31?= =?Windows-1252?Q?SFl7oMyoeDaIQg8fdGKTQQYbls0MOK6tyiSwe8RgFPRK6wDxjm26BLOD?= =?Windows-1252?Q?4jFmywXHsy/xipe0LGuijIcK2oJjVmuu0jzvP4OXCwWEAE363izRPMet?= =?Windows-1252?Q?oUOKuikBmKR8ra3JL4To1ktVtZ9ov6s1DY9sOyfzzAtqQgCB2BdDovAS?= =?Windows-1252?Q?opFeu6lQ9xFP+8L8wwec/oTcVGy+INwBRQJuA0iNxqlKX36RWCHCHQTc?= =?Windows-1252?Q?F2/jNrDSHuh7wRbax4m8iXLgkuUh3IZgqN4DXByoU3WWkk5StQ0zoyvr?= =?Windows-1252?Q?QdYcZSpbX2npGaMX19JXPfYn03Prr+l8V9tNfd9CuOdkHu6/9Z7EHF/v?= =?Windows-1252?Q?kUcusykHTL2Ms2y38XOUy6u7FUtdxBgOdH2bbDnHpnms3klyNw1BvMGL?= =?Windows-1252?Q?aR8kdqYJ0ytzjLEsnxxxMjJ5Bkxe+LQ+Kk6X0LenQo2p3t+Q8BOHgI2T?= =?Windows-1252?Q?JFsegPBTVMGDOmdvybUFYv1H9xIeuj0/C3rE/lUigz/HYtuEtM/mxNZu?= =?Windows-1252?Q?Ab4ecwW2ZMsUnqVci619KOvY0KPE03+Qw+yiXlAOxB6qXsV0sxt87N5R?= =?Windows-1252?Q?8i6PKspt1b8igXxB+Bl77xJ+FXxJClosmU2O1vVLEHxq5ksh2JLQIXxz?= =?Windows-1252?Q?WTeoOEDc7OkiIngqXSRMyPbNbgbX8YpZ2japfALZt1FLo7+iIJe6swfA?= =?Windows-1252?Q?5JW52PDkdllYZfERkRXyQvQvPBZDkTrfwuYeDVAeJDhsXiQJ3qV1esnW?= =?Windows-1252?Q?1jMhs4NLZbD5/N2UfXl93Ib67ZNAQrrCypOSa1iunLTseq+7CExOhGT5?= =?Windows-1252?Q?O7mIDy5JVTOgMoNYD9DVCk1xHtdRUcPnDUmS2ERlAAIvAzyaPfeQBNIa?= =?Windows-1252?Q?s3L+q1cn3JSJeRmGqCKuHGWxlGj1PIxbBwEvKj+UfCkJIDVOBN8vOiJc?= =?Windows-1252?Q?Jrx5k3AowfNzoE9Zei/wz3o+Y5BHwrpYQpu2IDEJNic5nt/YbwyAZoPZ?= =?Windows-1252?Q?cjCQdxfACNPMUcAdWteNZOWwSR4wR4RimnjPxAP1BnutZ+dpdf+kWNWB?= =?Windows-1252?Q?oJdw0G7DKb6nhWQV2NrZ1YEXqVTTSUUVqMgj18aKVgTGF9B4XKwvjk00?= =?Windows-1252?Q?aUfR+HW6Wh12P3+6B6gtNynbTHWZmgqmEcf7S6+SN8l14up9ViAKDGtV?= =?Windows-1252?Q?2Ye2KOECXa5zZwD5lYS4ito0f30vFHiIBsjhBKW1VoytLYPCqy3V8/2a?= =?Windows-1252?Q?N9+Kl80s20OPoU+/MBKQXjr7Q=3D=3D?= X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0446; 5:Hzhg3gJdIZwXHYm10xtzGCsKlVpQyRfi82INPU3g+PYOXwLIIohtRY3XTnY7URjn7AhYv0bJdegdwSMJpkgmW94JnAnjC/aJJ2uGasl+kn6dT6g2qLt65CKDV2CyNvcwxJRTAWE//rKZY/k35lTdRw==; 24:aF6CwBxXzQTloR5d1NqyzTjRIzFvk2PsYaqF3dqHa8XV1i1kKSlpni2XP/sNlx/WVrhXLWvBkiYPQ9YBbFhosYYkOC8ng6KG2cB2wRzuig8=; 7:2rB3Md1GDrGqj7+grkIQaDRFISSoA4oQekmaigEdgg4t48nyqFJCZyWTxgwTOIZLBl45H0LhSrs3Js2EoE1MUpD0zKFfRm8LNvmVXtCzdAIyOy+20lX4c43DwBsQyksx1T+ytZekFdPE25iQz+LXiMJXggxCn9PYRCgiwh541O1qULCFEUlMT4IsvYVW3WsJ; 20:2Ls3KZXhXxVG/OMD+sq4j07zdj0HhWO6gMYvQ7m3QqwiipGh9/9rXMUbn5Z+A4c/DKp9yB7f81LDvUR65r8Fwn/M8q/Y9R/7hqdyUx6/FU92RJDmcyc9f8MxDF4rd8C9gRMh3VMFhtVyx2WFUaBj8P/1d2u1KYB0fZ3CwV3ZxB5iiTaG2b6sqfcsnKrGkY7CD90UCHAxSkHxIK6wEinpSSg4ANzye3YGRK9cHaIvm6m9N+9issRhu/X+rwPHFzzk SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 May 2016 05:22:10.3565 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR12MB0446 Cc: George Dunlap Subject: Re: [Xen-devel] [PATCH V2 2/2] svm: iommu: Only call guest_iommu_init() after initialized HVM domain X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" X-Spam-Status: No, score=-4.1 required=5.0 tests=BAD_ENC_HEADER,BAYES_00, DKIM_SIGNED,RCVD_IN_DNSWL_MED,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP + Keir (since he added this code originally). On 05/16/2016 03:19 AM, Paul Durrant wrote: >> -----Original Message----- >> >From:suravee.suthikulpanit@amd.com >> >[mailto:suravee.suthikulpanit@amd.com] >> >Sent: 13 May 2016 20:37 >> >To:xen-devel@lists.xen.org; George Dunlap;jbeulich@suse.com >> >Cc: Paul Durrant; Suravee Suthikulpanit; Suravee Suthikulpanit >> >Subject: [PATCH V2 2/2] svm: iommu: Only call guest_iommu_init() after >> >initialized HVM domain >> > >> >From: Suravee Suthikulpanit >> > >> >The guest_iommu_init() is currently called by the following code path: >> > >> > arch/x86/domain.c: arch_domain_create() >> > ]- drivers/passthrough/iommu.c: iommu_domain_init() >> > |- drivers/passthrough/amd/pci_amd_iommu.c: >> >amd_iommu_domain_init(); >> > |- drivers/passthrough/amd/iommu_guest.c: guest_iommu_init() >> > >> >At this point, the hvm_domain_initialised() has not been >> >called. So register_mmio_handler(), in guest_iommu_init(), silently fails. >> >This patch moves the call to guest_iommu_init/destroy() into >> >the svm_domain_intialise/_destroy() instead. >> > > That seems wrong. You're taking a call that currently comes via a jump table, i.e. an abstraction layer, and calling it directly. Is it possible, instead, to move the call to iommu_domain_init() later in arch_domain_create()? It seems odd, to me at least, that it's done before hvm_domain_initialise() anyway. > > Paul > Good point. I think I should be able to move iommu_domain_init() call to go after hvm_domain_initialise() as the following. ----- This was added in the commit 66a882392272346ce1d0bc5a26568894f450a7c0, and only says initialization cleanup and bugfix. I am not sure what bug was reported at the time. Anyone has an idea? Suravee diff --git a/xen/arch/x86/domain.c b/xen/arch/x86/domain.c index 9d43f7b..ac289b6 100644 --- a/xen/arch/x86/domain.c +++ b/xen/arch/x86/domain.c @@ -625,24 +625,21 @@ int arch_domain_create(struct domain *d, unsigned int domcr_flags, if ( (rc = init_domain_irq_mapping(d)) != 0 ) goto fail; - - if ( (rc = iommu_domain_init(d)) != 0 ) - goto fail; } spin_lock_init(&d->arch.e820_lock); if ( has_hvm_container_domain(d) ) { if ( (rc = hvm_domain_initialise(d)) != 0 ) - { - iommu_domain_destroy(d); goto fail; - } } else /* 64-bit PV guest by default. */ d->arch.is_32bit_pv = d->arch.has_32bit_shinfo = 0; + if ( !is_idle_domain(d) && (rc = iommu_domain_init(d)) != 0 ) + goto fail; + if ( (rc = psr_domain_init(d)) != 0 ) goto fail;