Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

crypto: ccp - rename ccp driver initialize files as sp device

CCP device initializes is now integerated into higher level SP device,
to avoid the confusion lets rename the ccp driver initialization files
(ccp-platform.c->sp-platform.c, ccp-pci.c->sp-pci.c). The patch does not
make any functional changes other than renaming file and structures

Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
Acked-by: Gary R Hook <gary.hook@amd.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

authored by

Brijesh Singh and committed by
Herbert Xu
d0ebbc0c f4d18d65

+87 -93
+2 -2
drivers/crypto/ccp/Makefile
··· 1 1 obj-$(CONFIG_CRYPTO_DEV_CCP_DD) += ccp.o 2 - ccp-objs := sp-dev.o ccp-platform.o 2 + ccp-objs := sp-dev.o sp-platform.o 3 3 ccp-$(CONFIG_CRYPTO_DEV_SP_CCP) += ccp-dev.o \ 4 4 ccp-ops.o \ 5 5 ccp-dev-v3.o \ 6 6 ccp-dev-v5.o \ 7 7 ccp-dmaengine.o \ 8 8 ccp-debugfs.o 9 - ccp-$(CONFIG_PCI) += ccp-pci.o 9 + ccp-$(CONFIG_PCI) += sp-pci.o 10 10 11 11 obj-$(CONFIG_CRYPTO_DEV_CCP_CRYPTO) += ccp-crypto.o 12 12 ccp-crypto-objs := ccp-crypto-main.o \
-6
drivers/crypto/ccp/ccp-dev.h
··· 626 626 struct dword7 dw7; 627 627 }; 628 628 629 - int ccp_pci_init(void); 630 - void ccp_pci_exit(void); 631 - 632 - int ccp_platform_init(void); 633 - void ccp_platform_exit(void); 634 - 635 629 void ccp_add_device(struct ccp_device *ccp); 636 630 void ccp_del_device(struct ccp_device *ccp); 637 631
+40 -40
drivers/crypto/ccp/ccp-pci.c drivers/crypto/ccp/sp-pci.c
··· 1 1 /* 2 - * AMD Cryptographic Coprocessor (CCP) driver 2 + * AMD Secure Processor device driver 3 3 * 4 4 * Copyright (C) 2013,2016 Advanced Micro Devices, Inc. 5 5 * ··· 28 28 29 29 #define MSIX_VECTORS 2 30 30 31 - struct ccp_pci { 31 + struct sp_pci { 32 32 int msix_count; 33 33 struct msix_entry msix_entry[MSIX_VECTORS]; 34 34 }; 35 35 36 - static int ccp_get_msix_irqs(struct sp_device *sp) 36 + static int sp_get_msix_irqs(struct sp_device *sp) 37 37 { 38 - struct ccp_pci *ccp_pci = sp->dev_specific; 38 + struct sp_pci *sp_pci = sp->dev_specific; 39 39 struct device *dev = sp->dev; 40 40 struct pci_dev *pdev = to_pci_dev(dev); 41 41 int v, ret; 42 42 43 - for (v = 0; v < ARRAY_SIZE(ccp_pci->msix_entry); v++) 44 - ccp_pci->msix_entry[v].entry = v; 43 + for (v = 0; v < ARRAY_SIZE(sp_pci->msix_entry); v++) 44 + sp_pci->msix_entry[v].entry = v; 45 45 46 - ret = pci_enable_msix_range(pdev, ccp_pci->msix_entry, 1, v); 46 + ret = pci_enable_msix_range(pdev, sp_pci->msix_entry, 1, v); 47 47 if (ret < 0) 48 48 return ret; 49 49 50 - ccp_pci->msix_count = ret; 50 + sp_pci->msix_count = ret; 51 51 sp->use_tasklet = true; 52 52 53 - sp->psp_irq = ccp_pci->msix_entry[0].vector; 54 - sp->ccp_irq = (ccp_pci->msix_count > 1) ? ccp_pci->msix_entry[1].vector 55 - : ccp_pci->msix_entry[0].vector; 53 + sp->psp_irq = sp_pci->msix_entry[0].vector; 54 + sp->ccp_irq = (sp_pci->msix_count > 1) ? sp_pci->msix_entry[1].vector 55 + : sp_pci->msix_entry[0].vector; 56 56 return 0; 57 57 } 58 58 59 - static int ccp_get_msi_irq(struct sp_device *sp) 59 + static int sp_get_msi_irq(struct sp_device *sp) 60 60 { 61 61 struct device *dev = sp->dev; 62 62 struct pci_dev *pdev = to_pci_dev(dev); ··· 72 72 return 0; 73 73 } 74 74 75 - static int ccp_get_irqs(struct sp_device *sp) 75 + static int sp_get_irqs(struct sp_device *sp) 76 76 { 77 77 struct device *dev = sp->dev; 78 78 int ret; 79 79 80 - ret = ccp_get_msix_irqs(sp); 80 + ret = sp_get_msix_irqs(sp); 81 81 if (!ret) 82 82 return 0; 83 83 84 84 /* Couldn't get MSI-X vectors, try MSI */ 85 85 dev_notice(dev, "could not enable MSI-X (%d), trying MSI\n", ret); 86 - ret = ccp_get_msi_irq(sp); 86 + ret = sp_get_msi_irq(sp); 87 87 if (!ret) 88 88 return 0; 89 89 ··· 93 93 return ret; 94 94 } 95 95 96 - static void ccp_free_irqs(struct sp_device *sp) 96 + static void sp_free_irqs(struct sp_device *sp) 97 97 { 98 - struct ccp_pci *ccp_pci = sp->dev_specific; 98 + struct sp_pci *sp_pci = sp->dev_specific; 99 99 struct device *dev = sp->dev; 100 100 struct pci_dev *pdev = to_pci_dev(dev); 101 101 102 - if (ccp_pci->msix_count) 102 + if (sp_pci->msix_count) 103 103 pci_disable_msix(pdev); 104 104 else if (sp->psp_irq) 105 105 pci_disable_msi(pdev); ··· 108 108 sp->psp_irq = 0; 109 109 } 110 110 111 - static int ccp_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) 111 + static int sp_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) 112 112 { 113 113 struct sp_device *sp; 114 - struct ccp_pci *ccp_pci; 114 + struct sp_pci *sp_pci; 115 115 struct device *dev = &pdev->dev; 116 116 void __iomem * const *iomap_table; 117 117 int bar_mask; ··· 122 122 if (!sp) 123 123 goto e_err; 124 124 125 - ccp_pci = devm_kzalloc(dev, sizeof(*ccp_pci), GFP_KERNEL); 126 - if (!ccp_pci) 125 + sp_pci = devm_kzalloc(dev, sizeof(*sp_pci), GFP_KERNEL); 126 + if (!sp_pci) 127 127 goto e_err; 128 128 129 - sp->dev_specific = ccp_pci; 129 + sp->dev_specific = sp_pci; 130 130 sp->dev_vdata = (struct sp_dev_vdata *)id->driver_data; 131 131 if (!sp->dev_vdata) { 132 132 ret = -ENODEV; ··· 161 161 goto e_err; 162 162 } 163 163 164 - ret = ccp_get_irqs(sp); 164 + ret = sp_get_irqs(sp); 165 165 if (ret) 166 166 goto e_err; 167 167 ··· 192 192 return ret; 193 193 } 194 194 195 - static void ccp_pci_remove(struct pci_dev *pdev) 195 + static void sp_pci_remove(struct pci_dev *pdev) 196 196 { 197 197 struct device *dev = &pdev->dev; 198 198 struct sp_device *sp = dev_get_drvdata(dev); ··· 202 202 203 203 sp_destroy(sp); 204 204 205 - ccp_free_irqs(sp); 205 + sp_free_irqs(sp); 206 206 207 207 dev_notice(dev, "disabled\n"); 208 208 } 209 209 210 210 #ifdef CONFIG_PM 211 - static int ccp_pci_suspend(struct pci_dev *pdev, pm_message_t state) 211 + static int sp_pci_suspend(struct pci_dev *pdev, pm_message_t state) 212 212 { 213 213 struct device *dev = &pdev->dev; 214 214 struct sp_device *sp = dev_get_drvdata(dev); ··· 216 216 return sp_suspend(sp, state); 217 217 } 218 218 219 - static int ccp_pci_resume(struct pci_dev *pdev) 219 + static int sp_pci_resume(struct pci_dev *pdev) 220 220 { 221 221 struct device *dev = &pdev->dev; 222 222 struct sp_device *sp = dev_get_drvdata(dev); ··· 245 245 #endif 246 246 }, 247 247 }; 248 - static const struct pci_device_id ccp_pci_table[] = { 248 + static const struct pci_device_id sp_pci_table[] = { 249 249 { PCI_VDEVICE(AMD, 0x1537), (kernel_ulong_t)&dev_vdata[0] }, 250 250 { PCI_VDEVICE(AMD, 0x1456), (kernel_ulong_t)&dev_vdata[1] }, 251 251 { PCI_VDEVICE(AMD, 0x1468), (kernel_ulong_t)&dev_vdata[2] }, 252 252 /* Last entry must be zero */ 253 253 { 0, } 254 254 }; 255 - MODULE_DEVICE_TABLE(pci, ccp_pci_table); 255 + MODULE_DEVICE_TABLE(pci, sp_pci_table); 256 256 257 - static struct pci_driver ccp_pci_driver = { 257 + static struct pci_driver sp_pci_driver = { 258 258 .name = "ccp", 259 - .id_table = ccp_pci_table, 260 - .probe = ccp_pci_probe, 261 - .remove = ccp_pci_remove, 259 + .id_table = sp_pci_table, 260 + .probe = sp_pci_probe, 261 + .remove = sp_pci_remove, 262 262 #ifdef CONFIG_PM 263 - .suspend = ccp_pci_suspend, 264 - .resume = ccp_pci_resume, 263 + .suspend = sp_pci_suspend, 264 + .resume = sp_pci_resume, 265 265 #endif 266 266 }; 267 267 268 - int ccp_pci_init(void) 268 + int sp_pci_init(void) 269 269 { 270 - return pci_register_driver(&ccp_pci_driver); 270 + return pci_register_driver(&sp_pci_driver); 271 271 } 272 272 273 - void ccp_pci_exit(void) 273 + void sp_pci_exit(void) 274 274 { 275 - pci_unregister_driver(&ccp_pci_driver); 275 + pci_unregister_driver(&sp_pci_driver); 276 276 }
+39 -39
drivers/crypto/ccp/ccp-platform.c drivers/crypto/ccp/sp-platform.c
··· 1 1 /* 2 - * AMD Cryptographic Coprocessor (CCP) driver 2 + * AMD Secure Processor device driver 3 3 * 4 4 * Copyright (C) 2014,2016 Advanced Micro Devices, Inc. 5 5 * ··· 28 28 29 29 #include "ccp-dev.h" 30 30 31 - struct ccp_platform { 31 + struct sp_platform { 32 32 int coherent; 33 33 unsigned int irq_count; 34 34 }; 35 35 36 - static const struct acpi_device_id ccp_acpi_match[]; 37 - static const struct of_device_id ccp_of_match[]; 36 + static const struct acpi_device_id sp_acpi_match[]; 37 + static const struct of_device_id sp_of_match[]; 38 38 39 - static struct sp_dev_vdata *ccp_get_of_version(struct platform_device *pdev) 39 + static struct sp_dev_vdata *sp_get_of_version(struct platform_device *pdev) 40 40 { 41 41 #ifdef CONFIG_OF 42 42 const struct of_device_id *match; 43 43 44 - match = of_match_node(ccp_of_match, pdev->dev.of_node); 44 + match = of_match_node(sp_of_match, pdev->dev.of_node); 45 45 if (match && match->data) 46 46 return (struct sp_dev_vdata *)match->data; 47 47 #endif 48 48 return NULL; 49 49 } 50 50 51 - static struct sp_dev_vdata *ccp_get_acpi_version(struct platform_device *pdev) 51 + static struct sp_dev_vdata *sp_get_acpi_version(struct platform_device *pdev) 52 52 { 53 53 #ifdef CONFIG_ACPI 54 54 const struct acpi_device_id *match; 55 55 56 - match = acpi_match_device(ccp_acpi_match, &pdev->dev); 56 + match = acpi_match_device(sp_acpi_match, &pdev->dev); 57 57 if (match && match->driver_data) 58 58 return (struct sp_dev_vdata *)match->driver_data; 59 59 #endif 60 60 return NULL; 61 61 } 62 62 63 - static int ccp_get_irqs(struct sp_device *sp) 63 + static int sp_get_irqs(struct sp_device *sp) 64 64 { 65 - struct ccp_platform *ccp_platform = sp->dev_specific; 65 + struct sp_platform *sp_platform = sp->dev_specific; 66 66 struct device *dev = sp->dev; 67 67 struct platform_device *pdev = to_platform_device(dev); 68 68 unsigned int i, count; ··· 75 75 count++; 76 76 } 77 77 78 - ccp_platform->irq_count = count; 78 + sp_platform->irq_count = count; 79 79 80 80 ret = platform_get_irq(pdev, 0); 81 81 if (ret < 0) { ··· 99 99 return 0; 100 100 } 101 101 102 - static int ccp_platform_probe(struct platform_device *pdev) 102 + static int sp_platform_probe(struct platform_device *pdev) 103 103 { 104 104 struct sp_device *sp; 105 - struct ccp_platform *ccp_platform; 105 + struct sp_platform *sp_platform; 106 106 struct device *dev = &pdev->dev; 107 107 enum dev_dma_attr attr; 108 108 struct resource *ior; ··· 113 113 if (!sp) 114 114 goto e_err; 115 115 116 - ccp_platform = devm_kzalloc(dev, sizeof(*ccp_platform), GFP_KERNEL); 117 - if (!ccp_platform) 116 + sp_platform = devm_kzalloc(dev, sizeof(*sp_platform), GFP_KERNEL); 117 + if (!sp_platform) 118 118 goto e_err; 119 119 120 - sp->dev_specific = ccp_platform; 121 - sp->dev_vdata = pdev->dev.of_node ? ccp_get_of_version(pdev) 122 - : ccp_get_acpi_version(pdev); 120 + sp->dev_specific = sp_platform; 121 + sp->dev_vdata = pdev->dev.of_node ? sp_get_of_version(pdev) 122 + : sp_get_acpi_version(pdev); 123 123 if (!sp->dev_vdata) { 124 124 ret = -ENODEV; 125 125 dev_err(dev, "missing driver data\n"); ··· 139 139 goto e_err; 140 140 } 141 141 142 - ccp_platform->coherent = (attr == DEV_DMA_COHERENT); 143 - if (ccp_platform->coherent) 142 + sp_platform->coherent = (attr == DEV_DMA_COHERENT); 143 + if (sp_platform->coherent) 144 144 sp->axcache = CACHE_WB_NO_ALLOC; 145 145 else 146 146 sp->axcache = CACHE_NONE; ··· 151 151 goto e_err; 152 152 } 153 153 154 - ret = ccp_get_irqs(sp); 154 + ret = sp_get_irqs(sp); 155 155 if (ret) 156 156 goto e_err; 157 157 ··· 170 170 return ret; 171 171 } 172 172 173 - static int ccp_platform_remove(struct platform_device *pdev) 173 + static int sp_platform_remove(struct platform_device *pdev) 174 174 { 175 175 struct device *dev = &pdev->dev; 176 176 struct sp_device *sp = dev_get_drvdata(dev); ··· 183 183 } 184 184 185 185 #ifdef CONFIG_PM 186 - static int ccp_platform_suspend(struct platform_device *pdev, 186 + static int sp_platform_suspend(struct platform_device *pdev, 187 187 pm_message_t state) 188 188 { 189 189 struct device *dev = &pdev->dev; ··· 192 192 return sp_suspend(sp, state); 193 193 } 194 194 195 - static int ccp_platform_resume(struct platform_device *pdev) 195 + static int sp_platform_resume(struct platform_device *pdev) 196 196 { 197 197 struct device *dev = &pdev->dev; 198 198 struct sp_device *sp = dev_get_drvdata(dev); ··· 211 211 }; 212 212 213 213 #ifdef CONFIG_ACPI 214 - static const struct acpi_device_id ccp_acpi_match[] = { 214 + static const struct acpi_device_id sp_acpi_match[] = { 215 215 { "AMDI0C00", (kernel_ulong_t)&dev_vdata[0] }, 216 216 { }, 217 217 }; 218 - MODULE_DEVICE_TABLE(acpi, ccp_acpi_match); 218 + MODULE_DEVICE_TABLE(acpi, sp_acpi_match); 219 219 #endif 220 220 221 221 #ifdef CONFIG_OF 222 - static const struct of_device_id ccp_of_match[] = { 222 + static const struct of_device_id sp_of_match[] = { 223 223 { .compatible = "amd,ccp-seattle-v1a", 224 224 .data = (const void *)&dev_vdata[0] }, 225 225 { }, 226 226 }; 227 - MODULE_DEVICE_TABLE(of, ccp_of_match); 227 + MODULE_DEVICE_TABLE(of, sp_of_match); 228 228 #endif 229 229 230 - static struct platform_driver ccp_platform_driver = { 230 + static struct platform_driver sp_platform_driver = { 231 231 .driver = { 232 232 .name = "ccp", 233 233 #ifdef CONFIG_ACPI 234 - .acpi_match_table = ccp_acpi_match, 234 + .acpi_match_table = sp_acpi_match, 235 235 #endif 236 236 #ifdef CONFIG_OF 237 - .of_match_table = ccp_of_match, 237 + .of_match_table = sp_of_match, 238 238 #endif 239 239 }, 240 - .probe = ccp_platform_probe, 241 - .remove = ccp_platform_remove, 240 + .probe = sp_platform_probe, 241 + .remove = sp_platform_remove, 242 242 #ifdef CONFIG_PM 243 - .suspend = ccp_platform_suspend, 244 - .resume = ccp_platform_resume, 243 + .suspend = sp_platform_suspend, 244 + .resume = sp_platform_resume, 245 245 #endif 246 246 }; 247 247 248 - int ccp_platform_init(void) 248 + int sp_platform_init(void) 249 249 { 250 - return platform_driver_register(&ccp_platform_driver); 250 + return platform_driver_register(&sp_platform_driver); 251 251 } 252 252 253 - void ccp_platform_exit(void) 253 + void sp_platform_exit(void) 254 254 { 255 - platform_driver_unregister(&ccp_platform_driver); 255 + platform_driver_unregister(&sp_platform_driver); 256 256 }
+6 -6
drivers/crypto/ccp/sp-dev.c
··· 242 242 #ifdef CONFIG_X86 243 243 int ret; 244 244 245 - ret = ccp_pci_init(); 245 + ret = sp_pci_init(); 246 246 if (ret) 247 247 return ret; 248 248 249 249 /* Don't leave the driver loaded if init failed */ 250 250 if (ccp_present() != 0) { 251 - ccp_pci_exit(); 251 + sp_pci_exit(); 252 252 return -ENODEV; 253 253 } 254 254 ··· 258 258 #ifdef CONFIG_ARM64 259 259 int ret; 260 260 261 - ret = ccp_platform_init(); 261 + ret = sp_platform_init(); 262 262 if (ret) 263 263 return ret; 264 264 265 265 /* Don't leave the driver loaded if init failed */ 266 266 if (ccp_present() != 0) { 267 - ccp_platform_exit(); 267 + sp_platform_exit(); 268 268 return -ENODEV; 269 269 } 270 270 ··· 277 277 static void __exit sp_mod_exit(void) 278 278 { 279 279 #ifdef CONFIG_X86 280 - ccp_pci_exit(); 280 + sp_pci_exit(); 281 281 #endif 282 282 283 283 #ifdef CONFIG_ARM64 284 - ccp_platform_exit(); 284 + sp_platform_exit(); 285 285 #endif 286 286 } 287 287