[PATCH v1] config-tools: board inspector exits if the VMD is configured


Yang, Yu-chu
 

From: yuchuyang <yu-chu.yang@...>

Board inspector does not support multiple PCI segment. Stop running and
throw out the message for user to disable VMD from BIOS setting.

Signed-off-by: yuchuyang <yu-chu.yang@...>
---
misc/config_tools/board_inspector/legacy/dmar.py | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/misc/config_tools/board_inspector/legacy/dmar.py b/misc/config_tools/board_inspector/legacy/dmar.py
index 6b0796d16..3d3c0b0ba 100644
--- a/misc/config_tools/board_inspector/legacy/dmar.py
+++ b/misc/config_tools/board_inspector/legacy/dmar.py
@@ -6,6 +6,7 @@
import sys
import ctypes
import parser_lib
+import logging

ACPI_DMAR_TYPE = {
'ACPI_DMAR_TYPE_HARDWARE_UNIT':0,
@@ -208,6 +209,9 @@ def get_secondary_bus(dmar_tbl, tmp_dev, tmp_fun):
if '.' not in line.strip():
continue

+ if len(line.strip().split()[0]) > 7:
+ logging.critical("Multiple PCI segment is not supported. Please disable VMD (Volume Management Device) from BIOS setting.")
+ sys.exit(1)
bus = int(line.strip().split(":")[0], 16)
dev = int(line.strip().split()[0].split(":")[1].split(".")[0], 16)
fun = int(line.strip().split()[0].split(":")[1].split(".")[1].strip(), 16)
--
2.25.1


Junjie Mao
 

-----Original Message-----
From: Yang, Yu-chu <yu-chu.yang@...>
Sent: Wednesday, November 9, 2022 6:05 AM
To: acrn-dev@...
Cc: Mao, Junjie <junjie.mao@...>
Subject: [PATCH v1] config-tools: board inspector exits if the VMD is configured

From: yuchuyang <yu-chu.yang@...>

Board inspector does not support multiple PCI segment. Stop running and
throw out the message for user to disable VMD from BIOS setting.
I just notice that, in the main board_inspector.py, there is a check named check_pci_domains() which is doing exactly the same check. You may test if that is already sufficient, and if the error message needs some polishment to callout VMD, feel free to change there.

---
Best Regards
Junjie Mao


Signed-off-by: yuchuyang <yu-chu.yang@...>
---
misc/config_tools/board_inspector/legacy/dmar.py | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/misc/config_tools/board_inspector/legacy/dmar.py
b/misc/config_tools/board_inspector/legacy/dmar.py
index 6b0796d16..3d3c0b0ba 100644
--- a/misc/config_tools/board_inspector/legacy/dmar.py
+++ b/misc/config_tools/board_inspector/legacy/dmar.py
@@ -6,6 +6,7 @@
import sys
import ctypes
import parser_lib
+import logging

ACPI_DMAR_TYPE = {
'ACPI_DMAR_TYPE_HARDWARE_UNIT':0,
@@ -208,6 +209,9 @@ def get_secondary_bus(dmar_tbl, tmp_dev, tmp_fun):
if '.' not in line.strip():
continue

+ if len(line.strip().split()[0]) > 7:
+ logging.critical("Multiple PCI segment is not supported. Please disable
VMD (Volume Management Device) from BIOS setting.")
+ sys.exit(1)
bus = int(line.strip().split(":")[0], 16)
dev = int(line.strip().split()[0].split(":")[1].split(".")[0], 16)
fun = int(line.strip().split()[0].split(":")[1].split(".")[1].strip(), 16)
--
2.25.1


Yang, Yu-chu
 

Hi Junjie,

Today I got a machine with VMD is enabled and tested the python scripts. Here is the result:
- check_pci_domains from board_inspector.py result:
Find all directories which are start with "pci" under "/sys/devices", it only returns one directory "pci0000:00"
- get_secondary_bus from dmar.py result:
This function runs "lspci -xxx" and returns the pci devices with domain "10000"


By running $ ls /sys/devices/ | grep "pci", it returns:
pci0000:00

By running $ ls -la /sys/bus/pci/devices, it returns:
...
lrwxrwxrwx 1 root root 0 7月 1 03:49 0000:00:1f.0 -> ../../../devices/pci0000:00/0000:00:1f.0
lrwxrwxrwx 1 root root 0 7月 1 03:49 0000:00:1f.4 -> ../../../devices/pci0000:00/0000:00:1f.4
lrwxrwxrwx 1 root root 0 7月 1 03:49 0000:00:1f.5 -> ../../../devices/pci0000:00/0000:00:1f.5
lrwxrwxrwx 1 root root 0 7月 1 03:49 0000:00:1f.6 -> ../../../devices/pci0000:00/0000:00:1f.6
lrwxrwxrwx 1 root root 0 7月 1 03:49 10000:e0:17.0 -> ../../../devices/pci0000:00/0000:00:0e.0/pci10000:e0/10000:e0:17.0
lrwxrwxrwx 1 root root 0 7月 1 03:49 10000:e0:1a.0 -> ../../../devices/pci0000:00/0000:00:0e.0/pci10000:e0/10000:e0:1a.0
lrwxrwxrwx 1 root root 0 7月 1 03:49 10000:e1:00.0 -> ../../../devices/pci0000:00/0000:00:0e.0/pci10000:e0/10000:e0:1a.0/10

Seems listing /sys/devices wouldn't find the pci devices whose domains are above 0.
Any suggestion how to improve "check_pci_domains" or it is ok to take this patch's change?

Thanks,
Yu-chu

-----Original Message-----
From: Mao, Junjie <junjie.mao@...>
Sent: Tuesday, November 8, 2022 4:01 PM
To: Yang, Yu-chu <yu-chu.yang@...>; acrn-dev@...
Subject: RE: [PATCH v1] config-tools: board inspector exits if the VMD is configured

-----Original Message-----
From: Yang, Yu-chu <yu-chu.yang@...>
Sent: Wednesday, November 9, 2022 6:05 AM
To: acrn-dev@...
Cc: Mao, Junjie <junjie.mao@...>
Subject: [PATCH v1] config-tools: board inspector exits if the VMD is
configured

From: yuchuyang <yu-chu.yang@...>

Board inspector does not support multiple PCI segment. Stop running
and throw out the message for user to disable VMD from BIOS setting.
I just notice that, in the main board_inspector.py, there is a check named check_pci_domains() which is doing exactly the same check. You may test if that is already sufficient, and if the error message needs some polishment to callout VMD, feel free to change there.

---
Best Regards
Junjie Mao


Signed-off-by: yuchuyang <yu-chu.yang@...>
---
misc/config_tools/board_inspector/legacy/dmar.py | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/misc/config_tools/board_inspector/legacy/dmar.py
b/misc/config_tools/board_inspector/legacy/dmar.py
index 6b0796d16..3d3c0b0ba 100644
--- a/misc/config_tools/board_inspector/legacy/dmar.py
+++ b/misc/config_tools/board_inspector/legacy/dmar.py
@@ -6,6 +6,7 @@
import sys
import ctypes
import parser_lib
+import logging

ACPI_DMAR_TYPE = {
'ACPI_DMAR_TYPE_HARDWARE_UNIT':0, @@ -208,6 +209,9 @@ def
get_secondary_bus(dmar_tbl, tmp_dev, tmp_fun):
if '.' not in line.strip():
continue

+ if len(line.strip().split()[0]) > 7:
+ logging.critical("Multiple PCI segment is not
+ supported. Please disable
VMD (Volume Management Device) from BIOS setting.")
+ sys.exit(1)
bus = int(line.strip().split(":")[0], 16)
dev = int(line.strip().split()[0].split(":")[1].split(".")[0], 16)
fun =
int(line.strip().split()[0].split(":")[1].split(".")[1].strip(), 16)
--
2.25.1


Junjie Mao
 

-----Original Message-----
From: Yang, Yu-chu <yu-chu.yang@...>
Sent: Friday, November 18, 2022 3:18 AM
To: Mao, Junjie <junjie.mao@...>
Cc: acrn-dev@...
Subject: RE: [PATCH v1] config-tools: board inspector exits if the VMD is configured

Hi Junjie,

Today I got a machine with VMD is enabled and tested the python scripts. Here is the
result:
- check_pci_domains from board_inspector.py result:
Find all directories which are start with "pci" under "/sys/devices", it only returns
one directory "pci0000:00"
- get_secondary_bus from dmar.py result:
This function runs "lspci -xxx" and returns the pci devices with domain "10000"


By running $ ls /sys/devices/ | grep "pci", it returns:
pci0000:00

By running $ ls -la /sys/bus/pci/devices, it returns:
...
lrwxrwxrwx 1 root root 0 7月 1 03:49 0000:00:1f.0 -
../../../devices/pci0000:00/0000:00:1f.0
lrwxrwxrwx 1 root root 0 7月 1 03:49 0000:00:1f.4 -
../../../devices/pci0000:00/0000:00:1f.4
lrwxrwxrwx 1 root root 0 7月 1 03:49 0000:00:1f.5 -
../../../devices/pci0000:00/0000:00:1f.5
lrwxrwxrwx 1 root root 0 7月 1 03:49 0000:00:1f.6 -
../../../devices/pci0000:00/0000:00:1f.6
lrwxrwxrwx 1 root root 0 7月 1 03:49 10000:e0:17.0 -
../../../devices/pci0000:00/0000:00:0e.0/pci10000:e0/10000:e0:17.0
lrwxrwxrwx 1 root root 0 7月 1 03:49 10000:e0:1a.0 -
../../../devices/pci0000:00/0000:00:0e.0/pci10000:e0/10000:e0:1a.0
lrwxrwxrwx 1 root root 0 7月 1 03:49 10000:e1:00.0 -
../../../devices/pci0000:00/0000:00:0e.0/pci10000:e0/10000:e0:1a.0/10
Seems listing /sys/devices wouldn't find the pci devices whose domains are above 0.
Any suggestion how to improve "check_pci_domains" or it is ok to take this patch's change?
In that case, how about refine check_pci_domains() to enumerate the symbolic links under /sys/bus/pci (instead of /sys/devices/pci*) and check if the PCI domain IDs are unique?

---
Best Regards
Junjie Mao


Thanks,
Yu-chu


-----Original Message-----
From: Mao, Junjie <junjie.mao@...>
Sent: Tuesday, November 8, 2022 4:01 PM
To: Yang, Yu-chu <yu-chu.yang@...>; acrn-dev@...
Subject: RE: [PATCH v1] config-tools: board inspector exits if the VMD is configured

-----Original Message-----
From: Yang, Yu-chu <yu-chu.yang@...>
Sent: Wednesday, November 9, 2022 6:05 AM
To: acrn-dev@...
Cc: Mao, Junjie <junjie.mao@...>
Subject: [PATCH v1] config-tools: board inspector exits if the VMD is
configured

From: yuchuyang <yu-chu.yang@...>

Board inspector does not support multiple PCI segment. Stop running
and throw out the message for user to disable VMD from BIOS setting.
I just notice that, in the main board_inspector.py, there is a check named
check_pci_domains() which is doing exactly the same check. You may test if that is already
sufficient, and if the error message needs some polishment to callout VMD, feel free to
change there.

---
Best Regards
Junjie Mao


Signed-off-by: yuchuyang <yu-chu.yang@...>
---
misc/config_tools/board_inspector/legacy/dmar.py | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/misc/config_tools/board_inspector/legacy/dmar.py
b/misc/config_tools/board_inspector/legacy/dmar.py
index 6b0796d16..3d3c0b0ba 100644
--- a/misc/config_tools/board_inspector/legacy/dmar.py
+++ b/misc/config_tools/board_inspector/legacy/dmar.py
@@ -6,6 +6,7 @@
import sys
import ctypes
import parser_lib
+import logging

ACPI_DMAR_TYPE = {
'ACPI_DMAR_TYPE_HARDWARE_UNIT':0, @@ -208,6 +209,9 @@ def
get_secondary_bus(dmar_tbl, tmp_dev, tmp_fun):
if '.' not in line.strip():
continue

+ if len(line.strip().split()[0]) > 7:
+ logging.critical("Multiple PCI segment is not
+ supported. Please disable
VMD (Volume Management Device) from BIOS setting.")
+ sys.exit(1)
bus = int(line.strip().split(":")[0], 16)
dev = int(line.strip().split()[0].split(":")[1].split(".")[0], 16)
fun =
int(line.strip().split()[0].split(":")[1].split(".")[1].strip(), 16)
--
2.25.1