From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qk1-f174.google.com (mail-qk1-f174.google.com [209.85.222.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BEC8F43E487 for ; Tue, 28 Apr 2026 12:48:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.222.174 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777380543; cv=none; b=ZOvwprHdt6D0w0aCSjvmaSyTsCIxprbDmkYFe+nLJtRm2JeVP24qJwpKAsK/H65goAuX5auIcQETMNrCNEUZYHn6X7AGOVFRPhzErabcX9MkOJPCzFk2iXIjkWjQUeBvg950yySkBgBsAfPA9zbT2qqoOJ00EMqk3LaBeV/oHZI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777380543; c=relaxed/simple; bh=6uQsReytJShRtVwFuY+KaKU4UtffiV2XCyp37o5sVFE=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Ird5YFufb0NmyvLgiYbwTO4xRXXI0ag1mOrU7/vm+eCtiGbxA3/odREhHGZapgz48+ixOlrNJKBlmVvEPMitmr6dHgic/vec3LJgJsSUQYKGvik6c9ImVqxsXxcb6jmXtCVZ2dWsZdFADo/oY9ITA7o+/S6JR0/2T/ogLDvHKaU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ziepe.ca; spf=pass smtp.mailfrom=ziepe.ca; dkim=pass (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b=CP5msS+S; arc=none smtp.client-ip=209.85.222.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ziepe.ca Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ziepe.ca Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ziepe.ca header.i=@ziepe.ca header.b="CP5msS+S" Received: by mail-qk1-f174.google.com with SMTP id af79cd13be357-8eae9229110so1529175785a.1 for ; Tue, 28 Apr 2026 05:48:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; t=1777380538; x=1777985338; darn=vger.kernel.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=rZDznJLnR5IBM+qy2CmcyjeNtRZUzmIeFEkRhR7jVHY=; b=CP5msS+SeFqC0P5r+J8LIGBHHs/4982bjoP4g4YSzw2DuC+chMk5eiGfZRpnxCAqnb D0U/QDSySnpuFyn5z9i1tlzxAmGyMtirfxtPxmtAH5Hev1QpLDYrcPDDawrAeJezbz3k asw8FdWzZQBsXqalnq3g/THCx/Od0M865lnJBoISvgLLsvV1y7V1p4CQBTMMwNSXl3Fn cMKPdtNkFLuM9Gt12QDivSj/vVRWmVXcp/PmKn7iD1Qh+Xp1PkLfjx7Ug9sD9E1lPTTf Z2iKkTzjnZL3XnEujwPdI7Cl9Am8Oz6/dePGOtsFWDkCx9K4r4NNsmpgiS2GC1RMajhV x2jw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1777380538; x=1777985338; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=rZDznJLnR5IBM+qy2CmcyjeNtRZUzmIeFEkRhR7jVHY=; b=LiUr0BkBowSKJjFqIiaAmDORPTIKCyKrBzxmP1xK66zSBasF6jBeOy8+44+zMTuOqv ugPT2qPQzc8YgtDGWo7mD3nBjNf6gQIY2KJGMJh8jIGKna/hDTukTWqBNly1HSvtHdmS X4RzZ/oEDeFbHAzIZeQe5kAYO18ZKSTDmymgU0k35DpnK+3D+S4oDOVjli0M+faG4fcf LaFGF414RhYgwMN4/HlFZDWU1XZVJQPEMv5TYKE6gxv0u3BKySdScbj4Beu2HYfFHjsk Jc8CW4bS/4tgsPHCr81+TwWo937KaQh5Lv884bF8A05UFn1AG7h+jUhGDMjqGqllxAxa ZEqg== X-Forwarded-Encrypted: i=1; AFNElJ9U8NG6eEiXcy3kvJvFYJ6mne4OGk2jD8rNhSourFnbM5l9oVQLROFhbRX+gWEcNyq9iRRYfodfFWrD+MM=@vger.kernel.org X-Gm-Message-State: AOJu0YwIeCgbhO2OKOuO4eRr+Ht2NgGkb0HdlUZrwroqjxr95mmhfjBj ChAhGHuf5tXkv92o9PfcH3+uI/2v4Nm01ABaFtntwlTpYI3rxgIiTdCq+MLWB4//s24= X-Gm-Gg: AeBDiesS8hfitJy2xv7ESzUTiVxdjlIDzCXR9EO+gktkIgc0bFKJnqV+wGy0LJzWQe3 ElhxSTY8CKyjeFL38dJjdKQVuJObQgHlWhb6iliiTPMIgb3H1Spf7QUcRnA2az/kX2qD/k6iegg 2ClC7Ssfy9b95721ebVn/aPzcttZDNT6ckuzXRFSTfSpZr/RtxjIwasmQ7fCyHnrPmBjqqdUx1C OxaQWzQhgffsGxM/6R83h/wdbcEeavCH8HebKgGT93czmm6a7v/78z9ENyWBqPypUj77bsOVmDT ZcuzhMkMHzQP6CdA63z9FySiO9PxnpwlWTOKHCmHNqmGHGJ6oG1fuxsFgapistvRXMu0GA4yV/J E4cb9IgygkmdGSwzhbpzneDm85QPAmSqVmSPshk5fM7g2XRJQG8KrbYW0+ZeQLpN+5vU6fh6bzj JawucGGvjwKV13yL72f/eNAuQLenWsnTbD/vscyfXkET1Uu6IeW2VQQG7xepAtJrRdHlIHbEPLz rOHDJI8aN06heXE X-Received: by 2002:a05:620a:1a29:b0:8ed:2b66:9ec3 with SMTP id af79cd13be357-8f7d72475c8mr387065185a.16.1777380537766; Tue, 28 Apr 2026 05:48:57 -0700 (PDT) Received: from ziepe.ca (crbknf0213w-47-54-130-67.pppoe-dynamic.high-speed.nl.bellaliant.net. [47.54.130.67]) by smtp.gmail.com with ESMTPSA id af79cd13be357-8f7c7cd2c0dsm183064985a.26.2026.04.28.05.48.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Apr 2026 05:48:55 -0700 (PDT) Received: from jgg by wakko with local (Exim 4.97) (envelope-from ) id 1wHhry-0000000AVug-1I54; Tue, 28 Apr 2026 09:48:54 -0300 Date: Tue, 28 Apr 2026 09:48:54 -0300 From: Jason Gunthorpe To: "Aneesh Kumar K.V" Cc: iommu@lists.linux.dev, linux-kernel@vger.kernel.org, kvm@vger.kernel.org, Alexey Kardashevskiy , Bjorn Helgaas , Dan Williams , Joerg Roedel , Jonathan Cameron , Kevin Tian , Nicolin Chen , Samuel Ortiz , Steven Price , Suzuki K Poulose , Will Deacon , Xu Yilun , Shameer Kolothum Subject: Re: [PATCH v4 4/4] iommufd/vdevice: add TSM guest request ioctl Message-ID: <20260428124854.GA849557@ziepe.ca> References: <20260427061005.901854-1-aneesh.kumar@kernel.org> <20260427061005.901854-5-aneesh.kumar@kernel.org> <20260427140539.GE740385@ziepe.ca> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Tue, Apr 28, 2026 at 05:43:05PM +0530, Aneesh Kumar K.V wrote: > Jason Gunthorpe writes: > > > On Mon, Apr 27, 2026 at 11:40:05AM +0530, Aneesh Kumar K.V (Arm) wrote: > >> +/** > >> + * struct iommu_vdevice_tsm_guest_request - ioctl(IOMMU_VDEVICE_TSM_GUEST_REQUEST) > >> + * @size: sizeof(struct iommu_vdevice_tsm_guest_request) > >> + * @vdevice_id: vDevice ID the guest request is for > >> + * @scope: Bus-specific scope classification for the guest request > >> + * @req_len: Size in bytes of the input payload at @req_uptr > >> + * @resp_len: Size in bytes of the output buffer at @resp_uptr > >> + * @__reserved: Must be 0 > >> + * @req_uptr: Userspace pointer to the guest-provided request payload > >> + * @resp_uptr: Userspace pointer to the guest response buffer > >> + * > >> + * Forward a guest request to the TSM bound vDevice. This is intended for > >> + * guest TSM/TDISP message transport where the host kernel only marshals > >> + * bytes between userspace and the TSM implementation. > >> + * > >> + * The meaning and valid values of @scope are defined by the TSM backend for > >> + * the device bus type. > > > > If you want to do this then you have to also provide a way to discover > > what the TSM backend is so userspace can form the correct numbers. > > > > These guest-driven requests end up in the correct VMM backend, which > should already be aware of the scope value to use. In the case of ARM > CCA, the RHI calls include a device ID (vdev_id), which the VMM can use > to determine the appropriate scope value. That seems kind of indirect, we technically support multiple TSMs in the kernel, how does it all get reconciled? Passing overlapping numbers here without any way to tell them apart is not a good uapi design. Jason