Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Deepin-Kernel-SIG] [deepin] PCI: Add ACS override support for debug #396

Conversation

opsiff
Copy link
Member

@opsiff opsiff commented Sep 2, 2024

@opsiff opsiff changed the title deepin: PCI: Add ACS override support for debug [Deepin-Kernel-SIG] [deepin] PCI: Add ACS override support for debug Sep 2, 2024
@Avenger-285714
Copy link
Collaborator

为什么这个东西没有被上游化?

also used in other distro kernel like fedroa and zen

Link:https://lkml.org/lkml/2013/5/30/513

Source: https://gitlab.com/Queuecumber/linux-acs-override/-/raw/master/workspaces/5.10.4/acso.patch

PCIe ACS (Access Control Services) is the PCIe 2.0+ feature that
allows us to control whether transactions are allowed to be redirected
in various subnodes of a PCIe topology.  For instance, if two
endpoints are below a root port or downsteam switch port, the
downstream port may optionally redirect transactions between the
devices, bypassing upstream devices.  The same can happen internally
on multifunction devices.  The transaction may never be visible to the
upstream devices.

One upstream device that we particularly care about is the IOMMU.  If
a redirection occurs in the topology below the IOMMU, then the IOMMU
cannot provide isolation between devices.  This is why the PCIe spec
encourages topologies to include ACS support.  Without it, we have to
assume peer-to-peer DMA within a hierarchy can bypass IOMMU isolation.

Unfortunately, far too many topologies do not support ACS to make this
a steadfast requirement.  Even the latest chipsets from Intel are only
sporadically supporting ACS.  We have trouble getting interconnect
vendors to include the PCIe spec required PCIe capability, let alone
suggested features.

Therefore, we need to add some flexibility.  The pcie_acs_override=
boot option lets users opt-in specific devices or sets of devices to
assume ACS support.  The "downstream" option assumes full ACS support
on root ports and downstream switch ports.  The "multifunction"
option assumes the subset of ACS features available on multifunction
endpoints and upstream switch ports are supported.  The "id:nnnn:nnnn"
option enables ACS support on devices matching the provided vendor
and device IDs, allowing more strategic ACS overrides.  These options
may be combined in any order.  A maximum of 16 id specific overrides
are available.  It's suggested to use the most limited set of options
necessary to avoid completely disabling ACS across the topology.

Note to hardware vendors, we have facilities to permanently quirk
specific devices which enforce isolation but not provide an ACS
capability.  Please contact me to have your devices added and save
your customers the hassle of this boot option.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Wentao Guan <guanwentao@uniontech.com>
@opsiff opsiff force-pushed the support-for-pcie_acs_override branch from 365e729 to 379062c Compare September 3, 2024 07:38
@deepin-ci-robot
Copy link

deepin pr auto review

关键摘要:

  • pcie_acs_override_setup函数中,字符串比较应该使用strncmp_s函数来避免缓冲区溢出风险。
  • pcie_acs_overrides函数中的switch语句可以简化为一个if-else结构,以提高代码的可读性。
  • pcie_acs_overrides函数中的pci_pcie_type函数调用可能需要检查返回值,以确保正确获取设备类型。
  • acs_on_ids数组的大小NUM_ACS_IDS应该在编译时定义,而不是在代码中动态分配。
  • early_param函数调用中的参数pcie_acs_override_setup应该是一个函数指针,而不是一个函数的直接调用。
  • pcie_acs_overrides函数中的return 1;语句应该在acs_on_ids数组中找到匹配的ID时返回,而不是在switch语句中。

是否建议立即修改:

@deepin-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please ask for approval from opsiff. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@opsiff
Copy link
Member Author

opsiff commented Sep 4, 2024

为什么这个东西没有被上游化?

看邮件列表里面的意思是用户配置不正确可能影响内核稳定性

@Avenger-285714 Avenger-285714 merged commit f53a7c7 into deepin-community:linux-6.6.y Sep 5, 2024
4 of 6 checks passed
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