From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1D601C433F5 for ; Mon, 11 Oct 2021 09:19:39 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E4F8B60EB6 for ; Mon, 11 Oct 2021 09:19:38 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org E4F8B60EB6 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=J9J6pOH4uV+I4Rwe91yuRkkpbrpbx3NkGTxocR5jDtE=; b=2e8pZ1UgC1d64Z WzC6zuqNGYWprM5m9xC6kT7pDGM9+k3Xew1llwH9gyNAzf1nmCSoal6z/Twad5E1FCWhPkWueBQ4X 8IVQwQ/qxCEUQ3bsKR4R7FeEPLuYHM99uP8rFhZz45Qh9Bd66yJZftjkStikDm6b6FKQMtjE57loE H4RNT/bUnMzEdggVQvk9TQbR2osfI68WH3A9KrKO7iP6bgko6vnyy4TGE6YTU9kcU2UoIEBSuUB1f ld0sNE6tudPqh0iqzvKAckJMFFZXNGyBOMW2VZOS8BBhDLT2obXrpWUJxsIY1O2rqqB6gcEYtfrhG 0lhyvPnwE0SU9jLuqhSA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mZrQZ-008VHE-PS; Mon, 11 Oct 2021 09:16:59 +0000 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mZrQV-008VGc-IJ for linux-arm-kernel@lists.infradead.org; Mon, 11 Oct 2021 09:16:56 +0000 Received: by mail-wr1-x436.google.com with SMTP id r10so53942321wra.12 for ; Mon, 11 Oct 2021 02:16:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=0nkxjPYEpK6G/BSPxshK+If3Vx5Dign77+8NPOgdp5A=; b=o5bhT6O7zjOThtxY/SJmo4tsUFG2/zdzUm67PXqH2uM3Esme6jlzv21/ETV6z4c7RR wzk8ZM9TcGX+XY6xe2WX3EPIG5a8uot5ytWGlgBDE+cXGvtHArsho3kAovfIYHDvBBMT EmqoNKrLNr5HvSpSfSUoAD+YZa/+XjXLE7bIok+S+QqWx699qRA/778xoMcmdT8TNzQi 9+Ed+xbGf0D/DcsbK7tM/jj8umMxvEla2ovIJULkjMPNVZ9uo1HYBO0KieMZguX13pfQ xNVC1AxlTATx4mu/mfVe6OYfPdJ3kiaOfm6cOUOakTMFchkCtVp7AKjIxMPCOlagfxXg 7LWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=0nkxjPYEpK6G/BSPxshK+If3Vx5Dign77+8NPOgdp5A=; b=IstF67+m2BGHz6IqizGS3jocl6fnE7OEoCUigQSRCwj0qhtDpSNYD5vEoXgsrU1lR1 OXBTMPt6wMvaS8Sfe9w54amQ+qyWfWNWjlmUmWfcLjLDvzOqEMOheIKXrxQss0KGTPmw nFGr74ONktt7bhikjbG44EQWAZPby4+Htqa5Skz2fFmz32vmgFpiuYQisRjbusdwp3DZ suabAUJiv1KF9MbZDtarIdsN2y09Q+sqnYiZRvZ1cNB+FBci2OHp8fbktT+5B7XZaeRC n85ZzwgQscAuICPXdSh7X2mBV+Zfc9YbbHN7oKsJDgqRFQ+ott5IYf8DsLVUnthvRPpg DteA== X-Gm-Message-State: AOAM530LhKTsn+ihNRvkjokcwYsOl16gzWRw1YS5FGjxtv2A1FVhYbE8 Zk+KWpU5Ol+O50oqXRRZcsl8hQ== X-Google-Smtp-Source: ABdhPJzmZPpxlzZgyZ5KgwS2WYv6prD2WVEkkWH0I0HXdlYIksxaPY0vrb+dREOxa4LLg5+rfZGlMQ== X-Received: by 2002:adf:bb8d:: with SMTP id q13mr23299307wrg.327.1633943814314; Mon, 11 Oct 2021 02:16:54 -0700 (PDT) Received: from myrica (cpc92880-cmbg19-2-0-cust679.5-4.cable.virginm.net. [82.27.106.168]) by smtp.gmail.com with ESMTPSA id v185sm15278013wme.35.2021.10.11.02.16.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Oct 2021 02:16:53 -0700 (PDT) Date: Mon, 11 Oct 2021 10:16:32 +0100 From: Jean-Philippe Brucker To: Vivek Gautam Cc: "Tian, Kevin" , mst@redhat.com, Will Deacon , open list , virtualization@lists.linux-foundation.org, "list@263.net:IOMMU DRIVERS , Joerg Roedel , " , Robin Murphy , Linux ARM Subject: Re: [PATCH RFC v1 03/11] iommu/virtio: Handle incoming page faults Message-ID: References: <20210423095147.27922-1-vivek.gautam@arm.com> <20210423095147.27922-4-vivek.gautam@arm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211011_021655_631600_FDF954D0 X-CRM114-Status: GOOD ( 18.40 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Vivek, On Mon, Oct 11, 2021 at 01:41:15PM +0530, Vivek Gautam wrote: > > > + list_for_each_entry(ep, &viommu->endpoints, list) { > > > + if (ep->eid == endpoint) { > > > + vdev = ep->vdev; > > I have a question here though - > Is endpoint-ID unique across all the endpoints available per 'viommu_dev' or > per 'viommu_domain'? > If it is per 'viommu_domain' then the above list is also incorrect. > As you pointed to in the patch [1] - > [PATCH RFC v1 02/11] iommu/virtio: Maintain a list of endpoints served > by viommu_dev > I am planning to add endpoint ID into a static global xarray in > viommu_probe_device() as below: > > vdev_for_each_id(i, eid, vdev) { > ret = xa_insert(&viommu_ep_ids, eid, vdev, GFP_KERNEL); > if (ret) > goto err_free_dev; > } > > and replace the above list traversal as below: > > xa_lock_irqsave(&viommu_ep_ids, flags); > xa_for_each(&viommu_ep_ids, eid, vdev) { > if (eid == endpoint) { > ret = > iommu_report_device_fault(vdev->dev, &fault_evt); > if (ret) > dev_err(vdev->dev, "Couldn't > handle page request\n"); > } > } > xa_unlock_irqrestore(&viommu_ep_ids, flags); > > But using a global xarray would also be incorrect if the endpointsID are global > across 'viommu_domain'. > > I need to find the correct 'viommu_endpoint' to call iommu_report_device_fault() > with the correct device. The endpoint IDs are only unique across viommu_dev, so a global xarray wouldn't work but one in viommu_dev would. In vdomain it doesn't work either because we can't get to the domain from the fault handler without first finding the endpoint Thanks, Jean _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel