Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp758490imm; Wed, 6 Jun 2018 05:39:46 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLKpOugKua6nscKoyWp1e4Uosx57B22oxaf5+IkSmoEcKg60cgqX75xBEFQMEaGQU2baiz5 X-Received: by 2002:a63:3e83:: with SMTP id l125-v6mr2489233pga.355.1528288786599; Wed, 06 Jun 2018 05:39:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528288786; cv=none; d=google.com; s=arc-20160816; b=xnc31FtcLT+hRNsB+r43Jv7CIxnHI8mLhsPj4QWoraYy8hbIPAuaAfZQHwzS73hFP1 KqldBeQn2+7a/5x9Z9q965Qz8jA97SqUTaWepMkXOovZey9gGbC/Xwkt0SZF0UeV2z0z q0XnOARo3xaFJuYOt7ICqVIEHwdpJBerz3xT4vLjqn+3H2qkT94VcpJ95ANfux4LP1nj hT7M0qpMhA4eyXnz2pFq/7qmB/p0ahV3F3LV7jT5QdDja4mCegaB8PAMy/vSkFdfq9p0 zTsjM7BfNz6cmmMrOQ+Af3cDlWeDwq9waAdlV4K+Oh0gFTK/BoJJx/N4LYT1DBqUQdqU i3Tw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=+i9XGix7sXdSLswf7pi5G3B9glj+zD9x3Ofuo3u/vU4=; b=ya0tS9oUHza/jyA9zh/nGVbYpKjX/u1QGnU3eiy0djVPhWl9VF7T65Rqfc1eM5NLEo sFCisU0ZrY6paEh03kF5egq8dF/wZgjmTNGQTvpPRwVlNjd5fV3QG/UHAmWMU5+vnrWp khfIakO9pCYXPAYS31zhTzyonjV4+xLU93XL7LPGnr3Dq2kB6NTv3LWOc/uNH3Ze4PSF jVgk08H6QaYFaPbebbcQVH8sjbfv23u+W+wR8xmRUD1/O/u0Ip5DUHqvADi3//QbIZ6p mYuQodno7Z6UK4D0vvsaI+ks2wrSWdkgCWyfFgBsZhY8sHEzgdI8PIq8IjZtQ7BZTn7f pp6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=CB0QUnoz; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n23-v6si19727784pgc.366.2018.06.06.05.39.32; Wed, 06 Jun 2018 05:39:46 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=CB0QUnoz; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751957AbeFFMjD (ORCPT + 99 others); Wed, 6 Jun 2018 08:39:03 -0400 Received: from mail-lf0-f67.google.com ([209.85.215.67]:39263 "EHLO mail-lf0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751714AbeFFMjC (ORCPT ); Wed, 6 Jun 2018 08:39:02 -0400 Received: by mail-lf0-f67.google.com with SMTP id t134-v6so8863072lff.6; Wed, 06 Jun 2018 05:39:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=+i9XGix7sXdSLswf7pi5G3B9glj+zD9x3Ofuo3u/vU4=; b=CB0QUnozawbNI0pwlB4+FB2hdbnwbIS5W/h9cTTEx+uRkaCWyG0SV0OMp+9Ps+wE0E ePNxgfbsngzxvTvoPyksrS8x6OliHLcwR6HpHa4BRFtPfdCNvL8s0UtJWV9kiU+XKput q8Cq5vspzsjjqGf4lbwXzCcfqKRXuF8BDWIHrtqVJR+o9pJi8KZyuT1d804UC4+77Y32 6WuTtJ69ERwx98ZY7FttkwH7BfZFefb7/hPGEW/AYtJqd8geRzOsFVH5OUMT0oqZuThM IjXvEuZBS0o0Jt2vDG6Fd/d/y+9RbKycEFGn6cs0UOcwCkk6oO3c24oB5ERDJdthUWM3 JbTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=+i9XGix7sXdSLswf7pi5G3B9glj+zD9x3Ofuo3u/vU4=; b=dDGI/4AxHcUyjNXckXAnUYQyreInQZE4gMsexm0z0CRCPs4jmzZyrqGX+C98RvkPbe odAyClOxod+4VSzM18KLlUeAcwB1mXVsR1Qb5Sel7jb23qwkOuUD4nLAJ27BTDaXxdNs Sb5wC5GQ1N/oOCFPTT/dBWM98gZ1ZX5NmZX/OixefasIpUdhWQHZA2+7rRV5udtvMth/ J6hJYYyAEnhst6UzQbsnG3AJeKgKEbMfSXsGRjJrK9CJaZVqPxMU2n+eHk+7KVhspaNx E5rQWn3oN1K2s3cwsI7omDs6YhLkfWiL9FSz6PLqmtdUl6m2q90+T1g6K2RrQhc9v2FI +4WQ== X-Gm-Message-State: APt69E3+pLsdVPgy2jjlCd5iG+OhSSoTEYyND7EM1YCqu/oa93p5OCYm t2pwZJC73iNCCeqaHYlVTtQ= X-Received: by 2002:a2e:8549:: with SMTP id u9-v6mr2007408ljj.10.1528288740556; Wed, 06 Jun 2018 05:39:00 -0700 (PDT) Received: from [10.17.182.9] (ll-55.209.223.85.sovam.net.ua. [85.223.209.55]) by smtp.gmail.com with ESMTPSA id r189-v6sm11417926lfe.81.2018.06.06.05.38.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 06 Jun 2018 05:38:59 -0700 (PDT) Subject: Re: [PATCH v2 8/9] xen/gntdev: Implement dma-buf import functionality To: Boris Ostrovsky , xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-media@vger.kernel.org, jgross@suse.com, konrad.wilk@oracle.com Cc: daniel.vetter@intel.com, dongwon.kim@intel.com, matthew.d.roper@intel.com, Oleksandr Andrushchenko References: <20180601114132.22596-1-andr2000@gmail.com> <20180601114132.22596-9-andr2000@gmail.com> <7ef4f26e-4225-ea7e-8183-9a6c3fe69345@oracle.com> From: Oleksandr Andrushchenko Message-ID: <8676e1d7-3179-5fc0-08fb-02373df4101b@gmail.com> Date: Wed, 6 Jun 2018 15:38:58 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <7ef4f26e-4225-ea7e-8183-9a6c3fe69345@oracle.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 06/05/2018 01:28 AM, Boris Ostrovsky wrote: > On 06/01/2018 07:41 AM, Oleksandr Andrushchenko wrote: >> /* ------------------------------------------------------------------ */ >> >> +static int >> +dmabuf_imp_grant_foreign_access(struct page **pages, u32 *refs, >> + int count, int domid) >> +{ >> + grant_ref_t priv_gref_head; >> + int i, ret; >> + >> + ret = gnttab_alloc_grant_references(count, &priv_gref_head); >> + if (ret < 0) { >> + pr_err("Cannot allocate grant references, ret %d\n", ret); >> + return ret; >> + } >> + >> + for (i = 0; i < count; i++) { >> + int cur_ref; >> + >> + cur_ref = gnttab_claim_grant_reference(&priv_gref_head); >> + if (cur_ref < 0) { >> + ret = cur_ref; >> + pr_err("Cannot claim grant reference, ret %d\n", ret); >> + goto out; >> + } >> + >> + gnttab_grant_foreign_access_ref(cur_ref, domid, >> + xen_page_to_gfn(pages[i]), 0); >> + refs[i] = cur_ref; >> + } >> + >> + ret = 0; > return 0? My bad, thank you >> + >> +out: >> + gnttab_free_grant_references(priv_gref_head); >> + return ret; >> +} >> +