Resource occupation method and device of PCIe virtual equipment, electronic equipment and storage medium

By attaching a fake PCIe virtual device to occupy BAR space resources during the BIOS scanning phase and presenting PCIe virtual devices as system disks only in the BIOS startup menu interface, the server startup failure problem caused by the rendering of ordinary PCIe virtual devices in the BIOS startup menu interface is solved, and the user experience is improved.

CN119557049APending Publication Date: 2025-03-04SHENZHEN JAGUAR MICROSYSTEMS CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202411699195.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-25
Publication Date
2025-03-04

AI Technical Summary

Technical Problem

When the server is started from the cloud disk, ordinary PCIe virtual devices are presented in the BIOS startup menu interface, causing the server startup to fail when the user selects these devices, affecting the user experience.

Method used

During the BIOS scanning phase, each node of the PCIe virtual device topology is scanned, and a fake PCIe virtual device is attached to occupy BAR space resources. Only the PCIe virtual device as the system disk is presented in the BIOS startup menu interface, and BAR space resources are allocated for it and the fake PCIe virtual device.

Benefits of technology

This avoids users from selecting unusable PCIe virtual devices in the BIOS startup menu interface, thus solving the problem of server startup failure and improving user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119557049A_ABST
    Figure CN119557049A_ABST
Patent Text Reader

Abstract

The invention discloses a resource occupation method and device of PCIe virtual equipment, the PCIe equipment and a storage medium, and the resource occupation method of the PCIe virtual equipment comprises the steps: in a BIOS scanning stage, scanning each node of a topological structure of the PCIe virtual equipment; wherein each node is used for hooking a false PCIe virtual device and a true PCIe virtual device, wherein the false PCIe virtual device is used for occupying BAR space resources for the PCIe virtual device which is not used as a system disk and hooked to the same node, and the true PCIe virtual device comprises the PCIe virtual device which is used as the system disk and the PCIe virtual device which is not used as the system disk; for the mode of starting the OS from the cloud hard disk, according to the first scanning result, the PCIe virtual device serving as the system disk is presented on the BIOS starting menu interface, the false PCIe virtual device is not presented, and BAR space resources are allocated to the returned PCIe virtual device serving as the system disk and the false PCIe virtual device. Therefore, BAR space resources are pre-occupied for each node, and meanwhile, PCIe virtual equipment serving as a system disk is only presented on a BIOS startup menu interface.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and more specifically, to a resource occupation method and apparatus for a PCIe virtual device, a PCIe device, and a storage medium. Background Art

[0002] Currently, servers in data centers can be adapted to multiple operating system versions. Users can specify certain PCIe virtual devices (such as virtio net devices, virtio blk devices, etc.) as system disks, so that the server can boot from the cloud disk or from the local disk to load different operating system images.

[0003] When the server boots from a cloud disk, a driver matching the cloud disk device is required in the Basic Input / Output System (BIOS). If there is no matching driver, it needs to be carried in the oprom rom (driver for loading the cloud disk image) of the PCIe virtual device designated as the system disk for BIOS scanning and loading, thereby driving the cloud disk device and reading the operating system image.

[0004] If the software simulates common PCIe virtual devices that are not used as system disks (i.e., devices without oprom rom), these common PCIe virtual devices will also be displayed on the boot menu interface of the BIOS. If the user selects these common PCIe virtual devices, the server will fail to start, thus affecting the user experience. In other words, unusable common PCIe virtual devices will be displayed on the driver interface, causing certain misunderstandings to users.

[0005] Based on the above situation, in the related technology, when the BIOS scans a common PCIe virtual device, the software simulation program returns an "Unsupported Request (UR)", which makes the BIOS believe that there is no device on the slot connected to the common PCIe virtual device that returns the UR, thereby achieving that these common PCIe virtual devices are not displayed on the BIOS boot menu interface. However, since the slots where the common PCIe virtual devices are mounted are determined by the BIOS to have no devices, the BIOS will not allocate resources to these slots. After the operating system is started, the slots connected to the common PCIe virtual devices will have no resources and abnormal functions. Summary of the invention

[0006] In view of the above problems, the present application proposes a resource occupation method, apparatus, electronic device and storage medium for a PCIe virtual device, which can only present the PCIe virtual device as a system disk in the BIOS boot menu interface and allocate resources to any node.

[0007] In a first aspect, an embodiment of the present application provides a resource occupation method for a PCIe virtual device, the resource occupation method for a PCIe virtual device comprising: in a BIOS scanning phase, scanning each node of a PCIe virtual device topology structure; wherein the PCIe virtual device topology structure comprises a plurality of nodes, each of the plurality of nodes being used to mount a fake PCIe virtual device and a true PCIe virtual device, each node mounting a fake PCIe virtual device upon initialization, the true PCIe virtual device comprising a PCIe virtual device that serves as a system disk and a PCIe virtual device that does not serve as a system disk, the fake PCIe virtual device being used to occupy BAR space resources for a PCIe virtual device that does not serve as a system disk and is mounted on the same node; for a mode of starting an OS from a cloud hard drive, according to a first scanning result, a PCIe virtual device that serves as a system disk is presented in a BIOS boot menu interface, and a fake PCIe virtual device is not presented, and BAR space resources are allocated to the returned PCIe virtual device that serves as a system disk and the fake PCIe virtual device.

[0008] In the second aspect, an embodiment of the present application further provides a resource occupying device for a PCIe virtual device, which comprises: a scanning module, which is used to scan each node of a PCIe virtual device topology structure during a BIOS scanning phase; wherein the PCIe virtual device topology structure comprises a plurality of nodes, each of the plurality of nodes is used to mount a fake PCIe virtual device and a true PCIe virtual device, each node mounts a fake PCIe virtual device during initialization, the true PCIe virtual device comprises a PCIe virtual device that serves as a system disk and a PCIe virtual device that does not serve as a system disk, and the fake PCIe virtual device is used to occupy BAR space resources for a PCIe virtual device that does not serve as a system disk and is mounted on the same node; a presentation module, which is used to present, for a mode of starting an OS from a cloud hard drive, a PCIe virtual device that serves as a system disk in a BIOS boot menu interface according to a first scanning result, without presenting a fake PCIe virtual device, and to allocate BAR space resources for the returned PCIe virtual device that serves as a system disk and a fake PCIe virtual device.

[0009] In a third aspect, an embodiment of the present application further provides an electronic device, comprising a processor, a memory, and one or more applications; the one or more applications are stored in the memory and configured to be executed by the processor to implement the resource occupation method of the above-mentioned PCIe virtual device.

[0010] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, in which a program code is stored, wherein when the program code is run by a processor, the resource occupation method of the above-mentioned PCIe virtual device is executed.

[0011] The technical solution provided by the present application, the resource occupation method of the PCIe virtual device, comprises: in the BIOS scanning stage, scanning each node of the PCIe virtual device topology structure; wherein, the PCIe virtual device topology structure comprises multiple nodes, each of the multiple nodes is used to mount a fake PCIe virtual device and a real PCIe virtual device, each node mounts a fake PCIe virtual device during initialization, the real PCIe virtual device comprises a PCIe virtual device that serves as a system disk and a PCIe virtual device that does not serve as a system disk, and the fake PCIe virtual device is used to occupy BAR space resources for the PCIe virtual device that does not serve as a system disk and is mounted on the same node; for the mode of starting the OS from a cloud hard disk, according to the first scanning result, the PCIe virtual device that serves as the system disk is presented in the BIOS boot menu interface, and the fake PCIe virtual device is not presented, and BAR space resources are allocated to the returned PCIe virtual device that serves as the system disk and the fake PCIe virtual device. Therefore, since each node is mounted with a PCIe virtual device, BAR space resources are reserved for each node, and only the PCIe virtual device as the system disk is presented in the BIOS boot menu interface, so as to avoid the situation where the user cannot use the corresponding device function by selecting a fake PCIe virtual device or a PCIe virtual device that is not a system disk in the BIOS boot menu interface, thereby affecting the user experience. BRIEF DESCRIPTION OF THE DRAWINGS

[0012] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present application, not all embodiments. Based on the embodiments of the present application, all other embodiments and drawings obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0013] Figure 1 A schematic flow chart of a resource occupation method for a PCIe device provided in an embodiment of the present application is shown.

[0014] Figure 2 A resource occupying device of a PCIe device provided in an embodiment of the present application is shown.

[0015] Figure 3 A schematic diagram of the structure of a PCIe device provided in an embodiment of the present application is shown.

[0016] Figure 4 A schematic diagram of the structure of a computer-readable storage medium provided in an embodiment of the present application is shown. DETAILED DESCRIPTION

[0017] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings. The described embodiments should not be regarded as limiting the present application. All other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of this application.

[0018] In the following description, reference is made to "some embodiments", which describes a subset of all possible embodiments, but it is understood that "some embodiments" may be the same subset or different subsets of all possible embodiments, and may be combined with each other without conflict. In the following description, reference is made to the term "multiple" to mean at least two.

[0019] In the following description, the terms "first\second" involved are merely used to distinguish similar objects and do not represent a specific ordering of the objects. It can be understood that "first\second" can be interchanged with a specific order or sequence where permitted, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein.

[0020] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.

[0021] Currently, servers in data centers can be adapted to multiple operating system versions. Users can specify certain PCIe virtual devices (such as virtio net devices, virtio blk devices, etc.) as system disks, so that the server can boot from the cloud disk or from the local disk to load different operating system images.

[0022] When the server boots from a cloud disk, a driver matching the cloud disk device is required in the Basic Input / Output System (BIOS). If there is no matching driver, it needs to be carried in the oprom rom (driver for loading the cloud disk image) of the PCIe virtual device designated as the system disk for BIOS scanning and loading, thereby driving the cloud disk device and reading the operating system image.

[0023] If the software simulates common PCIe virtual devices that are not used as system disks (i.e., devices without oprom rom), these common PCIe virtual devices will also be displayed on the boot menu interface of the BIOS. If the user selects these common PCIe virtual devices, the server will fail to start, thus affecting the user experience. In other words, unusable common PCIe virtual devices will be displayed on the driver interface, causing certain misunderstandings to users.

