Received: by 2002:a25:b323:0:0:0:0:0 with SMTP id l35csp45796ybj; Thu, 19 Sep 2019 10:25:21 -0700 (PDT) X-Google-Smtp-Source: APXvYqyK3R2+7y6xgpnMvJK92zh1vfXUiVB1XWwh6tsZporVrLykalBA7fd6ks1ZYWibVwaW7KYD X-Received: by 2002:a17:906:1394:: with SMTP id f20mr15852061ejc.274.1568913921745; Thu, 19 Sep 2019 10:25:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568913921; cv=none; d=google.com; s=arc-20160816; b=SFBwIbrwmLJVEFE+vl8uOZMhjYIryhQwlD6qUchumfxpBhwFPyWElZv4J7sj7/HOEp ev4wbkKoYrOilow58GFZaTQ3zyGX51lGpdQ/KMrGL+cwqdXxDvw2pvsz3UmvHBj6KTo4 /ckNz0TfA2HnAPO8oh45mgyZ9vg9T7AxC/PPbnU1KhfcAbfc3/VeOJsU77BMt/ZiQNCf vdZRuIHvIw4fH3usuetyot++RLtqHE6WffKQkx9eaLB9aRcKvs5RTGxOSVFKQGPAth5g lkNyJ7SLdJWKy+D4WlrxWA8G+e6lJV0LWT5eXOwqead7sC5MV6PvCk/TnGZbNk0Pc7Su tQwg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=KzQTk6xzLzucmWYoRU1s1qEtj1rE5wSKjOBqxGDWi/o=; b=JS9RCz7x7SfmmRZiXOoiLnElVh1zX02h/K3id1Mf+5mUJu9ywuMrmL78ZnSb3Y9Nqm wxwHCng7YXXPe2s5ToUdOj9nKQWhbczv3hqziCUmv5QFHEUXdSNlOwekfIyAAX649yt3 a/GTomf0lbIEA2SUpQka4sSjuDglcsCHXvDQLpJMFMu7r/trHi5XXhCd8tzopbjs6Nrr TX2La/vjnfQ84GzZW+tj7dc2GJIkLJzdPGnUSX9qJG4gBwmD8pXTiALz9gslm90SPYiC 5BCyyRn65fZCPpmMNnLlzunfmYZgXunv9U7esfUCjtCfOvQAyEUQA0LCAJtMsuBgI4qz 8xXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gFhPQZUt; 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=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c14si5551576edc.81.2019.09.19.10.24.58; Thu, 19 Sep 2019 10:25:21 -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=@linaro.org header.s=google header.b=gFhPQZUt; 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=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390869AbfISPBq (ORCPT + 99 others); Thu, 19 Sep 2019 11:01:46 -0400 Received: from mail-ed1-f65.google.com ([209.85.208.65]:40618 "EHLO mail-ed1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390849AbfISPBo (ORCPT ); Thu, 19 Sep 2019 11:01:44 -0400 Received: by mail-ed1-f65.google.com with SMTP id v38so3490831edm.7 for ; Thu, 19 Sep 2019 08:01:43 -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:user-agent; bh=KzQTk6xzLzucmWYoRU1s1qEtj1rE5wSKjOBqxGDWi/o=; b=gFhPQZUtwgWrCpL+lfpRPt59XpuIEnB98c1kiyEq+ontzS1nT6THLM3v60XXSiiotI 2hdM97Jp9Im9zb2prqtZ/Aqt5igaCx+De8KULA2DUqDHvZNCmqg7sY5NotIT7BO4ZVGZ NMXP0fwNtJF3kjd0+cx2ZH3Y0EuIbqYe/R/8WS74kFPM2RRv0U2rnGplh5k2BBbjVMSL AQNDV/6Ovn9dmPVN2mnJpyNLagnJRgjCfQRn8lVxn1yT47GHBHHR+Yb331ZtpumZ7oXx jRv77JQKQog4T53rFFKSYbM4Rs6GI674XoL6AR6MTapjm4AMv6R22A/Yfbwx4T6f6eXN /Isw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=KzQTk6xzLzucmWYoRU1s1qEtj1rE5wSKjOBqxGDWi/o=; b=QTLwR1VTAly02jIkRDBFbqGXvlBwnM1nwqTJFP1hYq0ZhofmCUd7sF+8k6cB5xSLVP /ik1zyLrn7aUIFNqYeah6XmpWfIFi9DPJpYqdBQ15a4/iANIcly7AhVtdNC0PZH1jJev uhim4UXnfW6c8vynKPYMRg2bTQN2O3+uYOCOnG+2mWH23H4duihZNf5soVjK1zbOQU7O S8XApd7cNZe3e/zy4ZIXV3CDGwy6NT4FNITsf6lU9WSbcgpiEhQGRA5OdxN2AWlIsUng b22lbtMMPfuyZNlfyc7FS8LUBN89uC31Icn3b0S4U72BawOqDon8iIxGa+SsFyHAvUNg /KRw== X-Gm-Message-State: APjAAAWPitus8JWnPxM9AkbqoInj5/ixdnQOeNl0zjt+qPGfY8O4+K/X Q/SmeqqeI39iTolCTW/DAZeYJg== X-Received: by 2002:a50:d5c5:: with SMTP id g5mr16735289edj.57.1568905302153; Thu, 19 Sep 2019 08:01:42 -0700 (PDT) Received: from lophozonia ([85.195.192.192]) by smtp.gmail.com with ESMTPSA id g8sm892232edm.82.2019.09.19.08.01.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Sep 2019 08:01:41 -0700 (PDT) Date: Thu, 19 Sep 2019 17:01:39 +0200 From: Jean-Philippe Brucker To: Auger Eric Cc: Jean-Philippe Brucker , will@kernel.org, mark.rutland@arm.com, devicetree@vger.kernel.org, jacob.jun.pan@linux.intel.com, joro@8bytes.org, linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org, robh+dt@kernel.org, robin.murphy@arm.com, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH 4/8] iommu/arm-smmu-v3: Add support for Substream IDs Message-ID: <20190919150139.GC1013538@lophozonia> References: <20190610184714.6786-1-jean-philippe.brucker@arm.com> <20190610184714.6786-5-jean-philippe.brucker@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.1 (2019-06-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jul 08, 2019 at 05:31:53PM +0200, Auger Eric wrote: > Hi Jean, > > On 6/10/19 8:47 PM, Jean-Philippe Brucker wrote: > > /* > > - * We don't need to issue any invalidation here, as we'll invalidate > > - * the STE when installing the new entry anyway. > > + * This function handles the following cases: > > + * > > + * (1) Install primary CD, for normal DMA traffic (SSID = 0). > > + * (2) Install a secondary CD, for SID+SSID traffic. > > + * (3) Update ASID of a CD. Atomically write the first 64 bits of the > > + * CD, then invalidate the old entry and mappings. > Can you explain when (3) does occur? When sharing a process context with devices (SVA), we write in that context descriptor the ASID allocated by the arch ASID allocator for that process. But that ASID might already have been allocated locally by the SMMU driver for a private context. As there is a single ASID space per SMMU for both private and shared ASIDs, we reallocated the private ASID and update it here. See https://lore.kernel.org/linux-iommu/20180511190641.23008-25-jean-philippe.brucker@arm.com/ > > + * (4) Remove a secondary CD. > > */ > > - val = arm_smmu_cpu_tcr_to_cd(cfg->cd.tcr) | > > + > > + if (!cdptr) > > + return -ENOMEM; > Is that relevant? arm_smmu_get_cd_ptr() does not test ssid is within the > cfg->s1cdmax range and always return smthg != NULL AFAIU. It might return NULL with patch 5/8, when we can't allocate a 2nd-level table. I can move the check over to that patch. > > + ret = arm_smmu_write_ctx_desc(smmu_domain, 0, &smmu_domain->s1_cfg.cd); > cfg.cd Right. Thanks, Jean