All of lore.kernel.org
 help / color / mirror / Atom feed
From: Bjorn Helgaas <helgaas@kernel.org>
To: Ali Alaei <ali.alaei.tabatabaei@gmail.com>
Cc: linux-pci@vger.kernel.org, bhelgaas@google.com,
	lpieralisi@kernel.org, nirmal.patel@linux.intel.com,
	jonathan.derrick@linux.dev, kwilczynski@kernel.org,
	mani@kernel.org, robh@kernel.org
Subject: Re: [PATCH v3] PCI: vmd: Handle BUS_RESTRICT_CFG value 3 for Arrow Lake-HX
Date: Mon, 20 Jul 2026 17:47:45 -0500	[thread overview]
Message-ID: <20260720224745.GA435004@bhelgaas> (raw)
In-Reply-To: <20260628143450.92492-1-ali.alaei.tabatabaei@gmail.com>

On Sun, Jun 28, 2026 at 04:34:50PM +0200, Ali Alaei wrote:
> On Intel Arrow Lake-HX systems (e.g. Core Ultra 9 275HX on Acer Predator
> PH16-73), the VMD controller reports BUS_RESTRICT_CFG = 3 in the VMCONFIG
> register. The existing switch statement only handled values 0, 1, and 2,
> causing vmd_get_bus_number_start() to return -ENODEV and aborting the
> entire VMD probe. This leaves NVMe drives behind the VMD controller
> invisible to the kernel.
> 
> Hardware registers (VMCAP/VMCONFIG at offsets 0x40/0x44):
>   VMD 0000:00:0e.0 (8086:ad0b): VMCAP=0x000f, VMCONFIG=0x03b8
>   BUS_RESTRICT_CFG(0x03b8) = (0x03b8 >> 8) & 0x3 = 3
> 
> Add cfg=3 as a fallthrough to cfg=2, setting busn_start=224, which is
> the correct bus number base for this hardware.
> 
> Also add a PCI_POSSIBLE_ERROR() guard after reading VMCONFIG: a failed
> config space read returns 0xFFFF, and BUS_RESTRICT_CFG(0xFFFF) = 3,
> so without this guard a removed or errored device would falsely match
> the new case 3 instead of being caught as an error.

I suppose this should fix
https://bugzilla.kernel.org/show_bug.cgi?id=221136, which is a problem
on an Arrow-Lake-S system?  I bcc'd the reporter, and we could add a
Reported-by: and/or Closes: tag if appropriate.

That report mentions a 8086:09ab VMD device, and it looks like this
patch addresses a 8086:ad0b device.  I suppose there are lots of VMD
devices IDs that appear in lots of systems and implement this feature,
which the bugzilla suggests is called "Dynamic Bus Offset".

Given that this is apparently a new VMD mode, AFAIK there is no public
hardware spec for this, and the patch doesn't add any new code (and I
would expect a new feature to require some new code), it would really
be nice to have the Intel VMD maintainers chime in here.

> Signed-off-by: Ali Alaei <ali.alaei.tabatabaei@gmail.com>
> ---
> Changes in v3:
>  - Move changelog to after '---' (was incorrectly in commit message body)
>  - Add missing VMD maintainers to CC (Nirmal Patel, Jonathan Derrick)
> 
> Changes in v2:
>  - Add PCI_POSSIBLE_ERROR() guard after VMCONFIG read to prevent a
>    failed config read (0xFFFF) from falsely matching case 3
> 
>  drivers/pci/controller/vmd.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/pci/controller/vmd.c b/drivers/pci/controller/vmd.c
> index xxxxxxx..yyyyyyy 100644
> --- a/drivers/pci/controller/vmd.c
> +++ b/drivers/pci/controller/vmd.c
> @@ -640,6 +640,8 @@ static int vmd_get_bus_number_start(struct vmd_dev *vmd)
>  	pci_read_config_word(dev, PCI_REG_VMCAP, &reg);
>  	if (BUS_RESTRICT_CAP(reg)) {
>  		pci_read_config_word(dev, PCI_REG_VMCONFIG, &reg);
> +		if (PCI_POSSIBLE_ERROR(reg))
> +			return -ENODEV;
> 
>  		switch (BUS_RESTRICT_CFG(reg)) {
>  		case 0:
> @@ -651,6 +653,7 @@ static int vmd_get_bus_number_start(struct vmd_dev *vmd)
>  		case 1:
>  			vmd->busn_start = 128;
>  			break;
> +		case 3:
>  		case 2:
>  			vmd->busn_start = 224;
>  			break;
> --
> 2.49.0

  parent reply	other threads:[~2026-07-20 22:47 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-04 18:59 [PATCH] PCI: vmd: Handle BUS_RESTRICT_CFG value 3 for Arrow Lake-HX Ali Alaei
2026-06-04 19:12 ` sashiko-bot
2026-06-04 21:40 ` [PATCH v2] " Ali Alaei
2026-06-22 14:46   ` Manivannan Sadhasivam
2026-06-28 14:34   ` [PATCH v3] " Ali Alaei
2026-06-28 14:46     ` sashiko-bot
2026-07-13 17:16     ` Ali Alaei
2026-07-15  5:56     ` Manivannan Sadhasivam
2026-07-20 22:47     ` Bjorn Helgaas [this message]
2026-07-21 12:47       ` Lin Mohan
2026-07-21 12:50       ` Lin Mohan
  -- strict thread matches above, loose matches on Subject: below --
2026-07-21 12:47 Lin Mohan
2026-07-21 16:42 ` 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=20260720224745.GA435004@bhelgaas \
    --to=helgaas@kernel.org \
    --cc=ali.alaei.tabatabaei@gmail.com \
    --cc=bhelgaas@google.com \
    --cc=jonathan.derrick@linux.dev \
    --cc=kwilczynski@kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lpieralisi@kernel.org \
    --cc=mani@kernel.org \
    --cc=nirmal.patel@linux.intel.com \
    --cc=robh@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.