Add device-path command.
PATCH 1/1 Add device-path command.
This patch adds device-path command that converts SBDF into device path.
'SBDF' format is "[SEG#:]BUS#:DEV#.FUNC#"
ex) 0000:0a:1f.3
Device path format is "HID[:UID]-DEV#.FUNC#[-DEV#.FUNC#[...]]"
ex) PNP0A08:0-2.0-0.0
The command can be executed as follows.
# device_path 0a:1f.3 PNP0A08:0-2.0-0.0
Thanks,
--
Yuji Shimada
Makefile +1 -1
@@ -224,7 +224,7 @@ rm -rf $(D)$(LIBDIR)/xen/ rm -rf $(D)/usr/lib/xen/ rm -rf $(D)/usr/local/sbin/setmask $(D)/usr/local/sbin/xen* - rm -rf $(D)/usr/sbin/xen* $(D)/usr/sbin/netfix $(D)/usr/sbin/xm + rm -rf $(D)/usr/sbin/xen* $(D)/usr/sbin/netfix $(D)/usr/sbin/xm $(D)/usr/sbin/device-path rm -rf $(D)/usr/share/doc/xen rm -rf $(D)/usr/share/xen rm -rf $(D)/usr/share/man/man1/xen*
tools/misc/Makefile +1 -1
@@ -22,7 +22,7 @@ INSTALL_BIN-$(CONFIG_X86) += xen-detect INSTALL_BIN := $(INSTALL_BIN-y) -INSTALL_SBIN-y := netfix xm xen-bugtool xen-python-path xend xenperf xsview xenpm +INSTALL_SBIN-y := netfix xm xen-bugtool xen-python-path xend xenperf xsview xenpm device-path INSTALL_SBIN := $(INSTALL_SBIN-y) DEFAULT_PYTHON_PATH := $(shell $(XEN_ROOT)/tools/python/get-path)
tools/misc/device-path new file +78 -0
78 lines not on this page · raw message
Quoted 2 lines · Yuji Shimada
This patch adds device-path command that converts SBDF into device path.
[snip]
Quoted 3 lines
diff -r
5a60eb7fad79tools/misc/device-pathtools/misc/device-path new file +0
-0
[snip]
Quoted 10 lines
tools/misc/device-path new file +10
-0+SYSFS_ACPI_DEVS_PATH = '/firmware/acpi/namespace/ACPI/_SB' + +def find_hid_uid(dom, b, d, f): + sb_path = find_sysfs_mnt() + SYSFS_ACPI_DEVS_PATH + obj_list = os.listdir(sb_path) + for obj in obj_list: + obj_path = sb_path + '/' + obj.strip() + '/' + if os.path.exists(obj_path + 'seg') and \ + os.path.exists(obj_path + 'bbn'): + seg = open(obj_path + 'seg').read()
tools/misc/device-path line 53
Quoted 10 lines
tools/misc/device-path new file +10
-0+ bbn = open(obj_path + 'bbn').read() + if int(seg) == dom and int(bbn) == b: + hid = open(obj_path + 'hid').read() + if os.path.exists(obj_path + 'uid') is False: + path_str = hid.strip() + else: + uid = open(obj_path + 'uid').read() + path_str = hid.strip() + ':' + uid.strip() + return path_str + return None
I don't know how critical this piece of code is to the overall functionality in this tool, but be warned that the path being used here was removed from sysfs in upstream kernel quite a while ago
To quote an old copy of Documentation/feature-removal-schedule.txt
What: /sys/firmware/acpi/namespace When: 2.6.21 Why: The ACPI namespace is effectively the symbol list for
the BIOS. The device names are completely arbitrary and have no place being exposed to user-space.
For those interested in the BIOS ACPI namespace, the BIOS can be extracted and disassembled with acpidump and iasl as documented in the pmtools package here:
http://ftp.kernel.org/pub/linux/kernel/people/lenb/acpi/utils
Regards,
Daniel
Signature · 4 lines
|: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|
Quoted 3 lines · Daniel P. Berrange
I don't know how critical this piece of code is to the overall functionality in this tool, but be warned that the path being used here was removed from sysfs in upstream kernel quite a while ago
That makes the script not very generally usable then. Unless there is some other way to get this info easily, I'll just revert the changeset that checked it in.
-- Keir
Quoted 43 lines · On Mon, 6 Apr 2009 15:06:00 +0100 "Daniel P. Berrange" <[email protected]>…
Quoted 2 lines · Yuji Shimada
This patch adds device-path command that converts SBDF into device path.
[snip]
Quoted 3 lines
diff -r
5a60eb7fad79tools/misc/device-pathtools/misc/device-path new file +0
-0[snip]
Quoted 10 lines
tools/misc/device-path new file +10
-0+SYSFS_ACPI_DEVS_PATH = '/firmware/acpi/namespace/ACPI/_SB' + +def find_hid_uid(dom, b, d, f): + sb_path = find_sysfs_mnt() + SYSFS_ACPI_DEVS_PATH + obj_list = os.listdir(sb_path) + for obj in obj_list: + obj_path = sb_path + '/' + obj.strip() + '/' + if os.path.exists(obj_path + 'seg') and \ + os.path.exists(obj_path + 'bbn'): + seg = open(obj_path + 'seg').read()tools/misc/device-path line 53
Quoted 10 lines
tools/misc/device-path new file +10
-0+ bbn = open(obj_path + 'bbn').read() + if int(seg) == dom and int(bbn) == b: + hid = open(obj_path + 'hid').read() + if os.path.exists(obj_path + 'uid') is False: + path_str = hid.strip() + else: + uid = open(obj_path + 'uid').read() + path_str = hid.strip() + ':' + uid.strip() + return path_str + return NoneI don't know how critical this piece of code is to the overall functionality in this tool, but be warned that the path being used here was removed from sysfs in upstream kernel quite a while ago
To quote an old copy of
Documentation/feature-removal-schedule.txtWhat: /sys/firmware/acpi/namespace When: 2.6.21 Why: The ACPI namespace is effectively the symbol list for
Quoted 8 lines
the BIOS. The device names are completely arbitrary and have no place being exposed to user-space.
For those interested in the BIOS ACPI namespace, the BIOS can be extracted and disassembled with acpidump and iasl as documented in the pmtools package here:
http://ftp.kernel.org/pub/linux/kernel/people/lenb/acpi/utils
It is difficult for users to get device path of particular device. So I made this command that converts SBDF into device path.
SBDF of devices can be changed at boot time. But device path is not changed at boot time.
I have already added the function to specify guest passthrough device by device path with "guestdev" boot parameter.
The linux-2.6.18-xen kernel changeset is the following.
# changeset fad85221407bf32df2574bca54cba730748343a2 # changeset 2fdc121e9b5d76464b3efd47d711c58253ef6348 # changeset cfb171ddbb333df9671a1da62e40122a56213ab4 # changeset 79e82ae1bad02c0dfb504db3153599e52a0affb3
Is there any kernel that has already merged above changeset? If yes, could you tell me where it is?
If no, I think it is not necessary to make device-path script support upstream linux.
Thanks,
--
Yuji Shimada
Quoted 4 lines · Yuji Shimada
Is there any kernel that has already merged above changeset? If yes, could you tell me where it is?
If no, I think it is not necessary to make device-path script support upstream linux.
It'll have to be ported to pv_ops soon enough (or be rendered obsolete), and what will we do there?
-- Keir
Quoted 64 lines · On Tue, 07 Apr 2009 16:29:05 +0900 Yuji Shimada <[email protected]>…
Quoted 43 lines · On Mon, 6 Apr 2009 15:06:00 +0100 "Daniel P. Berrange" <[email protected]>…
Quoted 2 lines · Yuji Shimada
This patch adds device-path command that converts SBDF into device path.
[snip]
Quoted 3 lines
diff -r
5a60eb7fad79tools/misc/device-pathtools/misc/device-path new file +0
-0[snip]
Quoted 10 lines
tools/misc/device-path new file +10
-0+SYSFS_ACPI_DEVS_PATH = '/firmware/acpi/namespace/ACPI/_SB' + +def find_hid_uid(dom, b, d, f): + sb_path = find_sysfs_mnt() + SYSFS_ACPI_DEVS_PATH + obj_list = os.listdir(sb_path) + for obj in obj_list: + obj_path = sb_path + '/' + obj.strip() + '/' + if os.path.exists(obj_path + 'seg') and \ + os.path.exists(obj_path + 'bbn'): + seg = open(obj_path + 'seg').read()tools/misc/device-path line 53
Quoted 10 lines
tools/misc/device-path new file +10
-0+ bbn = open(obj_path + 'bbn').read() + if int(seg) == dom and int(bbn) == b: + hid = open(obj_path + 'hid').read() + if os.path.exists(obj_path + 'uid') is False: + path_str = hid.strip() + else: + uid = open(obj_path + 'uid').read() + path_str = hid.strip() + ':' + uid.strip() + return path_str + return NoneI don't know how critical this piece of code is to the overall functionality in this tool, but be warned that the path being used here was removed from sysfs in upstream kernel quite a while ago
To quote an old copy of
Documentation/feature-removal-schedule.txtWhat: /sys/firmware/acpi/namespace When: 2.6.21 Why: The ACPI namespace is effectively the symbol list forQuoted 8 lines
the BIOS. The device names are completely arbitrary and have no place being exposed to user-space.
For those interested in the BIOS ACPI namespace, the BIOS can be extracted and disassembled with acpidump and iasl as documented in the pmtools package here:
http://ftp.kernel.org/pub/linux/kernel/people/lenb/acpi/utilsIt is difficult for users to get device path of particular device. So I made this command that converts SBDF into device path.
SBDF of devices can be changed at boot time. But device path is not changed at boot time.
I have already added the function to specify guest passthrough device by device path with "guestdev" boot parameter.
The linux-2.6.18-xen kernel changeset is the following.
Quoted 4 lines
# changeset fad85221407bf32df2574bca54cba730748343a2 # changeset 2fdc121e9b5d76464b3efd47d711c58253ef6348 # changeset cfb171ddbb333df9671a1da62e40122a56213ab4 # changeset 79e82ae1bad02c0dfb504db3153599e52a0affb3
Sorry, above changesets are wrong.
They are correct changesets.
# changeset 765 : fad85221407bf32df2574bca54cba730748343a2 # changeset 766 : 2fdc121e9b5d76464b3efd47d711c58253ef6348 # changeset 767 : 78d81e85e8cd8a0a26bc9b760c67d435341f43f8 # changeset 768 : cfb171ddbb333df9671a1da62e40122a56213ab4
Thanks,
--
Yuji Shimada
Yuji Shimada writes ("[Xen-devel] [PATCH] Add device-path command."):
Quoted 2 lines
This patch adds device-path command that converts SBDF into device path.
This program should have some more specific name, at the very least.
Ian.
PATCH v2 1/1 Add sbdf2devicepath command.
In reply to Yuji ShimadaThanks for all of your comments.
I change command name from 'device-path'to 'sbdf2devicepath'. And I add error message in case ACPI namespace directory does not present.
Thanks,
--
Yuji Shimada
This patch adds 'sbdf2devicepath' command that converts SBDF into device path.
'SBDF' format is "[SEG#:]BUS#:DEV#.FUNC#"
ex) 0000:0a:1f.3
Device path format is "HID[:UID]-DEV#.FUNC#[-DEV#.FUNC#[...]]"
ex) PNP0A08:0-2.0-0.0
The command can be executed as follows.
# sbdf2devicepath 0a:1f.3 PNP0A08:0-2.0-0.0
Makefile +1 -1
@@ -224,7 +224,7 @@ rm -rf $(D)$(LIBDIR)/xen/ rm -rf $(D)/usr/lib/xen/ rm -rf $(D)/usr/local/sbin/setmask $(D)/usr/local/sbin/xen* - rm -rf $(D)/usr/sbin/xen* $(D)/usr/sbin/netfix $(D)/usr/sbin/xm + rm -rf $(D)/usr/sbin/xen* $(D)/usr/sbin/netfix $(D)/usr/sbin/xm $(D)/usr/sbin/sbdf2devicepath rm -rf $(D)/usr/share/doc/xen rm -rf $(D)/usr/share/xen rm -rf $(D)/usr/share/man/man1/xen*
tools/misc/Makefile +1 -1
@@ -22,7 +22,7 @@ INSTALL_BIN-$(CONFIG_X86) += xen-detect INSTALL_BIN := $(INSTALL_BIN-y) -INSTALL_SBIN-y := xm xen-bugtool xen-python-path xend xenperf xsview xenpm +INSTALL_SBIN-y := xm xen-bugtool xen-python-path xend xenperf xsview xenpm sbdf2devicepath INSTALL_SBIN := $(INSTALL_SBIN-y) DEFAULT_PYTHON_PATH := $(shell $(XEN_ROOT)/tools/python/get-path)
tools/misc/sbdf2devicepath new file +82 -0
82 lines not on this page · raw message
PATCH 1/1 Modify makefiles to install/uninstall sbdf2devicepath command.
This patch modifies makefiles to install/uninstall the command.
"sbdf2devicepath" command is not installed/uninstalled by the following changeset.
http://xenbits.xensource.com/xen-unstable.hg?rev/0b9b6d5a61c1
Thanks,
--
Yuji Shimada
Makefile +1 -1
@@ -220,7 +220,7 @@ rm -rf $(D)$(LIBDIR)/xen/ rm -rf $(D)/usr/lib/xen/ rm -rf $(D)/usr/local/sbin/setmask $(D)/usr/local/sbin/xen* - rm -rf $(D)/usr/sbin/xen* $(D)/usr/sbin/netfix $(D)/usr/sbin/xm + rm -rf $(D)/usr/sbin/xen* $(D)/usr/sbin/netfix $(D)/usr/sbin/xm $(D)/usr/sbin/sbdf2devicepath rm -rf $(D)/usr/share/doc/xen rm -rf $(D)/usr/share/xen rm -rf $(D)/usr/share/man/man1/xen*
tools/misc/Makefile +1 -1
@@ -22,7 +22,7 @@ INSTALL_BIN-$(CONFIG_X86) += xen-detect INSTALL_BIN := $(INSTALL_BIN-y) -INSTALL_SBIN-y := xm xen-bugtool xen-python-path xend xenperf xsview xenpm +INSTALL_SBIN-y := xm xen-bugtool xen-python-path xend xenperf xsview xenpm sbdf2devicepath INSTALL_SBIN := $(INSTALL_SBIN-y) DEFAULT_PYTHON_PATH := $(shell $(XEN_ROOT)/tools/python/get-path)
Re: [PATCH] Modify makefiles to install/uninstall sbdf2devicepath command.
Quoted 6 lines · Yuji Shimada
This patch modifies makefiles to install/uninstall the command.
"sbdf2devicepath" command is not installed/uninstalled by the following changeset.
http://xenbits.xensource.com/xen-unstable.hg?rev/0b9b6d5a61c1
I don't think this is generically useful enough to install on all systems. We'll keep it as a helpful script that users can be pointed at if doing advanced passthru stuff.
-- Keir