Lines Matching refs:psp
25 struct psp_device *psp; in psp_alloc_struct() local
27 psp = devm_kzalloc(dev, sizeof(*psp), GFP_KERNEL); in psp_alloc_struct()
28 if (!psp) in psp_alloc_struct()
31 psp->dev = dev; in psp_alloc_struct()
32 psp->sp = sp; in psp_alloc_struct()
34 snprintf(psp->name, sizeof(psp->name), "psp-%u", sp->ord); in psp_alloc_struct()
36 return psp; in psp_alloc_struct()
41 struct psp_device *psp = data; in psp_irq_handler() local
45 status = ioread32(psp->io_regs + psp->vdata->intsts_reg); in psp_irq_handler()
48 iowrite32(status, psp->io_regs + psp->vdata->intsts_reg); in psp_irq_handler()
52 if (psp->sev_irq_handler) in psp_irq_handler()
53 psp->sev_irq_handler(irq, psp->sev_irq_data, status); in psp_irq_handler()
59 static unsigned int psp_get_capability(struct psp_device *psp) in psp_get_capability() argument
61 unsigned int val = ioread32(psp->io_regs + psp->vdata->feature_reg); in psp_get_capability()
71 dev_notice(psp->dev, "psp: unable to access the device: you might be running a broken BIOS.\n"); in psp_get_capability()
74 psp->capability = val; in psp_get_capability()
77 if (psp->capability & PSP_CAPABILITY_PSP_SECURITY_REPORTING && in psp_get_capability()
78 psp->capability & (PSP_SECURITY_TSME_STATUS << PSP_CAPABILITY_PSP_SECURITY_OFFSET) && in psp_get_capability()
80 …dev_notice(psp->dev, "psp: Both TSME and SME are active, SME is unnecessary when TSME is active.\n… in psp_get_capability()
85 static int psp_check_sev_support(struct psp_device *psp) in psp_check_sev_support() argument
88 if (!(psp->capability & PSP_CAPABILITY_SEV)) { in psp_check_sev_support()
89 dev_dbg(psp->dev, "psp does not support SEV\n"); in psp_check_sev_support()
96 static int psp_check_tee_support(struct psp_device *psp) in psp_check_tee_support() argument
99 if (!(psp->capability & PSP_CAPABILITY_TEE)) { in psp_check_tee_support()
100 dev_dbg(psp->dev, "psp does not support TEE\n"); in psp_check_tee_support()
107 static void psp_init_platform_access(struct psp_device *psp) in psp_init_platform_access() argument
111 ret = platform_access_dev_init(psp); in psp_init_platform_access()
113 dev_warn(psp->dev, "platform access init failed: %d\n", ret); in psp_init_platform_access()
118 ret = dbc_dev_init(psp); in psp_init_platform_access()
120 dev_warn(psp->dev, "failed to init dynamic boost control: %d\n", in psp_init_platform_access()
124 static int psp_init(struct psp_device *psp) in psp_init() argument
128 if (!psp_check_sev_support(psp)) { in psp_init()
129 ret = sev_dev_init(psp); in psp_init()
134 if (!psp_check_tee_support(psp)) { in psp_init()
135 ret = tee_dev_init(psp); in psp_init()
140 if (psp->vdata->platform_access) in psp_init()
141 psp_init_platform_access(psp); in psp_init()
149 struct psp_device *psp; in psp_dev_init() local
153 psp = psp_alloc_struct(sp); in psp_dev_init()
154 if (!psp) in psp_dev_init()
157 sp->psp_data = psp; in psp_dev_init()
159 psp->vdata = (struct psp_vdata *)sp->dev_vdata->psp_vdata; in psp_dev_init()
160 if (!psp->vdata) { in psp_dev_init()
166 psp->io_regs = sp->io_map; in psp_dev_init()
168 ret = psp_get_capability(psp); in psp_dev_init()
173 iowrite32(0, psp->io_regs + psp->vdata->inten_reg); in psp_dev_init()
174 iowrite32(-1, psp->io_regs + psp->vdata->intsts_reg); in psp_dev_init()
177 ret = sp_request_psp_irq(psp->sp, psp_irq_handler, psp->name, psp); in psp_dev_init()
184 if (psp->sp->set_psp_master_device) in psp_dev_init()
185 psp->sp->set_psp_master_device(psp->sp); in psp_dev_init()
187 ret = psp_init(psp); in psp_dev_init()
192 iowrite32(-1, psp->io_regs + psp->vdata->inten_reg); in psp_dev_init()
202 sp_free_psp_irq(psp->sp, psp); in psp_dev_init()
218 struct psp_device *psp = sp->psp_data; in psp_dev_destroy() local
220 if (!psp) in psp_dev_destroy()
223 sev_dev_destroy(psp); in psp_dev_destroy()
225 tee_dev_destroy(psp); in psp_dev_destroy()
227 dbc_dev_destroy(psp); in psp_dev_destroy()
229 platform_access_dev_destroy(psp); in psp_dev_destroy()
231 sp_free_psp_irq(sp, psp); in psp_dev_destroy()
237 void psp_set_sev_irq_handler(struct psp_device *psp, psp_irq_handler_t handler, in psp_set_sev_irq_handler() argument
240 psp->sev_irq_data = data; in psp_set_sev_irq_handler()
241 psp->sev_irq_handler = handler; in psp_set_sev_irq_handler()
244 void psp_clear_sev_irq_handler(struct psp_device *psp) in psp_clear_sev_irq_handler() argument
246 psp_set_sev_irq_handler(psp, NULL, NULL); in psp_clear_sev_irq_handler()