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 78B3A30C165 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-50e63771d91so2175961cf.0 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=bHXrFhaJyOZhINibNK2YHcSnuhNiF8wipT5qyRX3fD03ducWw0PnDfTrmE1nOxr9H9 lVDzAbG6446HCjtW7fcxPo5q40LHTZb9KEz2p0qeuTUMDqojvmFGN8W13Sc0NjRBApPf FNtU1pRlasjeRm/6xFrEGWlyk3FqpFFssHrvBAIkbpalBxHlnriLIAcClGOEhBfK5HuI fhXTe7amYmzXtk9nb/GN9AfaOkRmutiSSfkvWtM/OuKASsp2qvfqoNcwIMt7fIChjzA8 gIOofldobTyZHiFuVANddikfgZYTRWNeUodcW6Qcw3/x6uEeJ/q7rbqZL5vMmlVGkuNS LQ6w== X-Forwarded-Encrypted: i=1; AFNElJ92t8776liVkjjbf0T/Yhsap++SHZSaYL8LeVDhBLN+WBG03vEXgliamCdabDO0RC38WNUZVYBpSJw1ikc=@vger.kernel.org X-Gm-Message-State: AOJu0YwXbCo0bwHKGw7s3M8gtMiYOQfjCgdNgJKAzzq7mqjT+ShBc4mE WsDhVpefDUc72ZJDgcn+iobNOwu5WSdjDTNKHKvfZUegZNT4W9OuNatdzUIyk4c3W8A= X-Gm-Gg: Acq92OHh0MN1AARWbiFI6Zp8Q15V6byZTpcTmgUoW7QQ3VC7uHzhc2cgK3jCiTKp7la Y5e5/oAU4oV/O34ptlSm5quFVp9IQRqMWnrBNcx4EXBdFegZCuQCnwJPcKMeUzL6ePSvleEBIvV 8bn/5uYYPXukW526681hKqUqtYa0d/no1FpnsiCK/EhOWVlNScBpYuJ9WWkYkWYIevASQi2IFAF BfHidpy7r0IwiZ1n2CO0k3EogJjlRoO8XJz1Ga9/ONKwEveh5852Ppt9aIth0XCyfNFKdgU3oJA 5YE9UHgtdgzesOvM39/3jJiolqX80M6H2khIk3UjIJaKpiBXPsn6w3tcARXrzJmlZ9f5VWdWHkV e5X8pswOGLLfVkPDITZnn7le9bErafLpuwXkdEpTEhbjNhqZ4g5bO03RVG60/5XU65BKwjUx8gk xT2kjXLDd9aMtRMvsjCPvyqOB+1QaXjQRGW8bW+y8shVxqrlb9PV+nGBNEwR6ntDXgtUWBPoUxj +TIEA== 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-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: <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