Linux-PCI Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH v2 0/2] VMD support for 8086:9A0B
@ 2019-11-12 12:47 Jon Derrick
  2019-11-12 12:47 ` [PATCH v2 1/2] PCI: vmd: Add bus 224-255 restriction decode Jon Derrick
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Jon Derrick @ 2019-11-12 12:47 UTC (permalink / raw)
  To: Lorenzo Pieralisi; +Cc: linux-pci, Bjorn Helgaas, Keith Busch, Jon Derrick

This set adds VMD support for device 8086:9A0B. The first patch adds
another bus range restriction and the second patch adds the device id.

v1->v2:
Reworded ambiguous commit message to match code comment
Coding style fixes

Jon Derrick (2):
  PCI: vmd: Add bus 224-255 restriction decode
  PCI: vmd: Add device id for VMD device 8086:9A0B

 drivers/pci/controller/vmd.c | 32 ++++++++++++++++++++++++--------
 include/linux/pci_ids.h      |  1 +
 2 files changed, 25 insertions(+), 8 deletions(-)

-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v2 1/2] PCI: vmd: Add bus 224-255 restriction decode
  2019-11-12 12:47 [PATCH v2 0/2] VMD support for 8086:9A0B Jon Derrick
@ 2019-11-12 12:47 ` Jon Derrick
  2019-11-20 16:47   ` Lorenzo Pieralisi
  2019-11-12 12:47 ` [PATCH v2 2/2] PCI: vmd: Add device id for VMD device 8086:9A0B Jon Derrick
  2019-11-20 16:16 ` [PATCH v2 0/2] VMD support for 8086:9A0B Derrick, Jonathan
  2 siblings, 1 reply; 6+ messages in thread
From: Jon Derrick @ 2019-11-12 12:47 UTC (permalink / raw)
  To: Lorenzo Pieralisi; +Cc: linux-pci, Bjorn Helgaas, Keith Busch, Jon Derrick

VMD bus restrictions are required when IO fabric is multiplexed such
that VMD cannot use the entire bus range. This patch adds another bus
restriction decode bit that can be set by firmware to restrict the VMD
bus range to between 224-255.

Signed-off-by: Jon Derrick <jonathan.derrick@intel.com>
---
 drivers/pci/controller/vmd.c | 30 ++++++++++++++++++++++--------
 1 file changed, 22 insertions(+), 8 deletions(-)

diff --git a/drivers/pci/controller/vmd.c b/drivers/pci/controller/vmd.c
index a35d3f3..15302a1 100644
--- a/drivers/pci/controller/vmd.c
+++ b/drivers/pci/controller/vmd.c
@@ -602,16 +602,30 @@ static int vmd_enable_domain(struct vmd_dev *vmd, unsigned long features)
 
 	/*
 	 * Certain VMD devices may have a root port configuration option which
-	 * limits the bus range to between 0-127 or 128-255
+	 * limits the bus range to between 0-127, 128-255, or 224-255
 	 */
 	if (features & VMD_FEAT_HAS_BUS_RESTRICTIONS) {
-		u32 vmcap, vmconfig;
-
-		pci_read_config_dword(vmd->dev, PCI_REG_VMCAP, &vmcap);
-		pci_read_config_dword(vmd->dev, PCI_REG_VMCONFIG, &vmconfig);
-		if (BUS_RESTRICT_CAP(vmcap) &&
-		    (BUS_RESTRICT_CFG(vmconfig) == 0x1))
-			vmd->busn_start = 128;
+		u16 reg16;
+
+		pci_read_config_word(vmd->dev, PCI_REG_VMCAP, &reg16);
+		if (BUS_RESTRICT_CAP(reg16)) {
+			pci_read_config_word(vmd->dev, PCI_REG_VMCONFIG,
+					     &reg16);
+
+			switch (BUS_RESTRICT_CFG(reg16)) {
+			case 1:
+				vmd->busn_start = 128;
+				break;
+			case 2:
+				vmd->busn_start = 224;
+				break;
+			case 3:
+				pci_err(vmd->dev, "Unknown Bus Offset Setting\n");
+				return -ENODEV;
+			default:
+				break;
+			}
+		}
 	}
 
 	res = &vmd->dev->resource[VMD_CFGBAR];
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v2 2/2] PCI: vmd: Add device id for VMD device 8086:9A0B
  2019-11-12 12:47 [PATCH v2 0/2] VMD support for 8086:9A0B Jon Derrick
  2019-11-12 12:47 ` [PATCH v2 1/2] PCI: vmd: Add bus 224-255 restriction decode Jon Derrick
@ 2019-11-12 12:47 ` Jon Derrick
  2019-11-20 16:16 ` [PATCH v2 0/2] VMD support for 8086:9A0B Derrick, Jonathan
  2 siblings, 0 replies; 6+ messages in thread
From: Jon Derrick @ 2019-11-12 12:47 UTC (permalink / raw)
  To: Lorenzo Pieralisi; +Cc: linux-pci, Bjorn Helgaas, Keith Busch, Jon Derrick

This patch adds support for this VMD device which supports the bus
restriction mode.

Signed-off-by: Jon Derrick <jonathan.derrick@intel.com>
---
 drivers/pci/controller/vmd.c | 2 ++
 include/linux/pci_ids.h      | 1 +
 2 files changed, 3 insertions(+)

diff --git a/drivers/pci/controller/vmd.c b/drivers/pci/controller/vmd.c
index 15302a1..6bff951 100644
--- a/drivers/pci/controller/vmd.c
+++ b/drivers/pci/controller/vmd.c
@@ -868,6 +868,8 @@ static int vmd_resume(struct device *dev)
 	{PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_VMD_28C0),
 		.driver_data = VMD_FEAT_HAS_MEMBAR_SHADOW |
 				VMD_FEAT_HAS_BUS_RESTRICTIONS,},
+	{PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_VMD_9A0B),
+		.driver_data = VMD_FEAT_HAS_BUS_RESTRICTIONS,},
 	{0,}
 };
 MODULE_DEVICE_TABLE(pci, vmd_ids);
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 21a5724..2302d133 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -3006,6 +3006,7 @@
 #define PCI_DEVICE_ID_INTEL_84460GX	0x84ea
 #define PCI_DEVICE_ID_INTEL_IXP4XX	0x8500
 #define PCI_DEVICE_ID_INTEL_IXP2800	0x9004
+#define PCI_DEVICE_ID_INTEL_VMD_9A0B	0x9a0b
 #define PCI_DEVICE_ID_INTEL_S21152BB	0xb152
 
 #define PCI_VENDOR_ID_SCALEMP		0x8686
-- 
1.8.3.1


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 0/2] VMD support for 8086:9A0B
  2019-11-12 12:47 [PATCH v2 0/2] VMD support for 8086:9A0B Jon Derrick
  2019-11-12 12:47 ` [PATCH v2 1/2] PCI: vmd: Add bus 224-255 restriction decode Jon Derrick
  2019-11-12 12:47 ` [PATCH v2 2/2] PCI: vmd: Add device id for VMD device 8086:9A0B Jon Derrick
@ 2019-11-20 16:16 ` Derrick, Jonathan
  2 siblings, 0 replies; 6+ messages in thread
From: Derrick, Jonathan @ 2019-11-20 16:16 UTC (permalink / raw)
  To: lorenzo.pieralisi; +Cc: kbusch, linux-pci, helgaas

On Tue, 2019-11-12 at 05:47 -0700, Jon Derrick wrote:
> This set adds VMD support for device 8086:9A0B. The first patch adds
> another bus range restriction and the second patch adds the device id.
> 
> v1->v2:
> Reworded ambiguous commit message to match code comment
> Coding style fixes
> 
> Jon Derrick (2):
>   PCI: vmd: Add bus 224-255 restriction decode
>   PCI: vmd: Add device id for VMD device 8086:9A0B
> 
>  drivers/pci/controller/vmd.c | 32 ++++++++++++++++++++++++--------
>  include/linux/pci_ids.h      |  1 +
>  2 files changed, 25 insertions(+), 8 deletions(-)
> 

Any issues with these?

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 1/2] PCI: vmd: Add bus 224-255 restriction decode
  2019-11-12 12:47 ` [PATCH v2 1/2] PCI: vmd: Add bus 224-255 restriction decode Jon Derrick