[0024] Based on the above situation, in the related technology, when the BIOS scans a common PCIe virtual device, the software simulation program returns an "Unsupported Request (UR)", which makes the BIOS believe that there is no device on the node connected to the common PCIe virtual device that returns the UR, thereby achieving that these common PCIe virtual devices are not displayed on the BIOS boot menu interface. However, since the nodes to which the common PCIe virtual devices are mounted are determined by the BIOS to have no devices, the BIOS will not allocate resources to these nodes. After the operating system is started, the nodes connected to the common PCIe virtual devices will have no resources and abnormal functions.

[0025] In order to improve the above-mentioned problems, the present application provides a resource occupation method, apparatus, PCIe device and storage medium for a PCIe virtual device, wherein the resource occupation method for the PCIe virtual device comprises: in a BIOS scanning phase, scanning each node of a PCIe virtual device topology structure; wherein the PCIe virtual device topology structure comprises a plurality of nodes, each of the plurality of nodes is used to mount a fake PCIe virtual device and a true PCIe virtual device, each node mounts a fake PCIe virtual device during initialization, the true PCIe virtual device comprises a PCIe virtual device that serves as a system disk and a PCIe virtual device that does not serve as a system disk, and the fake PCIe virtual device is used to occupy BAR space resources for a PCIe virtual device that does not serve as a system disk and is mounted on the same node; for a mode of starting an OS from a cloud hard drive, according to a first scanning result, a PCIe virtual device that serves as a system disk is presented in a BIOS boot menu interface, and a fake PCIe virtual device is not presented, and BAR (Base Address Register) space resources are allocated to the returned PCIe virtual device that serves as a system disk and the fake PCIe virtual device.

[0026] Therefore, since each node is mounted with a fake PCIe virtual device to reserve BAR space resources for each node, and only the PCIe virtual device as the system disk is presented in the BIOS boot menu interface, it avoids the situation where the user cannot use the corresponding device function when selecting a fake PCIe virtual device or a PCIe virtual device that is not a system disk in the BIOS boot menu interface, thereby affecting the user experience.

[0027] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application.

[0028] See also Figure 1 , Figure 1 A schematic diagram of a process flow of a resource occupation method of a PCIe virtual device provided in an embodiment of the present application is shown. Figure 1 As shown, the resource occupation method of the PCIe virtual device includes steps 110 to 120, specifically: In step 110, in the BIOS scanning phase, each node of the PCIe virtual device topology structure is scanned.

[0029] In an embodiment of the present application, the PCIe virtual device topology structure includes multiple nodes, each of which is used to mount a true PCIe virtual device and a fake PCIe virtual device. The true PCIe virtual device includes a PCIe virtual device that is a system disk and a PCIe virtual device that is not a system disk, and the fake PCIe virtual device is only used to occupy BAR space resources for the PCIe virtual device that is not a system disk mounted on the same node. That is, the fake PCIe virtual device does not have other functions, for example, the fake device does not have a storage function.

[0030] In some implementations, each node is attached with a fake PCIe virtual device during initialization, that is, during initialization, each node on the PCIe virtual device topology is attached with a fake PCIe virtual device.

[0031] In some implementations, the true PCIe virtual device may be one or more of a network card, a hard disk, a graphics card, or a sound card.

[0032] In some implementations, the PCIe virtual device as a system disk is a PCIe virtual device that carries an option rom when creating the PCIe virtual device. The option rom is used for BOIS scanning and loading to drive the cloud hard disk and read the OS image from the cloud hard disk. Only the PCIe virtual device as a system disk that carries the option rom can be used by the user in the BIOS stage, that is, the PCIe virtual device that does not carry the option rom and is not a system disk and the fake PCIe virtual device cannot be used by the user in the BIOS stage.

[0033] In some implementations, the PCIe virtual device that is not a system disk is a PCIe virtual device that does not carry an option rom when the PCIe virtual device is created.

[0034] In some embodiments, the PCIe virtual device includes a management control module and a device simulation module. The management control module and the device simulation module are connected to each other. The management control module is used to control the device simulation module to perform corresponding operations. The device simulation module is used to perform corresponding operations according to instructions sent by the management control module.

[0035] Exemplarily, the management control module sends a PCIe topology simulation creation instruction to the device simulation module, the PCIe topology simulation creation instruction includes configuration parameters, and the device simulation module creates a PCIe topology simulation according to the PCIe topology simulation creation instruction and the configuration parameters. The configuration parameters may include the type of device, the number of queues (queue) of the device, the network device (net device), the physical address (Media Access Control Address, mac), etc.

[0036] After the device simulation module is created, the device simulation module sends a creation completion signal to the management control module, so that the management control module can determine that the device simulation module completes the operation corresponding to the creation PCIe topology simulation instruction according to the creation completion signal.

[0037] In some implementations, the management control module will also send a create true PCIe virtual device instruction to the device simulation module according to the user's demand information (for example, the required simulation device and the startup mode corresponding to the simulation device), and the device simulation module will create at least one true PCIe virtual device according to the create true PCIe virtual device instruction, so that the device simulation module completes the device creation phase.

