Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3715007pxf; Mon, 29 Mar 2021 09:24:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx5MR0ByRI5Wo3jrnuxhT0ILNrDFK1R9os0fvS2LbrF0g0S6dBA0NDXkdiTovzMieHDwb5Q X-Received: by 2002:a17:906:368c:: with SMTP id a12mr16390851ejc.389.1617035097477; Mon, 29 Mar 2021 09:24:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617035097; cv=none; d=google.com; s=arc-20160816; b=U69FAGQkouV3bTzivEn05NR9KWFUujvFVdHY3p3Q7e4c6tMjdbI7WHpikm3KNRPVM3 8rPOtKNkafBDp5pjjQqRohLsOYJV579iDPp0kXY8fbsw1b7ER8/BFCPU7KjjP/k89bk7 wedrLDVpwZgQppV/SEnb7XOUW762rJzFZmzja5wGg2mkT7obaaj/EwXqbS/p0J1Cig/3 fOkeJkptjCWn5JZuy1yGop5x091/cbvG0VPqXXh2AaDNhMacSqwTOvXJYZv62+ez9a8J 9BWViJRK6MyH9HQcjKGx9WrmSnJpZgA0joRDlmQ7W33GHXinGeaY7xIJUwaOxOGWIZAs 3ezw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=jZbWweHIj/iw1Oz6DYxQVEIzp/1xsW8SliME+sloCtE=; b=QJCgflnNfwLq9HTHgfqkFkSHFc3V5APsTheATqvvmAuylUnn/4VDZUqaYDHrpGGLTv LJPFUqzjH9hLxBhioWW193aI4LCQ0GFQcLhvjQ+BZby9mZtu8xyFskfZJNc87CAeakqC FznBhToG3V7mGeD37VjeQHNPQLlVBNbeqEkF2LJFyNPOVXv5T6EKeCV0Y701pKllxjpp 4IXwO8JZApPf6CNiK5a1jdrH6q/sN9vSZ9Ea50+1daFrg3gK28XN5l5K8ywJPWKKBD+9 1tHhoU3WVCJHYxhQrXO6ZUFc0R/7O74WJG/7kSa9s5bqBvRsz0s1eaQrV+VHaUIGc+p+ P02A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=v5BIfzss; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id q6si13335313ejn.153.2021.03.29.09.24.33; Mon, 29 Mar 2021 09:24:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=v5BIfzss; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S229479AbhC2QWZ (ORCPT + 99 others); Mon, 29 Mar 2021 12:22:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41728 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230362AbhC2QWU (ORCPT ); Mon, 29 Mar 2021 12:22:20 -0400 Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 732D9C061574 for ; Mon, 29 Mar 2021 09:22:19 -0700 (PDT) Received: by mail-wr1-x436.google.com with SMTP id c8so13441195wrq.11 for ; Mon, 29 Mar 2021 09:22:19 -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=jZbWweHIj/iw1Oz6DYxQVEIzp/1xsW8SliME+sloCtE=; b=v5BIfzssEyWHaeWvOMenXdg/ShP4omXLwwwTl5P9IiKBjEQEnFCvXfdlcTHvD3rKqt 0QovNRCSLDyrotfiUA/HQPerYJTVXXZjIvB4l0p0RbOPBe7Grd+xLRumEu1CAAkJXJA7 ApNJ3UKtdnvwVvy0YUiV8fgal7daW7pKYF3YVVmTSTlJ/kxHo/ZEzxneQUs9ED8GMdge lp3H0XDfAg/P+mq4iEoF7EEZfv7RBSpXJWp5miiHTYwnlxyYJm2GegL7TYmfTrUebA6L BYBxL7GmPjL1SdVurioHfx1F/Y6urULxFiWxeQYwNL3mBB88QDBDeAPP33rPLANH7b2G 98Jg== 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; bh=jZbWweHIj/iw1Oz6DYxQVEIzp/1xsW8SliME+sloCtE=; b=EvNs07LzIPQftgE41YKKuCS10irV+WgPE7+H7bY8ve699VACf9WreildMt+5ymtFCi qpJwMMDpS7EeiDhQdiHuetw57ZBzMY4Fxjtw+aUbASLrmdqpW8mXe2iJ0mXxTQz2vMzv 6k9wQlJBwQDMbMAlTe/74HdeRCVLLYZ35AHuCGqTKoikzomk/kntJ9RBZCDmieHKxUsC cqxsYGDCT+xOU7HPannOblR1oGiPVw9I6iUjzH3slEGVKfJn4k+fxsffJ15U7QVY8o6n dOiT82rI9E4EOYF0q2TGAEUy262qzAj1GvhwDIm3Qf2M8zUBScMFEPcJ7mNt2TVFXEDg 4QTw== X-Gm-Message-State: AOAM532R7MYzZZcWffatmDybPrA2AsDjPu4NYOvDJLSRFGUWbv4c/XlG tH/bB8CuQFsrHgdYUkb7PhOzmg== X-Received: by 2002:adf:e582:: with SMTP id l2mr29775270wrm.207.1617034938172; Mon, 29 Mar 2021 09:22:18 -0700 (PDT) Received: from myrica ([2001:1715:4e26:a7e0:116c:c27a:3e7f:5eaf]) by smtp.gmail.com with ESMTPSA id v18sm31545369wru.85.2021.03.29.09.22.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Mar 2021 09:22:17 -0700 (PDT) Date: Mon, 29 Mar 2021 18:21:59 +0200 From: Jean-Philippe Brucker To: Vivek Kumar Gautam Cc: linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, iommu@lists.linux-foundation.org, virtualization@lists.linux-foundation.org, joro@8bytes.org, will.deacon@arm.com, mst@redhat.com, robin.murphy@arm.com, eric.auger@redhat.com, alex.williamson@redhat.com, kevin.tian@intel.com, jacob.jun.pan@linux.intel.com, yi.l.liu@intel.com, lorenzo.pieralisi@arm.com, shameerali.kolothum.thodi@huawei.com Subject: Re: [PATCH RFC v1 13/15] iommu/virtio: Attach Arm PASID tables when available Message-ID: References: <20210115121342.15093-1-vivek.gautam@arm.com> <20210115121342.15093-14-vivek.gautam@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-TUID: x5lqDTusQD9a Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Mar 12, 2021 at 06:59:17PM +0530, Vivek Kumar Gautam wrote: > > > + /* XXX HACK: set feature bit ARM_SMMU_FEAT_2_LVL_CDTAB */ > > > + pst_cfg->vendor.cfg.feat_flag |= (1 << 1); > > > > Oh right, this flag is missing. I'll add > > > > #define VIRTIO_IOMMU_PST_ARM_SMMU3_F_CD2L (1ULL << 1) > > > > to the spec. > > Regarding this Eric pointed out [1] in my other patch about the scalability > of the approach where we keep adding flags in 'iommu_nesting_info' > corresponding to the arm-smmu-v3 capabilities. I guess the same goes to > these flags in virtio. > May be the 'iommu_nesting_info' can have a bitmap with the caps for vendor > specific features, and here we can add the related flags? Something like that, but I'd keep separate arch-specific structs. Vt-d reports the capability registers directly through iommu_nesting_info [2]. We could do the same for Arm, copy sanitized values of IDR0..5 into struct iommu_nesting_info_arm_smmuv3. I've avoided doing that for virtio-iommu because every field needs a description in the spec. So where possible I used generic properties that apply to any architecture, such as page, PASID and address size. What's left is the minimum arch-specific information to get nested translation going, leaving out a lot of properties such as big-endian and 32-bit, which can be added later if needed. The Arm specific properties are split into page table and pasid table information. Page table info should work for both SMMUv2 and v3 (where they correspond to an SMMU_IDRx field that constrains a context descriptor field.) I should move BTM in there since it's supported by SMMUv2. Thanks, Jean [2] https://lore.kernel.org/linux-iommu/20210302203545.436623-11-yi.l.liu@intel.com/