[v1,5/5] crypto: ccp: Add support for new CCP/PSP device ID
diff mbox

Message ID 20180703171214.3225.27261.stgit@tlendack-t1.amdoffice.net
State Accepted
Delegated to: Herbert Xu
Headers show

Commit Message

Lendacky, Thomas July 3, 2018, 5:12 p.m. UTC
Add a new CCP/PSP PCI device ID and new PSP register offsets.

Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
---
 drivers/crypto/ccp/sp-pci.c |   29 ++++++++++++++++++++++++-----
 1 file changed, 24 insertions(+), 5 deletions(-)

Comments

Gary R Hook July 5, 2018, 6:25 p.m. UTC | #1
On 07/03/2018 12:12 PM, Tom Lendacky wrote:
> Add a new CCP/PSP PCI device ID and new PSP register offsets.
> 
> Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>

Acked-by: Gary R Hook <gary.hook@amd.com>

> ---
>   drivers/crypto/ccp/sp-pci.c |   29 ++++++++++++++++++++++++-----
>   1 file changed, 24 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/crypto/ccp/sp-pci.c b/drivers/crypto/ccp/sp-pci.c
> index 78c1e9d..7da93e9 100644
> --- a/drivers/crypto/ccp/sp-pci.c
> +++ b/drivers/crypto/ccp/sp-pci.c
> @@ -269,7 +269,7 @@ static int sp_pci_resume(struct pci_dev *pdev)
>   #endif
>   
>   #ifdef CONFIG_CRYPTO_DEV_SP_PSP
> -static const struct psp_vdata psp_entry = {
> +static const struct psp_vdata pspv1 = {
>   	.cmdresp_reg		= 0x10580,
>   	.cmdbuff_addr_lo_reg	= 0x105e0,
>   	.cmdbuff_addr_hi_reg	= 0x105e4,
> @@ -277,35 +277,54 @@ static int sp_pci_resume(struct pci_dev *pdev)
>   	.inten_reg		= 0x10610,
>   	.intsts_reg		= 0x10614,
>   };
> +
> +static const struct psp_vdata pspv2 = {
> +	.cmdresp_reg		= 0x10980,
> +	.cmdbuff_addr_lo_reg	= 0x109e0,
> +	.cmdbuff_addr_hi_reg	= 0x109e4,
> +	.feature_reg		= 0x109fc,
> +	.inten_reg		= 0x10690,
> +	.intsts_reg		= 0x10694,
> +};
>   #endif
>   
>   static const struct sp_dev_vdata dev_vdata[] = {
> -	{
> +	{	/* 0 */
>   		.bar = 2,
>   #ifdef CONFIG_CRYPTO_DEV_SP_CCP
>   		.ccp_vdata = &ccpv3,
>   #endif
>   	},
> -	{
> +	{	/* 1 */
>   		.bar = 2,
>   #ifdef CONFIG_CRYPTO_DEV_SP_CCP
>   		.ccp_vdata = &ccpv5a,
>   #endif
>   #ifdef CONFIG_CRYPTO_DEV_SP_PSP
> -		.psp_vdata = &psp_entry
> +		.psp_vdata = &pspv1,
>   #endif
>   	},
> -	{
> +	{	/* 2 */
>   		.bar = 2,
>   #ifdef CONFIG_CRYPTO_DEV_SP_CCP
>   		.ccp_vdata = &ccpv5b,
>   #endif
>   	},
> +	{	/* 3 */
> +		.bar = 2,
> +#ifdef CONFIG_CRYPTO_DEV_SP_CCP
> +		.ccp_vdata = &ccpv5a,
> +#endif
> +#ifdef CONFIG_CRYPTO_DEV_SP_PSP
> +		.psp_vdata = &pspv2,
> +#endif
> +	},
>   };
>   static const struct pci_device_id sp_pci_table[] = {
>   	{ PCI_VDEVICE(AMD, 0x1537), (kernel_ulong_t)&dev_vdata[0] },
>   	{ PCI_VDEVICE(AMD, 0x1456), (kernel_ulong_t)&dev_vdata[1] },
>   	{ PCI_VDEVICE(AMD, 0x1468), (kernel_ulong_t)&dev_vdata[2] },
> +	{ PCI_VDEVICE(AMD, 0x1486), (kernel_ulong_t)&dev_vdata[3] },
>   	/* Last entry must be zero */
>   	{ 0, }
>   };
>
Singh, Brijesh July 5, 2018, 8:36 p.m. UTC | #2
On 07/03/2018 12:12 PM, Tom Lendacky wrote:
> Add a new CCP/PSP PCI device ID and new PSP register offsets.
> 
> Signed-off-by: Tom Lendacky <thomas.lendacky@amd.com>
> ---
>   drivers/crypto/ccp/sp-pci.c |   29 ++++++++++++++++++++++++-----
>   1 file changed, 24 insertions(+), 5 deletions(-)
> 

Reviewed-by: Brijesh Singh <brijesh.singh@amd.com>


> diff --git a/drivers/crypto/ccp/sp-pci.c b/drivers/crypto/ccp/sp-pci.c
> index 78c1e9d..7da93e9 100644
> --- a/drivers/crypto/ccp/sp-pci.c
> +++ b/drivers/crypto/ccp/sp-pci.c
> @@ -269,7 +269,7 @@ static int sp_pci_resume(struct pci_dev *pdev)
>   #endif
>   
>   #ifdef CONFIG_CRYPTO_DEV_SP_PSP
> -static const struct psp_vdata psp_entry = {
> +static const struct psp_vdata pspv1 = {
>   	.cmdresp_reg		= 0x10580,
>   	.cmdbuff_addr_lo_reg	= 0x105e0,
>   	.cmdbuff_addr_hi_reg	= 0x105e4,
> @@ -277,35 +277,54 @@ static int sp_pci_resume(struct pci_dev *pdev)
>   	.inten_reg		= 0x10610,
>   	.intsts_reg		= 0x10614,
>   };
> +
> +static const struct psp_vdata pspv2 = {
> +	.cmdresp_reg		= 0x10980,
> +	.cmdbuff_addr_lo_reg	= 0x109e0,
> +	.cmdbuff_addr_hi_reg	= 0x109e4,
> +	.feature_reg		= 0x109fc,
> +	.inten_reg		= 0x10690,
> +	.intsts_reg		= 0x10694,
> +};
>   #endif
>   
>   static const struct sp_dev_vdata dev_vdata[] = {
> -	{
> +	{	/* 0 */
>   		.bar = 2,
>   #ifdef CONFIG_CRYPTO_DEV_SP_CCP
>   		.ccp_vdata = &ccpv3,
>   #endif
>   	},
> -	{
> +	{	/* 1 */
>   		.bar = 2,
>   #ifdef CONFIG_CRYPTO_DEV_SP_CCP
>   		.ccp_vdata = &ccpv5a,
>   #endif
>   #ifdef CONFIG_CRYPTO_DEV_SP_PSP
> -		.psp_vdata = &psp_entry
> +		.psp_vdata = &pspv1,
>   #endif
>   	},
> -	{
> +	{	/* 2 */
>   		.bar = 2,
>   #ifdef CONFIG_CRYPTO_DEV_SP_CCP
>   		.ccp_vdata = &ccpv5b,
>   #endif
>   	},
> +	{	/* 3 */
> +		.bar = 2,
> +#ifdef CONFIG_CRYPTO_DEV_SP_CCP
> +		.ccp_vdata = &ccpv5a,
> +#endif
> +#ifdef CONFIG_CRYPTO_DEV_SP_PSP
> +		.psp_vdata = &pspv2,
> +#endif
> +	},
>   };
>   static const struct pci_device_id sp_pci_table[] = {
>   	{ PCI_VDEVICE(AMD, 0x1537), (kernel_ulong_t)&dev_vdata[0] },
>   	{ PCI_VDEVICE(AMD, 0x1456), (kernel_ulong_t)&dev_vdata[1] },
>   	{ PCI_VDEVICE(AMD, 0x1468), (kernel_ulong_t)&dev_vdata[2] },
> +	{ PCI_VDEVICE(AMD, 0x1486), (kernel_ulong_t)&dev_vdata[3] },
>   	/* Last entry must be zero */
>   	{ 0, }
>   };
>

Patch
diff mbox

diff --git a/drivers/crypto/ccp/sp-pci.c b/drivers/crypto/ccp/sp-pci.c
index 78c1e9d..7da93e9 100644
--- a/drivers/crypto/ccp/sp-pci.c
+++ b/drivers/crypto/ccp/sp-pci.c
@@ -269,7 +269,7 @@  static int sp_pci_resume(struct pci_dev *pdev)
 #endif
 
 #ifdef CONFIG_CRYPTO_DEV_SP_PSP
-static const struct psp_vdata psp_entry = {
+static const struct psp_vdata pspv1 = {
 	.cmdresp_reg		= 0x10580,
 	.cmdbuff_addr_lo_reg	= 0x105e0,
 	.cmdbuff_addr_hi_reg	= 0x105e4,
@@ -277,35 +277,54 @@  static int sp_pci_resume(struct pci_dev *pdev)
 	.inten_reg		= 0x10610,
 	.intsts_reg		= 0x10614,
 };
+
+static const struct psp_vdata pspv2 = {
+	.cmdresp_reg		= 0x10980,
+	.cmdbuff_addr_lo_reg	= 0x109e0,
+	.cmdbuff_addr_hi_reg	= 0x109e4,
+	.feature_reg		= 0x109fc,
+	.inten_reg		= 0x10690,
+	.intsts_reg		= 0x10694,
+};
 #endif
 
 static const struct sp_dev_vdata dev_vdata[] = {
-	{
+	{	/* 0 */
 		.bar = 2,
 #ifdef CONFIG_CRYPTO_DEV_SP_CCP
 		.ccp_vdata = &ccpv3,
 #endif
 	},
-	{
+	{	/* 1 */
 		.bar = 2,
 #ifdef CONFIG_CRYPTO_DEV_SP_CCP
 		.ccp_vdata = &ccpv5a,
 #endif
 #ifdef CONFIG_CRYPTO_DEV_SP_PSP
-		.psp_vdata = &psp_entry
+		.psp_vdata = &pspv1,
 #endif
 	},
-	{
+	{	/* 2 */
 		.bar = 2,
 #ifdef CONFIG_CRYPTO_DEV_SP_CCP
 		.ccp_vdata = &ccpv5b,
 #endif
 	},
+	{	/* 3 */
+		.bar = 2,
+#ifdef CONFIG_CRYPTO_DEV_SP_CCP
+		.ccp_vdata = &ccpv5a,
+#endif
+#ifdef CONFIG_CRYPTO_DEV_SP_PSP
+		.psp_vdata = &pspv2,
+#endif
+	},
 };
 static const struct pci_device_id sp_pci_table[] = {
 	{ PCI_VDEVICE(AMD, 0x1537), (kernel_ulong_t)&dev_vdata[0] },
 	{ PCI_VDEVICE(AMD, 0x1456), (kernel_ulong_t)&dev_vdata[1] },
 	{ PCI_VDEVICE(AMD, 0x1468), (kernel_ulong_t)&dev_vdata[2] },
+	{ PCI_VDEVICE(AMD, 0x1486), (kernel_ulong_t)&dev_vdata[3] },
 	/* Last entry must be zero */
 	{ 0, }
 };