[0038] In some implementations, when the device simulation module completes the device creation phase, it is usually necessary to restart the server so as to allocate resources to each node of the PCIe virtual device topology structure to which the device is attached, and so on.

[0039] Since each node in the PCIe virtual device corresponds to a fake PCIe virtual device, in the subsequent steps, when there are nodes in the PCIe virtual device that do not correspond to real PCIe virtual devices, the server will still believe that there are devices on these nodes during the BIOS scanning phase because fake PCIe virtual devices are mounted on these nodes. Therefore, the server will also allocate BAR space resources to each node. After the OS is started, because BAR space resources are reserved for these nodes, other devices can be hot-plugged on these nodes. In other words, when a PCIe virtual device that is not a system disk is mounted on a node, the server will also allocate BAR space resources for the PCIe virtual device that is not a system disk.

[0040] In a specific embodiment, the device simulation module uses the following structure to describe the ep node in the PCIe topology: typedef struct topo_ep { Object parent; uint32_t host_id; int pf_type; void *slot; void *fake_device; void *device; int port; } topo_ep; Among them, the program "uint32_t host_id" is used to indicate the host identifier (host id number) corresponding to the node; the program "int pf_type" is used to indicate the type of device mounted under the node, the program "void *slot" is used to indicate the parent node of the node; the program "void *fake_device" is used to indicate the fake device pointer mounted on the node; the program "void *device" is used to indicate the real device pointer mounted on the node; the program "int port" is used to indicate the slot number of the node.

[0041] In the initialization phase of the PCIe virtual device topology, a fake PCIe virtual device is created on each node (i.e., a fake PCIe virtual device is mounted on each node), and the address of the fake PCIe virtual device is saved in the "fake_device" pointer variable. Each node has a fake PCIe virtual device to pre-occupy the BAR space resources for the node to ensure that the node can perform hot-plug operations normally after the OS is started. BAR space resources are also allocated for the PCIe virtual device mounted on the node that is not a system disk.

[0042] After the PCIe virtual device topology is created, the state of the register corresponding to the node is adjusted to indicate that there is no real PCIe virtual device attached to the node. That is, the Presence Detect State register in the Slot Status Register of the PCI express capability of the node corresponding to the node, the Data Link Layer Link Active register in the Link Status Register, and the Power ControllerControl register in the Slot Control Register are set to 0, 0, and 1 respectively to mark that there is no real PCIe virtual device attached to the node, so that after the OS is started, the node can perform hot-plug operations normally, or the PCIe virtual device attached to the node that is not a system disk can occupy BAR space resources.

[0043] In some implementations, the user can input the device type to be simulated and the device startup mode (for example, startup through local hardware or startup through cloud hardware) according to actual needs, that is, determine the real PCIe virtual device. The device simulation module creates the corresponding number and type of real PCIe virtual devices according to the device type to be simulated and the device startup mode input by the user to complete the device creation phase.

[0044] In a specific embodiment, in the device creation phase of the device simulation module, the device simulation module creates a true PCIe virtual device and saves the address of the true PCIe virtual device to the "device" pointer variable in the ep node in the PCIe topology. It can be understood that the "device" pointer variable can also be empty. When the "device" pointer variable is empty, it indicates that the node corresponding to the ep node is not connected to a true PCIe virtual device.

[0045] After creating at least one real PCIe virtual device, adjust the status of the registers corresponding to the nodes corresponding to the real PCIe virtual device to indicate that these nodes are connected to real PCIe virtual devices. That is, mark the Presence Detect State register in the Slot Status Register of the PCI expresscapability and the Data Link Layer Link Active register in the Link Status Register of these nodes as 1 to indicate that the node is connected to a real PCIe virtual device.

[0046] After the device creation phase is completed, the server needs to be started to allocate BAR space resources to each node and use real PCIe virtual devices and other operations. During the server restart process, the transaction layer packet (Transaction Layer Packet, TLP) event of the host reset (HOST RESET) will be triggered, and the device simulation module will adjust the status of the registers corresponding to each node again according to the connection status of the current devices of each node. That is, when a real PCIe virtual device is attached to the node, the Power Controller Control register in the Slot Control Register of the PCI express capability corresponding to the node is set to 0, that is, the node is marked as "online state". When there is no real PCIe virtual device attached to the node, that is, the node is only attached with a fake PCIe virtual device, the Power Controller Control register in the Slot Control Register of the PCI express capability corresponding to the node is set to 1, that is, the node is marked as "offline state". After the subsequent OS is started, these nodes marked as "offline state" can be hot-plugged with other devices to avoid the situation where fake PCIe virtual devices occupy these "offline state" nodes.

[0047] After completing the creation of the fake PCIe virtual device and the real PCIe virtual device, the management control module sends a restart instruction to the server through the Intelligent Management Platform Interface (IMPI), and the server executes the restart operation according to the restart instruction. The server enters the BIOS scanning phase, and the server begins to scan the PCIe topology simulated by the device simulation module to allocate BAR space resources to the corresponding nodes. Specifically: In step 120, for the mode of booting the OS from the cloud hard drive, based on the first scan result, the PCIe virtual device as the system disk is presented in the BIOS boot menu interface, and the fake PCIe virtual device is not presented, and BAR space resources are allocated to the returned PCIe virtual device as the system disk and the fake PCIe virtual device.

[0048] In the mode of booting the OS from the cloud hard disk, only the PCIe virtual device that serves as the system disk is presented in the BIOS boot menu interface according to the first scan result, so as to avoid presenting the PCIe virtual device that does not serve as the system disk and the fake PCIe virtual device in the BIOS boot menu interface, thereby avoiding the situation where the user cannot use the corresponding device function when selecting the fake PCIe virtual device or the PCIe virtual device that does not serve as the system disk in the BIOS boot menu interface, thereby affecting the user experience.

[0049] Specifically, in some implementations, the resource occupation method of the PCIe virtual device may further include the following steps: (1) In the mode of booting the OS from the cloud hard disk, when the target node of the multiple nodes is mounted with a PCIe virtual device as a system disk, the first scanning result includes: the returned device information of the PCIe virtual device mounted on the target node as the system disk.

[0050] (2) When a target node of multiple nodes is mounted with a PCIe virtual device that is not a system disk, the first scanning result includes: returned device information of the fake PCIe virtual device mounted on the target node.

[0051] (3) When the target node of the multiple nodes has no real PCIe virtual device mounted, the first scanning result includes: returning a preset value for indicating that the current node has no mounted PCIe virtual device.

[0052] That is to say, in the mode of starting the OS from the cloud hard drive, when the node is mounted with a PCIe virtual device that serves as a system disk, the device information of the PCIe virtual device mounted on the current node as a system disk will be returned; and when the node is mounted with a PCIe virtual device that does not serve as a system disk, the device information of the fake PCIe virtual device mounted on the current node will be returned; when the node has neither a PCIe virtual device that serves as a system disk nor a PCIe virtual device that does not serve as a system disk mounted, the preset value that the current node does not have a mounted PCIe virtual device is returned; and the first scanning result is determined based on the returned device information and the preset value.

[0053] The returned device information may include PCIe virtual devices that are used as system disks and PCIe configuration space and bar space of PCIe virtual devices that are not used as system disks. PCIe configuration space is an important part of PCIe devices, which is used to store and manage various configuration information of devices; bar space is a set of registers used to map I / O ports or memory address space in PCIe topology.

[0054] In some implementations, the preset value may be “0xFFFF.” When a node returns “0xFFFF,” it indicates that the node currently has neither a PCIe virtual device mounted as a system disk nor a PCIe virtual device mounted that is not a system disk.

[0055] In the mode of booting the OS in the cloud hard disk, the device status of the PCIe virtual device mounted as the system disk on multiple nodes is determined according to the first scanning result, so as to present the PCIe virtual device as the system disk on the BIOS boot menu interface, so that the user can select the corresponding PCIe virtual device as the system disk to execute the corresponding function. This prevents the PCIe virtual device that is not the system disk and the fake PCIe virtual device from being presented on the BIOS boot menu interface.

[0056] Furthermore, in some embodiments, the resource occupation method of the PCIe virtual device may also include the following steps: for a mode of booting the OS from a local hard disk, based on the second scan result, the local hard disk is presented in the BIOS boot menu interface, the fake PCIe virtual device is not presented, and BAR space resources are allocated to the returned fake PCIe virtual device.

[0057] When the OS is started through the local hard disk, the BIOS boot menu interface only presents the local hard disk, and does not present the fake PCIe virtual device connected to the node, so as to avoid the situation where the BIOS boot menu interface presents the fake PCIe virtual device. When the user selects the fake PCIe virtual device on the BIOS boot menu interface, the corresponding device function cannot be used, thereby affecting the user experience.

[0058] Specifically, in some implementations, the resource occupation method of the PCIe virtual device may further include the following steps: (1) In the mode of booting the OS from the local hard disk, when the target node of the multiple nodes is mounted with a PCIe virtual device that is not a system disk, the second scanning result includes: the returned device information of the fake PCIe virtual device mounted on the target node; (2) When the target node of the multiple nodes has no real PCIe virtual device mounted thereto, the second scanning result includes: returning a preset value for indicating that the current node has no mounted PCIe virtual device.

[0059] That is to say, in the mode of starting the OS from the local hard disk, when the node is mounted with a PCIe virtual device that is not a system disk, the device information of the fake PCIe virtual device mounted on the current node will be returned; and when the node is not mounted with a real PCIe virtual device, that is, the current node is not mounted with a PCIe virtual device that is not a system disk and a PCIe virtual device that is a system disk, the preset value of the real PCIe virtual device that does not exist on the current node is returned.

[0060] The returned device information may include device information of a fake PCIe virtual device mounted to a node mounted with a PCIe virtual device that is not a system disk. The second scanning result is determined based on the device information of the fake PCIe virtual device mounted to a node mounted with a PCIe virtual device that is not a system disk and the preset values ​​returned by other nodes that do not have a PCIe virtual device that is not a system disk mounted.

[0061] In some implementations, the resource occupation method of the PCIe virtual device may further include the following steps: (1) In the OS scanning phase, each of the multiple nodes of the PCIe virtual device topology structure is scanned.