@ 2019-11-20 16:47   ` Lorenzo Pieralisi
  2019-11-20 17:00     ` Derrick, Jonathan
  0 siblings, 1 reply; 6+ messages in thread
From: Lorenzo Pieralisi @ 2019-11-20 16:47 UTC (permalink / raw)
  To: Jon Derrick; +Cc: linux-pci, Bjorn Helgaas, Keith Busch

On Tue, Nov 12, 2019 at 05:47:52AM -0700, Jon Derrick wrote:
> VMD bus restrictions are required when IO fabric is multiplexed such
> that VMD cannot use the entire bus range. This patch adds another bus
> restriction decode bit that can be set by firmware to restrict the VMD
> bus range to between 224-255.
> 
> Signed-off-by: Jon Derrick <jonathan.derrick@intel.com>
> ---
>  drivers/pci/controller/vmd.c | 30 ++++++++++++++++++++++--------
>  1 file changed, 22 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/pci/controller/vmd.c b/drivers/pci/controller/vmd.c
> index a35d3f3..15302a1 100644
> --- a/drivers/pci/controller/vmd.c
> +++ b/drivers/pci/controller/vmd.c
> @@ -602,16 +602,30 @@ static int vmd_enable_domain(struct vmd_dev *vmd, unsigned long features)
>  
>  	/*
>  	 * Certain VMD devices may have a root port configuration option which
> -	 * limits the bus range to between 0-127 or 128-255
> +	 * limits the bus range to between 0-127, 128-255, or 224-255
>  	 */
>  	if (features & VMD_FEAT_HAS_BUS_RESTRICTIONS) {
> -		u32 vmcap, vmconfig;
> -
> -		pci_read_config_dword(vmd->dev, PCI_REG_VMCAP, &vmcap);
> -		pci_read_config_dword(vmd->dev, PCI_REG_VMCONFIG, &vmconfig);
> -		if (BUS_RESTRICT_CAP(vmcap) &&
> -		    (BUS_RESTRICT_CFG(vmconfig) == 0x1))
> -			vmd->busn_start = 128;
> +		u16 reg16;
> +
> +		pci_read_config_word(vmd->dev, PCI_REG_VMCAP, &reg16);
> +		if (BUS_RESTRICT_CAP(reg16)) {
> +			pci_read_config_word(vmd->dev, PCI_REG_VMCONFIG,
> +					     &reg16);
> +
> +			switch (BUS_RESTRICT_CFG(reg16)) {
> +			case 1:
> +				vmd->busn_start = 128;
> +				break;
> +			case 2:
> +				vmd->busn_start = 224;
> +				break;
> +			case 3:
> +				pci_err(vmd->dev, "Unknown Bus Offset Setting\n");

Technically this error+message should be present in the current kernel
as well but anyway, I have applied the series to pci/vmd.

Thanks,
Lorenzo

> +				return -ENODEV;
> +			default:
> +				break;
> +			}
> +		}
>  	}
>  
>  	res = &vmd->dev->resource[VMD_CFGBAR];
> -- 
> 1.8.3.1
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 1/2] PCI: vmd: Add bus 224-255 restriction decode
  2019-11-20 16:47   ` Lorenzo Pieralisi
@ 2019-11-20 17:00     ` Derrick, Jonathan
  0 siblings, 0 replies; 6+ messages in thread
From: Derrick, Jonathan @ 2019-11-20 17:00 UTC (permalink / raw)
  To: lorenzo.pieralisi; +Cc: kbusch, linux-pci, helgaas

