From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f172.google.com (mail-pl1-f172.google.com [209.85.214.172]) (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 AD7CC35836B for ; Mon, 6 Jul 2026 22:04:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783375451; cv=none; b=I1LohT6svCemO7vkggaix7gtNoN6e3I/tGSyXkGpo7aYJ6fBU22i1yn+bKPrdT4ddycYJlLjehi4IeCir0HEPjT1SDsyupymnmUYv82SwCJ9IdgutJs5SzZc18x9TW5S2LIJS+lpx/p+g4GmfjcdU24ElsqdtNslmTuxCE4vosY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783375451; c=relaxed/simple; bh=rLy/ysj5tbpERefiVlqo7Up7k2XPDa6wDyapX0dgtAQ=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=NXtAynNg7Eue4IyXVwquESJXqdYc2bjXblaM1IKXR5POTn41yf4eGUIuZ7t3YtzJqzJ2A8QYE+sqE85pSdjVvMCl7uBUToW2q2OGXi+v1xrQvncEnYOX2P4Y1pMZTH/mz+TsH0c6i3JSvzWba5eEB3iwXQsrpjJC5Z574k8NXNc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=RFfpI5LL; arc=none smtp.client-ip=209.85.214.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="RFfpI5LL" Received: by mail-pl1-f172.google.com with SMTP id d9443c01a7336-2cae134bdc8so19268575ad.3 for ; Mon, 06 Jul 2026 15:04:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1783375450; x=1783980250; darn=vger.kernel.org; h=in-reply-to:content-disposition:content-type:mime-version :references:message-id:subject:cc:to:from:date:from:to:cc:subject :date:message-id:reply-to:content-type; bh=ExF2e/cXpRQsXQR0TRuzWP6MSTLDs8ljOSl9uaYcPTU=; b=RFfpI5LL9CeFLidDrLl0FoW4hdPY0VRDS3QcnJ+clGW9WvEdLWCbXf5J92IQaigrL0 Bp2yCFakukTmmVAeM6ZeL77QMcc1fuAoIEuR6crhbkkApmqw9D+jN7f1QHWJvW5OVEpH HMKrIENsTn+MC7NUTKuJDYjpGtSn++j3fihYwBAyAwtNYsWCciQQ2k35Qq/3TlLootZC QWk1MTX627gzw34S731LWLEO7OtwnWzZDfC4rJzuaQ4IBgCZzwQfoQjLBmdo9Fd5iEQu UuuCdoHxTO1Stpoqw4pKcg2hSFefko4jeIiEQyJjzXTXDAI3L21m66dCXTiOVDpnycmx vePQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1783375450; x=1783980250; h=in-reply-to:content-disposition:content-type: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 :content-type; bh=ExF2e/cXpRQsXQR0TRuzWP6MSTLDs8ljOSl9uaYcPTU=; b=KcejuIjd2qNmdaWVDHGwzHuDkurpQSk6IWLDrTm0Zbx/BckE2GRIWZ0VpbRmXl8L2c +5Ct0G++bBwFGeqIWVCLo/zsA1osKQ2ub1S8QpShaChlLlKWi9niwXMeUJSB340vxys4 Gwk7eLSwL3qMIpr2rkRec7HEgSUK75/Lld/CoMEq/g/fHaRRQB9Y969vBzoiYPtFyJDp y6wnKlOfJSthTcY9j558Oh+/xuDDfajW+lg8QftAiGmyMzjTHbVjTfoB+zQfOlGTsdLM KED3LOSHo/MyGZ3Dj88vPZKjCZ9d5MDKAgmODZYnXhskB3f46xPLoKZBqcl72RoGEkoz hH/w== X-Forwarded-Encrypted: i=1; AHgh+RolFXtvjlrTOsjwXXTobsSmzIenJLupKBL359GnDMOqzyeMB0svIDsKg82ONUYkIzjh/IXXKRoe30T6idY=@vger.kernel.org X-Gm-Message-State: AOJu0YzG0rnb2wW4A1x4EZ1/14n8GTUvCdOMjTGvNzsP8A57ME1A1Hrl NSOqQ9/S+/M/MXTXj4DaImRLJ9yOWmpOZJrINQ1HM/As9weA8B8d6HfUj2Y2kxTLRQ== X-Gm-Gg: AfdE7cn56xNdvpSADatUKqYjCfOjxsYhzcRn4nMOLh1B3A1cpzCwlRC2hVWQ/N5Tpgk LDOqcPq6lkWyNgC5HiXZJsGEjANEM8mylURgMo0gZCGg4K8PMZ+s5HPqkLts2G6Q3p1tmJhmbci HX5VbhlMKDeTkOycOUfjoiWvGXlp8HTrjJV888cLR3CRvI3RUnFgFC3Wj/MDbfrCDjlzmSwoVrX w5UAYMhmhe4QjtduEWtRXa0sxrA1q7ozxC8/qN3LPAGTYpEvOcrCpngQbaI18NzbaGwnLBvmP3Z X1+8j7kIGmFBonntpcZOjR2DMF40SF+89x9Azyyy1jY7kQ8FtRHd2dURhugBhBQQWg3wjNnq/pI OuT7nz7R3bi9IHQpKb3+mH7EYV6obMCN++FcnByQW8YBiHfomQhvOoIz/u0OZm9hXNwrnOijnjM Y+P2gl9vRM/EPwdF19RuOePqNv3cb65zlJi6ut+1kf6sV8OSNSaiU= X-Received: by 2002:a17:903:3d0f:b0:2c9:b48c:fdde with SMTP id d9443c01a7336-2ccbf057775mr26873645ad.26.1783375449431; Mon, 06 Jul 2026 15:04:09 -0700 (PDT) Received: from google.com (56.149.168.34.bc.googleusercontent.com. [34.168.149.56]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2ccc9bf8c12sm1075785ad.26.2026.07.06.15.04.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jul 2026 15:04:08 -0700 (PDT) Date: Mon, 6 Jul 2026 22:04:05 +0000 From: David Matlack To: Narayana Murty N Cc: alex@shazbot.org, shuah@kernel.org, amastro@fb.com, rananta@google.com, kvm@vger.kernel.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org, vaibhav@linux.ibm.com, sbhat@linux.ibm.com, harshpb@linux.ibm.com Subject: Re: [RFC PATCH 3/6] selftests/vfio: add sPAPR TCE v2 DMA window helpers Message-ID: References: <20260703032806.40946-1-nnmlinux@linux.ibm.com> <20260703032806.40946-4-nnmlinux@linux.ibm.com> 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: <20260703032806.40946-4-nnmlinux@linux.ibm.com> On 2026-07-02 11:28 PM, Narayana Murty N wrote: > Add helper support for sPAPR TCE v2 DMA windows in the VFIO selftest > library. > > Track the platform default DMA window separately from selftest-created > dynamic DMA windows. The default window is discovered with > VFIO_IOMMU_SPAPR_TCE_GET_INFO and is not removed during cleanup. > > Add helpers to create and remove DDWs, return the active IOVA range, and > register/unregister memory around DMA map/unmap operations. Window > selection is done before IOVA allocation; the map path only validates, > registers memory, and calls VFIO_IOMMU_MAP_DMA. > > Signed-off-by: Narayana Murty N > --- > .../vfio/lib/include/libvfio/iommu.h | 18 ++ > tools/testing/selftests/vfio/lib/iommu.c | 273 +++++++++++++++++- > tools/testing/selftests/vfio/lib/libvfio.c | 2 - Let's move all the spapr code to its own .c file under lib and only compile it on powerpc, and a new header file so that the code in iommu.c can call into it as needed. Please also avoid adding ifdefs within function bodies. The generic code in iommu.c should unconditionally call spapr routines and those routines should be stubbed out on non-powerpc architectures.