[0062] (2) For the mode of booting the OS from a cloud drive or booting the OS from a hard drive, a real PCIe virtual device is presented in the OS according to the third scan result.

[0063] In the mode of booting the OS from the cloud drive or booting the OS from the hard disk, the device status of all nodes connected can be determined according to the third scan result, and the real PCIe virtual device connected to the node can be presented in the OS for users to use. This avoids the presentation of fake PCIe virtual devices in the OS, and avoids the situation where the corresponding device function cannot be used when the user selects a fake PCIe virtual device in the OS, thereby affecting the user experience.

[0064] Specifically, in some implementations, the resource occupation method of the PCIe virtual device may further include the following steps: (1) In the mode of booting the OS from a cloud hard disk or booting the OS from a hard disk, when a target node of the multiple nodes is mounted with a real PCIe virtual device, the third scanning result includes: returned device information of the real PCIe virtual device mounted on the target node.

[0065] (2) When the target node of the multiple nodes has no real PCIe virtual device mounted thereto, the third scanning result includes: returning a preset value for indicating that the current node has no mounted PCIe virtual device.

[0066] That is, the third scanning result includes the device information corresponding to the mounted real PCIe virtual device returned by the node with the mounted real PCIe virtual device and the preset value returned by the node without the mounted real PCIe virtual device to indicate that the current node does not have a mounted PCIe virtual device. That is, if a certain node has a PCIe virtual device mounted as a system disk, the node returns the device information of the PCIe virtual device mounted as a system disk; if a certain node has a PCIe virtual device that is not a system disk, the node returns the device information of the PCIe virtual device mounted as a system disk; if a certain node has neither a PCIe virtual device that is not a system disk nor a PCIe virtual device that is a system disk, the node returns the preset value to indicate that the current node does not have a mounted PCIe virtual device.

[0067] According to the third scanning result, the device status of all nodes connected can be determined, and the real PCIe virtual devices connected to the nodes can be presented in the OS for users to use, so as to avoid the false PCIe virtual devices being presented in the OS, and to avoid the situation where the corresponding device functions cannot be used when the user selects the false PCIe virtual device in the OS, thereby affecting the user experience.

[0068] See also Figure 2 , Figure 2 A resource occupation device of a PCIe virtual device provided in an embodiment of the present application is shown. The resource occupation device 200 of the PCIe virtual device includes: a scanning module 210 and a presentation module 220. Specifically: The scanning module 210 is used to scan each node of the PCIe virtual device topology structure during the BIOS scanning phase; wherein the PCIe virtual device topology structure includes multiple nodes, each of the multiple nodes is used to mount a fake PCIe virtual device and a real PCIe virtual device, each node mounts a fake PCIe virtual device during initialization, the real PCIe virtual device includes a PCIe virtual device that serves as a system disk and a PCIe virtual device that does not serve as a system disk, and the fake PCIe virtual device is used to occupy BAR space resources for the PCIe virtual device that does not serve as a system disk and is mounted on the same node.

[0069] The presentation module 220 is used for presenting the PCIe virtual device as the system disk in the BIOS boot menu interface according to the first scanning result for the mode of booting the OS from the cloud hard disk, without presenting the fake PCIe virtual device, and allocating BAR space resources for the returned PCIe virtual device as the system disk and the fake PCIe virtual device.

[0070] In some implementations, the resource occupation device 200 of the PCIe virtual device further includes a first execution module, a second execution module and a third execution module, wherein: The first execution module is used for, in a mode of starting the OS from a cloud hard disk, when a target node of multiple nodes is mounted with a PCIe virtual device as a system disk, the first scanning result includes: device information of the PCIe virtual device mounted on the target node as a system disk returned.

[0071] The second execution module is used for, when a target node of the multiple nodes is mounted with a PCIe virtual device that is not a system disk, the first scanning result includes: returned device information of the fake PCIe virtual device mounted on the target node.

[0072] The third execution module is used for, when the target node of the plurality of nodes has no real PCIe virtual device mounted, the first scanning result includes: returning a preset value for indicating that the current node has no mounted PCIe virtual device.

[0073] In some implementations, the resource occupying device 200 of the PCIe virtual device further includes a fourth execution module, wherein: The fourth execution module is used to present the local hard disk in the BIOS boot menu interface for the mode of booting the OS from the local hard disk according to the second scanning result, not present the fake PCIe virtual device, and allocate BAR space resources for the returned fake PCIe virtual device.

[0074] In some implementations, the resource occupation device 200 of the PCIe virtual device further includes a fifth execution module and a sixth execution module, wherein: The fifth execution module is used for, in the mode of booting OS from local hard disk, when the target node of multiple nodes is mounted with a PCIe virtual device that is not a system disk, the second scanning result includes: the returned device information of the fake PCIe virtual device mounted on the target node.

[0075] The sixth execution module is used for, when the target node of the plurality of nodes has no real PCIe virtual device mounted, the second scanning result includes: returning a preset value for indicating that the current node has no mounted PCIe virtual device.

[0076] In some implementations, the resource occupation device 200 of the PCIe virtual device further includes a seventh execution module and an eighth execution module, wherein: The seventh execution module is used to scan each of the multiple nodes of the PCIe virtual device topology structure during the OS scanning phase.

[0077] The eighth execution module is used for presenting a true PCIe virtual device in the OS according to the third scanning result in the mode of booting the OS from the cloud hard disk or booting the OS from the hard disk.

[0078] In some implementations, the resource occupation device 200 of the PCIe virtual device further includes a ninth execution module and a tenth execution module, wherein: The ninth execution module is used for, in the mode of booting the OS from the cloud hard disk or the hard disk, when the target node of the multiple nodes is mounted with a real PCIe virtual device, the third scanning result includes: the returned device information of the real PCIe virtual device mounted on the target node.

[0079] The tenth execution module is used for, when the target node of the plurality of nodes has no real PCIe virtual device mounted, the third scanning result includes: returning a preset value for indicating that the current node has no mounted PCIe virtual device.

[0080] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described devices and modules can refer to the corresponding processes in the aforementioned method embodiments, and will not be repeated here.

[0081] In several embodiments provided in the present application, the coupling or direct coupling or communication connection between the modules shown or discussed may be an indirect coupling or communication connection through some interfaces, devices or modules, which may be electrical, mechanical or other forms.

[0082] In addition, each functional module in each embodiment of the present application can be integrated into a processing module, or each module can exist physically separately, or two or more modules can be integrated into one module. The above integrated modules can be implemented in the form of hardware or software functional modules.

[0083] See also Figure 3 , Figure 3 A structural schematic diagram of an electronic device provided in an embodiment of the present application is shown. The electronic device 300 in the present application may include one or more of the following components: a processor 310, a memory 320, and one or more applications, wherein the one or more applications may be stored in the memory 320 and configured to be executed by one or more processors 310, and the one or more programs are configured to execute the resource occupation method of the PCIe virtual device as described in the aforementioned method embodiment.

[0084] The processor 310 may include one or more processing cores. The processor 310 uses various interfaces and lines to connect various parts of the entire electronic device 300, and executes various functions and processes data of the electronic device 300 by running or executing instructions, programs, code sets or instruction sets stored in the memory 320, and calling data stored in the memory 320. Optionally, the processor 310 can be implemented in at least one hardware form of digital signal processing (DSP), field-programmable gate array (FPGA), and programmable logic array (PLA). The processor 310 can integrate one or a combination of a central processing unit (CPU), a graphics processing unit (GPU), and a modem. Among them, the CPU mainly processes the operating system, user interface, and application programs; the GPU is responsible for rendering and drawing display content; and the modem is used to process wireless communications. It can be understood that the above-mentioned modem may not be integrated into the processor 310, but may be implemented separately through a communication chip.

[0085] The memory 320 may include a random access memory (RAM) or a read-only memory (ROM). The memory 320 may be used to store instructions, programs, codes, code sets or instruction sets. The memory 320 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for implementing at least one function, instructions for implementing the following various method embodiments, etc. The data storage area may also store data created by the electronic device 300 during use.

[0086] See also Figure 4 , Figure 4 A schematic diagram of the structure of a computer-readable storage medium provided in an embodiment of the present application is shown, wherein the computer-readable medium 400 stores program code, and the program code can be called by a processor to execute the resource occupation method of the PCIe virtual device described in the above method embodiment.

[0087] The computer-readable storage medium 400 may be an electronic memory such as a flash memory, an EEPROM (electrically erasable programmable read-only memory), an EPROM, a hard disk or a ROM. Optionally, the computer-readable storage medium 400 includes a non-transitory computer-readable storage medium. The computer-readable storage medium 400 has storage space for program codes 410 for executing any method steps in the above method. These program codes may be read from or written to one or more computer program devices. The program code 410 may be compressed, for example, in a suitable form.

[0088] The present application provides a method, apparatus, PCIe device and storage medium for occupying resources of a PCIe virtual device. The method comprises: in a BIOS scanning phase, scanning each node of a PCIe virtual device topology structure; wherein the PCIe virtual device topology structure comprises a plurality of nodes, each of the plurality of nodes is used to mount a fake PCIe virtual device and a real PCIe virtual device, each node mounts a fake PCIe virtual device at initialization, the real PCIe virtual device comprises a PCIe virtual device that serves as a system disk and a PCIe virtual device that does not serve as a system disk, and the fake PCIe virtual device is used to occupy BAR space resources for a PCIe virtual device that does not serve as a system disk and is mounted on the same node; for a mode of starting an OS from a cloud hard disk, according to a first scanning result, presenting a PCIe virtual device that serves as a system disk in a BIOS boot menu interface, not presenting a fake PCIe virtual device, and allocating BAR space resources for the returned PCIe virtual device that serves as a system disk and the fake PCIe virtual device. Therefore, since each node is mounted with a PCIe virtual device, BAR space resources are reserved for each node, and only the PCIe virtual device as the system disk is presented in the BIOS boot menu interface, so as to avoid the situation where the user cannot use the corresponding device function by selecting a fake PCIe virtual device or a PCIe virtual device that is not a system disk in the BIOS boot menu interface, thereby affecting the user experience.

[0089] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims

1. A resource occupation method for a PCIe virtual device, characterized in that: The method comprises: In the BIOS scanning phase, scanning each node of the PCIe virtual device topology structure; The PCIe virtual device topology structure includes a plurality of nodes, each of the plurality of nodes is used to mount a fake PCIe virtual device and a real PCIe virtual device, each of the nodes mounts the fake PCIe virtual device during initialization, the real PCIe virtual device includes a PCIe virtual device that serves as a system disk and a PCIe virtual device that does not serve as a system disk, and the fake PCIe virtual device is used to occupy BAR space resources for the PCIe virtual device that does not serve as a system disk and is mounted on the same node; For the mode of booting the OS from a cloud hard drive, based on the first scan result, the PCIe virtual device serving as the system disk is presented in the BIOS boot menu interface, the fake PCIe virtual device is not presented, and BAR space resources are allocated for the returned PCIe virtual device serving as the system disk and the fake PCIe virtual device.

2. The resource occupation method of a PCIe virtual device according to claim 1, characterized in that: In the mode of booting the OS from the cloud hard disk, when the target node of the multiple nodes is mounted with the PCIe virtual device as the system disk, the first scanning result includes: returned device information of the PCIe virtual device as the system disk mounted on the target node; When the target node of the plurality of nodes is mounted with the PCIe virtual device that is not a system disk, the first scanning result includes: returned device information of the fake PCIe virtual device mounted on the target node; When the target node of the multiple nodes is not mounted with the real PCIe virtual device, the first scanning result includes: returning a preset value for indicating that the current node does not have a mounted PCIe virtual device.

3. The resource occupation method of a PCIe virtual device according to claim 1 or 2, characterized in that: The method further comprises: The PCIe virtual device as the system disk is a PCIe virtual device that carries an option rom when creating the PCIe virtual device; The PCIe virtual device that is not used as a system disk is a PCIe virtual device that does not carry optionrom when creating the PCIe virtual device; The option rom is used for BOIS scanning and loading to drive the cloud hard disk and read the OS image from the cloud hard disk.

4. The resource occupation method of a PCIe virtual device according to claim 1, characterized in that: The method further comprises: For the mode of booting OS from the local hard disk, according to the second scanning result, the local hard disk is presented in the BIOS boot menu interface, the fake PCIe virtual device is not presented, and BAR space resources are allocated to the returned fake PCIe virtual device.

5. The resource occupation method of a PCIe virtual device according to claim 4, characterized in that: The method further comprises: In the mode of booting the OS from the local hard disk, when the target node of the multiple nodes is mounted with the PCIe virtual device that is not a system disk, the second scanning result includes: returned device information of the fake PCIe virtual device mounted on the target node; When the target node of the multiple nodes is not mounted with the real PCIe virtual device, the second scanning result includes: returning a preset value for indicating that the current node does not have a mounted PCIe virtual device.

6. The resource occupation method of a PCIe virtual device according to claim 1, characterized in that: The method further comprises: In the OS scanning phase, scanning each of the plurality of nodes of the PCIe virtual device topology structure; For a mode of booting the OS from a cloud hard disk or booting the OS from a hard disk, the real PCIe virtual device is presented in the OS according to the third scanning result.

7. The resource occupation method of a PCIe virtual device according to claim 6, characterized in that: The method further comprises: In the mode of booting the OS from a cloud hard disk or booting the OS from a hard disk, when the target node of the plurality of nodes is mounted with the real PCIe virtual device, the third scanning result includes: returned device information of the real PCIe virtual device mounted on the target node; When the target node of the multiple nodes has no real PCIe virtual device mounted thereto, the third scanning result includes: returning a preset value for indicating that the current node has no mounted PCIe virtual device.

8. A resource occupation device for a PCIe virtual device, characterized in that: The device comprises: A scanning module, used for scanning each node of the PCIe virtual device topology structure during a BIOS scanning phase; wherein the PCIe virtual device topology structure includes a plurality of nodes, each of the plurality of nodes is used for mounting a fake PCIe virtual device and a real PCIe virtual device, each of the nodes is mounted with the fake PCIe virtual device during initialization, the real PCIe virtual device includes a PCIe virtual device that serves as a system disk and a PCIe virtual device that does not serve as a system disk, and the fake PCIe virtual device is used for occupying BAR space resources for a PCIe virtual device that does not serve as a system disk and is mounted on the same node; A presentation module is used to present the PCIe virtual device as the system disk in the BIOS boot menu interface according to the first scanning result for the mode of booting the OS from the cloud hard disk, and not present the fake PCIe virtual device, and allocate BAR space resources for the returned PCIe virtual device as the system disk and the fake PCIe virtual device.

9. An electronic device, characterized in that: include: one or more processors; Memory; One or more applications, wherein the one or more applications are stored in the memory and are configured to be executed by the one or more processors as the resource occupation method of the PCIe virtual device according to any one of claims 1-7.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores program code, and the program code can be called by a processor to execute the resource occupation method of a PCIe virtual device as described in any one of claims 1-7.

Citation Information

Cited By

  • Basic input and output system diagnosis method and device, storage medium and server

    CN120872793A