Linux PCI subsystem development
 help / color / mirror / Atom feed
From: <dan.j.williams@intel.com>
To: Michael Kelley <mhklinux@outlook.com>,
	Dan Williams <dan.j.williams@intel.com>,
	"bhelgaas@google.com" <bhelgaas@google.com>
Cc: "linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>,
	"jonathan.derrick@linux.dev" <jonathan.derrick@linux.dev>,
	"lpieralisi@kernel.org" <lpieralisi@kernel.org>,
	"kwilczynski@kernel.org" <kwilczynski@kernel.org>,
	"mani@kernel.org" <mani@kernel.org>,
	"robh@kernel.org" <robh@kernel.org>,
	Suzuki K Poulose <suzuki.poulose@arm.com>,
	Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>,
	"K. Y. Srinivasan" <kys@microsoft.com>,
	Haiyang Zhang <haiyangz@microsoft.com>,
	Wei Liu <wei.liu@kernel.org>, "Dexuan Cui" <decui@microsoft.com>
Subject: RE: [PATCH v2 1/2] PCI: Enable host bridge emulation for PCI_DOMAINS_GENERIC platforms
Date: Mon, 27 Oct 2025 16:45:42 -0700	[thread overview]
Message-ID: <69000426e1537_10e21003c@dwillia2-mobl4.notmuch> (raw)
In-Reply-To: <SN6PR02MB4157A61D1497F3F205E1A845D4FEA@SN6PR02MB4157.namprd02.prod.outlook.com>

Michael Kelley wrote:
> From: Dan Williams <dan.j.williams@intel.com> Sent: Friday, October 24, 2025 3:46 PM
> > 
> > The ability to emulate a host bridge is useful not only for hardware PCI
> > controllers like CONFIG_VMD, or virtual PCI controllers like
> > CONFIG_PCI_HYPERV, but also for test and development scenarios like
> > CONFIG_SAMPLES_DEVSEC [1].
> > 
> > One stumbling block for defining CONFIG_SAMPLES_DEVSEC, a sample
> > implementation of a platform TSM for PCI Device Security, is the need to
> > accommodate PCI_DOMAINS_GENERIC architectures alongside x86 [2].
> 
> There's not a [2] tag anywhere below.  Presumably it should be the "Closes:"
> link?

Yes, good catch.

> > In support of supplementing the existing CONFIG_PCI_BRIDGE_EMUL
> > infrastructure for host bridges:
> > 
> > * Introduce pci_bus_find_emul_domain_nr() as a common way to find a free
> >   PCI domain number whether that is to reuse the existing dynamic
> >   allocation code in the !ACPI case, or to assign an unused domain above
> >   the last ACPI segment.
> > 
> > * Convert pci-hyperv to the new allocator so that the PCI core can
> >   unconditionally assume that bridge->domain_nr != PCI_DOMAIN_NR_NOT_SET
> >   is the dynamically allocated case.
> > 
> > A follow on patch can also convert vmd to the new scheme. Currently vmd
> > is limited to CONFIG_PCI_DOMAINS_GENERIC=n (x86) so, unlike pci-hyperv,
> > it does not immediately conflict with this new
> > pci_bus_find_emul_domain_nr() mechanism.
> > 
> > Link: https://lore.kernel.org/all/174107249038.1288555.12362100502109498455.stgit@dwillia2-xfh.jf.intel.com [1]
> > Reported-by: Suzuki K Poulose <suzuki.poulose@arm.com>
> > Closes: https://lore.kernel.org/all/20250311144601.145736-3-suzuki.poulose@arm.com 
> > Cc: Lorenzo Pieralisi <lpieralisi@kernel.org>
> > Cc: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
> > Cc: Rob Herring <robh@kernel.org>
> > Cc: Bjorn Helgaas <bhelgaas@google.com>
> > Cc: "K. Y. Srinivasan" <kys@microsoft.com>
> > Cc: Haiyang Zhang <haiyangz@microsoft.com>
> > Cc: Wei Liu <wei.liu@kernel.org>
> > Cc: Dexuan Cui <decui@microsoft.com>
> > Tested-by: Suzuki K Poulose <suzuki.poulose@arm.com>
> > [michael: maintain compatibility with userspace that expects 16-bit ids]
> 
> Is the above line spurious?  It doesn't seem to belong here.

That was documenting the change to make the @max argument to
pci_bus_find_emul_domain_nr() be U16_MAX in the Hyper-V case, but yeah
no need to note that in this case. You did not edit the patch directly.
I am ok if Bjorn deletes that on applying.

If you want a respin Bjorn, let me know.

> > Cc: Michael Kelley <mhklinux@outlook.com>
> > Signed-off-by: Dan Williams <dan.j.williams@intel.com>
> 
> Tested on x86 and arm64 VMs in the Azure public cloud with
> multiple Hyper-V virtual PCI devices in each VM. So covered
> both the "CONFIG_PCI_DOMAINS_GENERIC=n" and "=y" cases.
> Did manual unbind/rebind of vPCI devices multiple times so the
> domain numbers would be freed and reallocated. All was good.
> I did not go to the trouble of simulating a domain number
> collision.
> 
> Reviewed-by: Michael Kelley <mhklinux@outlook.com>
> Tested-by: Michael Kelley <mhklinux@outlook.com>

Thanks, Michael much appreciated!

  reply	other threads:[~2025-10-27 23:45 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-24 22:46 [PATCH v2 0/2] PCI: Unify domain emulation Dan Williams
2025-10-24 22:46 ` [PATCH v2 1/2] PCI: Enable host bridge emulation for PCI_DOMAINS_GENERIC platforms Dan Williams
2025-10-25 19:53   ` Michael Kelley
2025-10-27 23:45     ` dan.j.williams [this message]
2025-10-27 20:08   ` Dave Jiang
2025-10-24 22:46 ` [PATCH v2 2/2] PCI: vmd: Switch to pci_bus_find_emul_domain_nr() Dan Williams
2025-10-27 20:08   ` Dave Jiang
2025-10-28 17:39 ` [PATCH v2 0/2] PCI: Unify domain emulation Bjorn Helgaas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=69000426e1537_10e21003c@dwillia2-mobl4.notmuch \
    --to=dan.j.williams@intel.com \
    --cc=bhelgaas@google.com \
    --cc=decui@microsoft.com \
    --cc=haiyangz@microsoft.com \
    --cc=jonathan.derrick@linux.dev \
    --cc=kwilczynski@kernel.org \
    --cc=kys@microsoft.com \
    --cc=linux-pci@vger.kernel.org \
    --cc=lpieralisi@kernel.org \
    --cc=mani@kernel.org \
    --cc=manivannan.sadhasivam@linaro.org \
    --cc=mhklinux@outlook.com \
    --cc=robh@kernel.org \
    --cc=suzuki.poulose@arm.com \
    --cc=wei.liu@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox