From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qt1-f173.google.com (mail-qt1-f173.google.com [209.85.160.173]) (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 78AF430C153 for ; Fri, 15 May 2026 18:23:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.160.173 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778869406; cv=none; b=l8vAIylA26ilYJeAkhb4IFXgOq0nWa3We0I3aKjMUJ0oyuEWK21tI3ty3JfFJHCY7VYdyPV6FBAdeuu2gr4R61hem4AKUfCDu2aiP7UAnxtLXn5Fs9P3c3PwQi92gR9rVwkCqwCS+52NzdmPYqJkmk4lgHODBvSMbaLGKgF2Bm4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778869406; c=relaxed/simple; bh=gMaEvicj1lkTTKjknQzylRPd7tw3CbzIlWyBBZkqlhE=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=uLvhb847Z7VWF22ZA8KBDo8/mWiP0gfJvxDEdfCqdsitXMDurLNtGcceslgAjlSGbC1FCNyU+/DNlDoFbpAToJU//HRWcu/NWguhXAOdW97Si/zeWzCxqlp2tvp3VK09ukwNWoDRDsSaFNh6fY2VvZpi3gs5R82b4RDfg3VbAjI= 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=k9ar4Jio; arc=none smtp.client-ip=209.85.160.173 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="k9ar4Jio" Received: by mail-qt1-f173.google.com with SMTP id d75a77b69052e-50fbd79350dso2070211cf.3 for ; Fri, 15 May 2026 11:23:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; t=1778869403; x=1779474203; 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=OQNJjeOCe7S+U51t5FVhB76I4sx7yhCYVtg8gepAxec=; b=k9ar4JioCr7PMwm3IFL/V1gS4qbnNYXjESygqFknkEVOcMtvBp/ZLENxK/R++emVRS Ezlr+J3zGCYZXg50ek9wta6Z6s/ldjH3ggZVY7lqfdXIrjCmccOJgblHHMKaVLVgVgCO +pX6bFf2RIXeTU5g51Ph/PYUyTKt3Uq24hiX0kSTM2eZ6lwCTTv/GpRe+iJgEqNXqEhc QPdVrO0M5CW162/CFbdXxDuzMAekPO2u6Yy1n27LXZLRm7NQxIRv8sfhQCmsg/xlRmW2 r05yl1IH8n17wu+9EyyqOEzId4pnPcvi9IXVSzivi9ikr+mLdfhVYupevfbB1XoGYyH6 Rzzg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778869403; x=1779474203; 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=OQNJjeOCe7S+U51t5FVhB76I4sx7yhCYVtg8gepAxec=; b=SXk74KQnM2sMRsTLIu6bvpqNOUE3spN1yHwU3eH9lhez0Ms1KxK7iiLYPg3IciCWv5 LcyV6FpyHvOsDVSLhMWH91/oCIu/cKfgL1Mv+nhO5h70jAUS97l5UVwPL8C/5148lh6/ ANsy/ArKUDJMCns7eFWSbA4hvHJjIO4GsE8rsP4zDLKuD2tGOUdBpW7T3SC5/eqlghEK 0OVgwbVk9g2kCwH0M5JiUdM2e7EEComm/SP5ayLSunZAEKoA2cOz8moqaeEnUnNK8Q4O YrsoHtIT5TluXcRf3gpSBZDnJxJGj5DEU9SX0YNft+l2aC0x37oIroWshZSkIwzvhnR9 DkYg== X-Forwarded-Encrypted: i=1; AFNElJ8IXZ3GJw40+hLUtYyec0xJAlx7f8LFU6sHgUOVbSBSVGwDTHCeOlNEeT5a1mbzXlGp7wNO8s3Z00o=@vger.kernel.org X-Gm-Message-State: AOJu0YxVed2MKoZPDgIeziX6qAohzfZT/WQ3wXfJn/6dzSE1gwObRHOR 07ocdyN1jbvW74e/K5zhesWJYJ1QXp8kCCQ1BklhnG/lm5J3CBxHhqGaKx91ZWXtiNE= X-Gm-Gg: Acq92OH68wcMmHOTYo4WVcV257njp36Xr7yFQ9kk+N7M05wlCEMOK1XNX4jL+JBtdY1 hiOZfHfZbEOaKVuej0WpFot9PvewRej4cQin7xAzVs6tu5GSpNLvWPEUXQelwkhuZ+UcxUMItiU nJONeW+Fw8Nrpx9nIFSvBz/NLPRoya3aPcP4BN8P2qzFVHqcQMkfc+oL8+PEzmCbMMxoNBkQyVT 9aoSkO8RvMxEBS3RMFQeqoS6mpda09UCf2ApGeUcOloiJd6wpFF+QqvLhWXfBJ8RFbK61cc4qRs 3otnMu0p/3hysA1D9pp7Bm9js4cDNLPAxpK23V56Id//B08xuiur06rZOse2S1SRbx+iB5KndH7 pTP9PiXs8RSHBZmvrymoewhOTpjoDYYtIsIaN+6bGbEjG9cBpHLJ4Q0h5qS5lxicpk59Dz3GrjD gwYNHkll4KgO0VHxlFAwPuxHrRMzQmBOw+r2rsr1P9KHcXDOL31boRmf+SOgvlRKo5GAEiq9WJ1 Vr2Eg== X-Received: by 2002:ac8:5742:0:b0:509:2858:3c63 with SMTP id d75a77b69052e-5165a0703c1mr72758491cf.23.1778869403362; Fri, 15 May 2026 11:23:23 -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 d75a77b69052e-51645801211sm50772901cf.20.2026.05.15.11.23.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 May 2026 11:23:22 -0700 (PDT) Received: from jgg by wakko with local (Exim 4.97) (envelope-from ) id 1wNxBy-00000007tTG-1fso; Fri, 15 May 2026 15:23:22 -0300 Date: Fri, 15 May 2026 15:23:22 -0300 From: Jason Gunthorpe To: Mukesh R Cc: hpa@zytor.com, robin.murphy@arm.com, robh@kernel.org, wei.liu@kernel.org, mhklinux@outlook.com, muislam@microsoft.com, namjain@linux.microsoft.com, magnuskulke@linux.microsoft.com, anbelski@linux.microsoft.com, linux-kernel@vger.kernel.org, linux-hyperv@vger.kernel.org, iommu@lists.linux.dev, linux-pci@vger.kernel.org, linux-arch@vger.kernel.org, kys@microsoft.com, haiyangz@microsoft.com, decui@microsoft.com, longli@microsoft.com, tglx@kernel.org, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, x86@kernel.org, joro@8bytes.org, will@kernel.org, lpieralisi@kernel.org, kwilczynski@kernel.org, bhelgaas@google.com, arnd@arndb.de, jacob.pan@linux.microsoft.com Subject: Re: [PATCH V3 09/11] x86/hyperv: Implement Hyper-V virtual IOMMU Message-ID: <20260515182322.GI7702@ziepe.ca> References: <20260512020259.1678627-1-mrathor@linux.microsoft.com> <20260512020259.1678627-10-mrathor@linux.microsoft.com> Precedence: bulk X-Mailing-List: linux-pci@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: <20260512020259.1678627-10-mrathor@linux.microsoft.com> On Mon, May 11, 2026 at 07:02:57PM -0700, Mukesh R wrote: > +static struct iommu_domain *hv_iommu_domain_alloc_paging(struct device *dev) > +{ > + struct hv_domain *hvdom; > + int rc; > + > + if (hv_l1vh_partition() && !hv_curr_thread_is_vmm()) { > + pr_err("Hyper-V: l1vh iommu does not support host devices\n"); > + return NULL; > + } > + > + hvdom = kzalloc(sizeof(struct hv_domain), GFP_KERNEL); > + if (hvdom == NULL) > + return NULL; > + > + spin_lock_init(&hvdom->mappings_lock); > + hvdom->mappings_tree = RB_ROOT_CACHED; > + > + /* Called under iommu group mutex, so single threaded */ > + if (++unique_id == HV_DEVICE_DOMAIN_ID_S2_NULL) /* ie, UINTMAX */ > + goto out_err; > + > + hvdom->domid_num = unique_id; > + hvdom->partid = hv_get_current_partid(); > + hvdom->iommu_dom.geometry = default_geometry; > + hvdom->iommu_dom.pgsize_bitmap = HV_IOMMU_PGSIZES; > + > + /* For guests, by default we do direct attaches, so no domain in hyp */ > + if (hv_dom_owner_is_vmm(hvdom) && !hv_no_attdev) > + hvdom->attached_dom = true; What are you thinking sending something like this?!?!? The function is called *alloc domain PAGING*, it does not, and can not allocate weird "special" domains that are not PAGING domains. I just spent a long time removing all this kind of crazyness from drivers. There is alot of other things I don't like in this patch, but this is too much. You have to drop this "direct attach" idea from the first iteration, Linux can't do it without alot more work, you should start with the basic paging domain mode. Jason