On Wed, 2019-11-20 at 16:47 +0000, Lorenzo Pieralisi wrote:
> On Tue, Nov 12, 2019 at 05:47:52AM -0700, Jon Derrick wrote:
> > VMD bus restrictions are required when IO fabric is multiplexed such
> > that VMD cannot use the entire bus range. This patch adds another bus
> > restriction decode bit that can be set by firmware to restrict the VMD
> > bus range to between 224-255.
> > 
> > Signed-off-by: Jon Derrick <jonathan.derrick@intel.com>
> > ---
> >  drivers/pci/controller/vmd.c | 30 ++++++++++++++++++++++--------
> >  1 file changed, 22 insertions(+), 8 deletions(-)
> > 
> > diff --git a/drivers/pci/controller/vmd.c b/drivers/pci/controller/vmd.c
> > index a35d3f3..15302a1 100644
> > --- a/drivers/pci/controller/vmd.c
> > +++ b/drivers/pci/controller/vmd.c
> > @@ -602,16 +602,30 @@ static int vmd_enable_domain(struct vmd_dev *vmd, unsigned long features)
> >  
> >  	/*
> >  	 * Certain VMD devices may have a root port configuration option which
> > -	 * limits the bus range to between 0-127 or 128-255
> > +	 * limits the bus range to between 0-127, 128-255, or 224-255
> >  	 */
> >  	if (features & VMD_FEAT_HAS_BUS_RESTRICTIONS) {
> > -		u32 vmcap, vmconfig;
> > -
> > -		pci_read_config_dword(vmd->dev, PCI_REG_VMCAP, &vmcap);
> > -		pci_read_config_dword(vmd->dev, PCI_REG_VMCONFIG, &vmconfig);
> > -		if (BUS_RESTRICT_CAP(vmcap) &&
> > -		    (BUS_RESTRICT_CFG(vmconfig) == 0x1))
> > -			vmd->busn_start = 128;
> > +		u16 reg16;
> > +
> > +		pci_read_config_word(vmd->dev, PCI_REG_VMCAP, &reg16);
> > +		if (BUS_RESTRICT_CAP(reg16)) {
> > +			pci_read_config_word(vmd->dev, PCI_REG_VMCONFIG,
> > +					     &reg16);
> > +
> > +			switch (BUS_RESTRICT_CFG(reg16)) {
> > +			case 1:
> > +				vmd->busn_start = 128;
> > +				break;
> > +			case 2:
> > +				vmd->busn_start = 224;
> > +				break;
> > +			case 3:
> > +				pci_err(vmd->dev, "Unknown Bus Offset Setting\n");
> 
> Technically this error+message should be present in the current kernel
> as well but anyway, I have applied the series to pci/vmd.
Agreed. It was an ambiguous definition in a previous spec.


> 
> Thanks,
> Lorenzo
Thank you


> 
> > +				return -ENODEV;
> > +			default:
> > +				break;
> > +			}
> > +		}
> >  	}
> >  
> >  	res = &vmd->dev->resource[VMD_CFGBAR];
> > -- 
> > 1.8.3.1
> > 

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, back to index

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-12 12:47 [PATCH v2 0/2] VMD support for 8086:9A0B Jon Derrick
2019-11-12 12:47 ` [PATCH v2 1/2] PCI: vmd: Add bus 224-255 restriction decode Jon Derrick
2019-11-20 16:47   ` Lorenzo Pieralisi
2019-11-20 17:00     ` Derrick, Jonathan
2019-11-12 12:47 ` [PATCH v2 2/2] PCI: vmd: Add device id for VMD device 8086:9A0B Jon Derrick
2019-11-20 16:16 ` [PATCH v2 0/2] VMD support for 8086:9A0B Derrick, Jonathan

Linux-PCI Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-pci/0 linux-pci/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-pci linux-pci/ https://lore.kernel.org/linux-pci \
		linux-pci@vger.kernel.org
	public-inbox-index linux-pci

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-pci


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git