From nobody Mon May 6 00:09:12 2024 Delivered-To: importer@patchew.org Received-SPF: none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=kernel.org ARC-Seal: i=1; a=rsa-sha256; t=1558567698; cv=none; d=zoho.com; s=zohoarc; b=TRGjivAh3M9S/jSdibx/+rK0E0Au0xFc/C1cBlTiLcw3BhlvLRGwv0fcEODplQ4ihZxhrOjj1qaIJEZYFDAxF1Ll2QDvJqM5zffeEaxgXZxyVMS0nGq9LNtbEp9ZFWqxvWniQYURS+tqqKfaLwvI8kUsoHw9mUbSb7W+Giz3z7o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1558567698; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To:ARC-Authentication-Results; bh=Gq8e0QJmRquoG16cZtbzXVCt32KQuod12ickevyShbM=; b=LOpLlDCmsEZrIGVHZzYihtS3Q1u0LCRhqI3JacjO+Mv7xKqJk68EHBC1QwjNSm8klvFICRBcbg1I1riU51LMPibVtvcDET+iYsrRqhfRCCBqzibJkMu42uYDvEugvCpoRd/T+jjUcY6eag7lgXFRZT8xfkI2/expNDkTKeZdBVM= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=fail; spf=none (zoho.com: 192.237.175.120 is neither permitted nor denied by domain of lists.xenproject.org) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1558567698557486.81579859878786; Wed, 22 May 2019 16:28:18 -0700 (PDT) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hTacv-0004Ih-94; Wed, 22 May 2019 23:26:29 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hTacu-0004Ic-27 for xen-devel@lists.xenproject.org; Wed, 22 May 2019 23:26:28 +0000 Received: from mail.kernel.org (unknown [198.145.29.99]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id 04a8cb30-7ce9-11e9-8980-bc764e045a96; Wed, 22 May 2019 23:26:26 +0000 (UTC) Received: from localhost (c-67-164-102-47.hsd1.ca.comcast.net [67.164.102.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 3326B20881; Wed, 22 May 2019 23:26:25 +0000 (UTC) X-Inumbo-ID: 04a8cb30-7ce9-11e9-8980-bc764e045a96 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1558567585; bh=wCdM3AvrhUhfJUpVQhYWXALTPt0dXlRc4Yx6aMltnxQ=; h=Date:From:To:cc:Subject:From; b=cAZP7Bc1ySrquQwX4HblyhPC73702bAiiesb0NNs8Rxs2VojqZV4/p82Llhu8aANJ fHFrCDfcrTxWF1wk4yhmUZ8YIV/9zRWA9mXy/IR8yU/Vxlz2lUGVkInZsQabaKNiE1 /NfZWfaaQqAmh811T36ESGoegvGAFSEXdLRgrt3Y= Date: Wed, 22 May 2019 16:26:24 -0700 (PDT) From: Stefano Stabellini X-X-Sender: sstabellini@sstabellini-ThinkPad-T480s To: konrad.wilk@oracle.com, boris.ostrovsky@oracle.com, jgross@suse.com Message-ID: User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Subject: [Xen-devel] [PATCH] xen/swiotlb: don't initialize swiotlb twice on arm64 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: xen-devel@lists.xenproject.org, Julien.Grall@arm.com, sstabellini@kernel.org Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) From: Stefano Stabellini On arm64 swiotlb is already initialized by mem_init. We don't want to initialize it twice, the memory is already allocated. Detect this condition in swiotlb-xen and skip the second initialization. Signed-off-by: Stefano Stabellini --- There are other issues which I found recently affecting the swiotlb on arm64 -- I'll send the other patches separately. diff --git a/drivers/xen/swiotlb-xen.c b/drivers/xen/swiotlb-xen.c index 877baf2..8fcda2bf4 100644 --- a/drivers/xen/swiotlb-xen.c +++ b/drivers/xen/swiotlb-xen.c @@ -206,6 +206,7 @@ int __ref xen_swiotlb_init(int verbose, bool early) int rc =3D -ENOMEM; enum xen_swiotlb_err m_ret =3D XEN_SWIOTLB_UNKNOWN; unsigned int repeat =3D 3; + bool pre_initialized =3D false; =20 xen_io_tlb_nslabs =3D swiotlb_nr_tbl(); retry: @@ -214,7 +215,10 @@ int __ref xen_swiotlb_init(int verbose, bool early) /* * Get IO TLB memory from any location. */ - if (early) { + if (io_tlb_start !=3D 0) { + xen_io_tlb_start =3D phys_to_virt(io_tlb_start); + pre_initialized =3D true; + } else if (early) { xen_io_tlb_start =3D memblock_alloc(PAGE_ALIGN(bytes), PAGE_SIZE); if (!xen_io_tlb_start) @@ -264,7 +268,7 @@ int __ref xen_swiotlb_init(int verbose, bool early) verbose)) panic("Cannot allocate SWIOTLB buffer"); rc =3D 0; - } else + } else if (!pre_initialized) rc =3D swiotlb_late_init_with_tbl(xen_io_tlb_start, xen_io_tlb_nslabs); =20 if (!rc) _______________________________________________ Xen-devel mailing list Xen-devel@lists.xenproject.org https://lists.xenproject.org/mailman/listinfo/xen-devel