Unverified Commit fa07ec17 authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!5212 [OLK-6.6] Support PSPCCP/NTBCCP identification for Hygon 2th and 3th CPU

Merge Pull Request from: @hanliyang 
 
Support PSPCCP/NTBCCP identification for Hygon 2th and 3th CPU

issue:
https://gitee.com/openeuler/kernel/issues/I98KYI

PSPCCP is the device which includes Platform Secure Processor and Cryptographic Co-Processor
in Hygon CPU, NTBCCP is Cryptographic Co-Processor in Hygon CPU. On Hygon 2nd/3rd CPUs, PSPCCP
is pci device with vendor/device ID as 0x1d94/0x1456, NTBCCP is pci device with vendor/device ID
as 0x1d94/0x1468. This PR add the PSPCCP/NTBCCP ids to pci table id list for ccp module so that
the ccp driver can be bind to PSPCCP/NTBCCP.

Test:
The lspci tool indicates that the PSPCCP/NTBCCP are binds to ccp driver. 
 
Link:https://gitee.com/openeuler/kernel/pulls/5212

 

Reviewed-by: default avatarXiongfeng Wang <wangxiongfeng2@huawei.com>
Signed-off-by: default avatarZheng Zengkai <zhengzengkai@huawei.com>
parents 90208564 0eb46692
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -56,6 +56,13 @@ static irqreturn_t psp_irq_handler(int irq, void *data)
	return IRQ_HANDLED;
}

static void hygon_fixup_psp_caps(struct psp_device *psp)
{
	if (boot_cpu_data.x86_vendor == X86_VENDOR_HYGON)
		psp->capability &= ~(PSP_CAPABILITY_TEE |
				     PSP_CAPABILITY_PSP_SECURITY_REPORTING);
}

static unsigned int psp_get_capability(struct psp_device *psp)
{
	unsigned int val = ioread32(psp->io_regs + psp->vdata->feature_reg);
@@ -73,6 +80,12 @@ static unsigned int psp_get_capability(struct psp_device *psp)
	}
	psp->capability = val;

	/*
	 * Fix capability of Hygon psp, the meaning of Hygon psp feature
	 * register is not exactly the same as AMD.
	 */
	hygon_fixup_psp_caps(psp);

	/* Detect if TSME and SME are both enabled */
	if (psp->capability & PSP_CAPABILITY_PSP_SECURITY_REPORTING &&
	    psp->capability & (PSP_SECURITY_TSME_STATUS << PSP_CAPABILITY_PSP_SECURITY_OFFSET) &&
+2 −0
Original line number Diff line number Diff line
@@ -576,6 +576,8 @@ static const struct pci_device_id sp_pci_table[] = {
	{ PCI_VDEVICE(AMD, 0x1649), (kernel_ulong_t)&dev_vdata[6] },
	{ PCI_VDEVICE(AMD, 0x17E0), (kernel_ulong_t)&dev_vdata[7] },
	{ PCI_VDEVICE(AMD, 0x156E), (kernel_ulong_t)&dev_vdata[8] },
	{ PCI_VDEVICE(HYGON, 0x1456), (kernel_ulong_t)&dev_vdata[1] },
	{ PCI_VDEVICE(HYGON, 0x1468), (kernel_ulong_t)&dev_vdata[2] },
	/* Last entry must be zero */
	{ 0, }
};