Skip to contentSkip to conversation

Question about the cpu_uid parameter of acpi_evaluate_dsm() in PCI/TPH

DISCUSSION fengchengwen 1 participant 1 message Mar 13 4 messages not in the archive PCI

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): [email protected]

#4 lore raw
Quoted 90 lines · Wei Huang
Quoted 70 lines · fengchengwen

Hi Wei,

Quoted 46 lines · Wei
Quoted 23 lines · fengchengwen

Hi Wei, Eric,

I noticed that you submitted a commit [1] that supports PCI/TPH. We want to evaluate whether this feature is supported on the Kunpeng platform. Currently, we have encountered a problem. Please confirm it. Thank you.

The problem:
1. In pcie_tph_get_cpu_st() function, the input parameter cpu_uid is directly transferred to the dsm method as the ACPI parameter.

    int pcie_tph_get_cpu_st(struct pci_dev *pdev, enum tph_mem_type mem_type,
			unsigned int cpu_uid, u16 *tag)
    {
    	...
	if (tph_invoke_dsm(rp_acpi_handle, cpu_uid, &info) != AE_OK) {
		*tag = 0;
		return -EINVAL;
	}
    	...
    }
    static acpi_status tph_invoke_dsm(acpi_handle handle, u32 cpu_uid,
				  union st_info *st_out)
    {
Quoted 8 lines
    	...
	/* DWORD: target UID */
	arg3[1].integer.type = ACPI_TYPE_INTEGER;
	arg3[1].integer.value = cpu_uid;
        ...
	out_obj = acpi_evaluate_dsm(handle, &pci_acpi_dsm_guid, 7,
				    TPH_ST_DSM_FUNC_INDEX, &in_obj);
    }

Correct. According to _DSM ECN, the input is defined as: "If the target is a processor, then this field represents the ACPI Processor UID of the processor as specified in the MADT. If the target is a processor container, then this field represents the ACPI Processor UID of the processor container as specified in the PPTT"

Quoted 4 lines

2. In the Broadcom driver implementation [2], cpu_uid is obtained based on cpumask_first(irq->cpu_mask), the returned value is the logical ID of a CPU core, which is generated and managed by the Linux kernel. E.g. [0,255] if the system has 256 logical CPU core.

Correct.

Quoted 8 lines
Quoted 4 lines

3. In order to obtain ST (steer-tag), we need to get physical core info (e.g. MPIDR in Kunpeng platform), The problem is how does the ACPI know the physical core info corresponding to the logical ID of the CPU core? The ACPI don't know how the logical ID definition.

This was a problem we encountered. "Fortunately" the mapping between logic ID and ACPI _UID is similar on AMD platform. We didn't encounter too many issues in this area.

Okay, so for AMD platform, the logic ID equal ACPI_UID, so there is no need to convert the logic ID to ACPI_UID (as we see in the code the cpu_uid was directly passed to dsm).

Quoted 8 lines
Quoted 4 lines

4. One of my guess is that ACPI reports the SRAT table and reports the system CPU core information in sequence. Is it based on this sequence to search for the corresponding physical core information in the ACPI when process above DSM method?

So you don't seem to be concerned with logic_id <=> acpi_uid. Instead, you want to know how does ACPI convert the acpi_uid into a corresponding phys_id when it receives an _DSM call, right? If this is the case, I

Quoted 5 lines

Yes, there are two part:
1) The first is PCI driver convert logic_id to acpi_uid. Because the logic_id may not equal acpi_uid in Kunpeng platform, This is our biggest puzzle, but it's clear now: we need another patch do the converation if following _DSM ECN.

Let me know your findings on Kunpeng platform. If there is a need to tweak code for this area, we can do it together.

Quoted 9 lines

2) The ACPI convert acpi_uid to it's phy_id(e.g. MPIDR)

Quoted 3 lines

think system firmware already knows about it. If you look at MADT table, which is also available on ARM platform, the Type 0xB processor structure should already have such info.

Yes, the MADT table seemed could do that.

Quoted 7 lines
Quoted 5 lines

Thank you for your clarification.

Currently, this feature only support in host kernel, from your slide [1], your team was developing TPH virtualization, do you have any public channels (like slack) that we can participate in?

Yes, a prototype was completed. I have a code base sitting in a private github tree. Give me a bit time to clean up and I will share it with you and the public as soon as possible (ping me if it lags behind).

Kindly ping.

I am not clear about the specific solution. I guess your changes might involve vfio-pci and qemu. Could you please send the modifications to vfio-pci for review first, so that the host userspace (such as DPDK) can also move forward based on this?

Thanks

Quoted 11 lines
Quoted 4 lines

We also want to enable this feature in DPDK, ps: it already has such commit [2] but seemed has no progress.

I was aware of this code, but didn't follow closely. Let me forward it to AMD related team and maybe they can help to test and push it forward.

Quoted 4 lines

[1] https://lpc.events/event/19/contributions/2249/attachments/1919/4103/SDCI_TPH_LPC_2025_Slides_Final.pdf
[2] https://mails.dpdk.org/archives/dev/2025-June/318908.html