• Home
  • Raw
  • Download

Lines Matching refs:sev

64 	struct sev_device *sev = psp_master->sev_data;  in sev_version_greater_or_equal()  local
66 if (sev->api_major > maj) in sev_version_greater_or_equal()
69 if (sev->api_major == maj && sev->api_minor >= min) in sev_version_greater_or_equal()
77 struct sev_device *sev = data; in sev_irq_handler() local
85 reg = ioread32(sev->io_regs + sev->vdata->cmdresp_reg); in sev_irq_handler()
87 sev->int_rcvd = 1; in sev_irq_handler()
88 wake_up(&sev->int_queue); in sev_irq_handler()
92 static int sev_wait_cmd_ioc(struct sev_device *sev, in sev_wait_cmd_ioc() argument
97 ret = wait_event_timeout(sev->int_queue, in sev_wait_cmd_ioc()
98 sev->int_rcvd, timeout * HZ); in sev_wait_cmd_ioc()
102 *reg = ioread32(sev->io_regs + sev->vdata->cmdresp_reg); in sev_wait_cmd_ioc()
159 struct sev_device *sev; in __sev_do_cmd_locked() local
170 sev = psp->sev_data; in __sev_do_cmd_locked()
182 memcpy(sev->cmd_buf, data, buf_len); in __sev_do_cmd_locked()
185 phys_lsb = data ? lower_32_bits(__psp_pa(sev->cmd_buf)) : 0; in __sev_do_cmd_locked()
186 phys_msb = data ? upper_32_bits(__psp_pa(sev->cmd_buf)) : 0; in __sev_do_cmd_locked()
188 dev_dbg(sev->dev, "sev command id %#x buffer 0x%08x%08x timeout %us\n", in __sev_do_cmd_locked()
194 iowrite32(phys_lsb, sev->io_regs + sev->vdata->cmdbuff_addr_lo_reg); in __sev_do_cmd_locked()
195 iowrite32(phys_msb, sev->io_regs + sev->vdata->cmdbuff_addr_hi_reg); in __sev_do_cmd_locked()
197 sev->int_rcvd = 0; in __sev_do_cmd_locked()
202 iowrite32(reg, sev->io_regs + sev->vdata->cmdresp_reg); in __sev_do_cmd_locked()
205 ret = sev_wait_cmd_ioc(sev, &reg, psp_timeout); in __sev_do_cmd_locked()
210 dev_err(sev->dev, "sev command %#x timed out, disabling PSP\n", cmd); in __sev_do_cmd_locked()
222 dev_dbg(sev->dev, "sev command %#x failed (%#010x)\n", in __sev_do_cmd_locked()
235 memcpy(data, sev->cmd_buf, buf_len); in __sev_do_cmd_locked()
255 struct sev_device *sev; in __sev_platform_init_locked() local
261 sev = psp->sev_data; in __sev_platform_init_locked()
263 if (sev->state == SEV_STATE_INIT) in __sev_platform_init_locked()
290 dev_dbg(sev->dev, "SEV: retrying INIT command"); in __sev_platform_init_locked()
299 sev->state = SEV_STATE_INIT; in __sev_platform_init_locked()
307 dev_dbg(sev->dev, "SEV firmware initialized\n"); in __sev_platform_init_locked()
327 struct sev_device *sev; in __sev_platform_shutdown_locked() local
333 sev = psp->sev_data; in __sev_platform_shutdown_locked()
335 if (sev->state == SEV_STATE_UNINIT) in __sev_platform_shutdown_locked()
342 sev->state = SEV_STATE_UNINIT; in __sev_platform_shutdown_locked()
343 dev_dbg(sev->dev, "SEV firmware shutdown\n"); in __sev_platform_shutdown_locked()
423 struct sev_device *sev = psp_master->sev_data; in sev_ioctl_do_pek_pdh_gen() local
429 if (sev->state == SEV_STATE_UNINIT) { in sev_ioctl_do_pek_pdh_gen()
440 struct sev_device *sev = psp_master->sev_data; in sev_ioctl_do_pek_csr() local
472 if (sev->state == SEV_STATE_UNINIT) { in sev_ioctl_do_pek_csr()
513 struct sev_device *sev = psp_master->sev_data; in sev_get_api_version() local
519 dev_err(sev->dev, in sev_get_api_version()
524 sev->api_major = status.api_major; in sev_get_api_version()
525 sev->api_minor = status.api_minor; in sev_get_api_version()
526 sev->build = status.build; in sev_get_api_version()
527 sev->state = status.state; in sev_get_api_version()
623 struct sev_device *sev = psp_master->sev_data; in sev_ioctl_do_pek_import() local
655 if (sev->state != SEV_STATE_INIT) { in sev_ioctl_do_pek_import()
774 struct sev_device *sev = psp_master->sev_data; in sev_ioctl_do_pdh_export() local
783 if (sev->state != SEV_STATE_INIT) { in sev_ioctl_do_pdh_export()
969 static int sev_misc_init(struct sev_device *sev) in sev_misc_init() argument
971 struct device *dev = sev->dev; in sev_misc_init()
1002 init_waitqueue_head(&sev->int_queue); in sev_misc_init()
1003 sev->misc = misc_dev; in sev_misc_init()
1012 struct sev_device *sev; in sev_dev_init() local
1020 sev = devm_kzalloc(dev, sizeof(*sev), GFP_KERNEL); in sev_dev_init()
1021 if (!sev) in sev_dev_init()
1024 sev->cmd_buf = (void *)devm_get_free_pages(dev, GFP_KERNEL, 0); in sev_dev_init()
1025 if (!sev->cmd_buf) in sev_dev_init()
1028 psp->sev_data = sev; in sev_dev_init()
1030 sev->dev = dev; in sev_dev_init()
1031 sev->psp = psp; in sev_dev_init()
1033 sev->io_regs = psp->io_regs; in sev_dev_init()
1035 sev->vdata = (struct sev_vdata *)psp->vdata->sev; in sev_dev_init()
1036 if (!sev->vdata) { in sev_dev_init()
1042 psp_set_sev_irq_handler(psp, sev_irq_handler, sev); in sev_dev_init()
1044 ret = sev_misc_init(sev); in sev_dev_init()
1055 devm_free_pages(dev, (unsigned long)sev->cmd_buf); in sev_dev_init()
1057 devm_kfree(dev, sev); in sev_dev_init()
1066 static void sev_firmware_shutdown(struct sev_device *sev) in sev_firmware_shutdown() argument
1082 struct sev_device *sev = psp->sev_data; in sev_dev_destroy() local
1084 if (!sev) in sev_dev_destroy()
1087 sev_firmware_shutdown(sev); in sev_dev_destroy()
1089 if (sev->misc) in sev_dev_destroy()
1107 struct sev_device *sev = psp_master->sev_data; in sev_pci_init() local
1110 if (!sev) in sev_pci_init()
1119 sev_update_firmware(sev->dev) == 0) in sev_pci_init()
1128 dev_warn(sev->dev, in sev_pci_init()
1134 dev_err(sev->dev, "SEV: failed to INIT error %#x\n", error); in sev_pci_init()
1138 dev_info(sev->dev, "SEV API:%d.%d build:%d\n", sev->api_major, in sev_pci_init()
1139 sev->api_minor, sev->build); in sev_pci_init()
1149 struct sev_device *sev = psp_master->sev_data; in sev_pci_exit() local
1151 if (!sev) in sev_pci_exit()
1154 sev_firmware_shutdown(sev); in sev_pci_exit()