Skip to content

Conversation

@sdurawa
Copy link
Owner

@sdurawa sdurawa commented Oct 21, 2024

VMD PCH rootbus implementation

Copy link

@mtkaczyk mtkaczyk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

patch 1 review
for title I suggest to remove reference to Intel CPU code number (not needed here):

PCI: vmd: Clean up vmd_enable_domain function
This function is too long and needs to be shortened to make it more readable.

This clean up is a prework for enablement additional VMD bus range. It doesn't change
Functional behavior of vmd_enable_domain().

Suggested-by: Nirmal Patel <[email protected]>
Signed-off-by: Szymon Durawa <[email protected]>

typo beahvior

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've never seen something like that before, probably visual formatting.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not acceptable:

Suggested change
max_buses = resource_size(&vmd->resources[VMD_RESOURCE_CFGBAR]);
u16 bus;
u16 max_buses = resource_size(&vmd->resources[VMD_RESOURCE_CFGBAR]);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For sure, it is badly formatted.

Suggested change
&vmd->resources[VMD_RESOURCE_MEMBAR_1];
struct x *vmd_membar1_res=&vmd->dev->resource[VMD_MEMBAR1];
struct x *vmd_membar2_res =&vmd->dev->resource[VMD_MEMBAR2];
vmd_membar1_res->child =&vmd->dev->resource[VMD_MEMBAR1];
vmd_membar2_res->child =&vmd->dev->resource[VMD_MEMBAR2];

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
struct resource *res;
struct resource *res = &vmd->dev->resource[VMD_CFGBAR];

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Highlight that it can be NULL.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean @parent lol :)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you say type but the name has number

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

generally overwriting income parameter is bad practice, maybe better. use inline if?

		.parent = parent ? parent : res;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like bad formatting to me, please look into kernel, how they solve this :)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bad formatting.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bad formating

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can move it up to previous line, lgtm anyway

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if this is correct in kernel coding style :(

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

consider shorter naming for variables.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

formating

Szymon Durawa added 3 commits October 22, 2024 17:31
This function is too long and needs to be shortened to make it more readable.
Certain VMD devices like Intel Arrow Lake has two bus ranges, current
implementation supports only one range. This clean up is a prework for
enablement additional VMD bus range. It doesn't change functional
behavior of vmd_enable_domain().

Suggested-by: Nirmal Patel <[email protected]>
Reviewed-by: Mariusz Tkaczyk <[email protected]>
Signed-off-by: Szymon Durawa <[email protected]>
Starting from Intel Arrow Lake VMD enhacement introduces separate
rotbus for PCH. It means that all 3 MMIO BARs exposed by VMD are
shared now between CPU IOC and PCH. This patch adds PCH bus
enumeration and MMIO management for devices with VMD enhancement
support.

Suggested-by: Nirmal Patel <[email protected]>
Reviewed-by: Mariusz Tkaczyk <[email protected]>
Signed-off-by: Szymon Durawa <[email protected]>
VMD PCH rootbus primary number is 0x80 and pci_scan_bridge_extend()
cannot assign it as "hard-wired to 0" and marks setup as broken. To
avoid this, PCH bus number has to be the same as PCH primary number.

Suggested-by: Nirmal Patel <[email protected]>
Reviewed-by: Mariusz Tkaczyk <[email protected]>
Signed-off-by: Szymon Durawa <[email protected]>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I mean @parent lol :)

pci_add_resource_offset(&resources_pch,
&vmd->resources[VMD_RES_PCH_MEMBAR_2], offset[1]);

vmd->bus[VMD_ROOTBUS_1] = pci_create_root_bus(

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this formatting is bad.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants