Memory configuration information reporting method and device, computer equipment and storage medium
By obtaining the memory base address of the external PCIe device and accessing its configuration information, the problem of difficulty in reporting memory Type17 information under external PCIe devices in the prior art is solved, and real-time upload and management of system memory configuration information is realized.
Patent Information
- Application Number
- CN202411745373.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-29
- Publication Date
- 2025-03-25
- Estimated Expiration
- 2044-11-29
AI Technical Summary
It is difficult to report configuration information such as Type17 information and other memory in external PCIe devices to the operating system.
By obtaining the configuration data set of the target device, determine the memory base address of the target device, and obtain instructions based on the memory base address and memory configuration information, access the target device to obtain memory configuration information, and upload it to the operating system.
Without having to reserve a Type17 interface for the target device in advance, memory configuration information can be uploaded to the operating system in real time, so that system administrators can understand the device status in a timely manner, facilitate fault diagnosis and maintenance, and improve the overall reliability and maintenance efficiency of the system.
Smart Images

Figure CN119690655A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a method and device for reporting memory configuration information, a computer device and a storage medium. Background Art
[0002] PCIe (Peripheral Component Interconnect Express, a high-speed serial computer expansion bus standard) configuration space refers to the configuration information area stored in the PCIe device. The configuration information in the configuration information area is crucial for the initialization and management of the PCIe device. The SMBIOS (System Management Basic Input / Output System) Type 17 in the configuration information is a memory array mapped address (Memory Array Mapped Address), which is an SMBIOS data structure used to describe the system memory layout and configuration. Type 17 provides information about the memory array and its physical location in the system, which is very important for system management and monitoring.
[0003] Currently, the process of reporting Type 17 information to the operating system includes: reading the SPD (Serial Presence Detect) information on the memory stick during the BIOS (Basic Input / Output System) initialization process. Converting the read SPD information into a data structure that conforms to the SMBIOS Type 17 format. The BIOS constructs an SMBIOS table containing Type 17 information, and the constructed SMBIOS table can be read by the operating system. However, the current process of reporting Type 17 information can only report Type 17 information of memory that has a Type 17 interface and is in place. Since external PCIe devices such as CXL (Compute Express Link) devices are not within the system type 17 architecture, it is impossible to reserve a Type 17 interface for external PCIe devices. Currently, it is impossible to report Type 17 information of memory under external PCIe devices.
[0004] Therefore, the related technology has the problem that it is difficult to report configuration information such as Type 17 information of the memory under the external PCIe device to the operating system. Summary of the invention
[0005] In view of this, the present invention provides a memory configuration information reporting method, apparatus, computer equipment and storage medium to solve the problem that it is difficult to report configuration information such as Type 17 information of the memory under an external PCIe device to the operating system.
[0006] In a first aspect, the present invention provides a method for reporting memory configuration information, comprising:
[0007] When the configuration data set of the target device is obtained, the device information of the target device is obtained from the configuration data set;
[0008] Obtain the device identification of the target device in the device information, determine the device start address of the target device according to the device identification, and obtain the memory base address of the target device according to the device start address and address offset information;
[0009] According to the memory base address and memory configuration information acquisition instruction, the target device is accessed and the memory configuration information of the memory under the target device is acquired;
[0010] Upload the memory configuration information to the operating system.
[0011] The memory configuration information reporting method provided in this embodiment accesses the target device and obtains the memory configuration information of the memory under the target device according to the memory base address and the memory configuration information acquisition instruction; the memory configuration information is uploaded to the operating system, and the memory configuration information can be uploaded to the operating system in real time without reserving the Type17 interface for the target device in advance, so that the system administrator can understand the status of the device in time, facilitate fault diagnosis and maintenance of the target device, and improve the overall reliability and maintenance efficiency of the system. The problem of difficulty in reporting the configuration information such as the Type17 information of the memory under the external PCIe device to the operating system is solved.
[0012] In some optional implementations, obtaining the memory base address of the target device according to the device start address and address offset information includes:
[0013] Based on a preset addressing method, the device start address is offset by a first offset to obtain a first address, wherein the first offset is included in the address offset information;
[0014] Based on a preset addressing method, the device start address is offset by a second offset to obtain a second address, wherein the second offset is included in the address offset information;
[0015] The first address and the second address are combined to obtain the memory base address.
[0016] In this embodiment, the device start address is first offset by the first offset and the second offset, and then combined with the offset address to obtain a memory base address for accessing the target device. The target device can be accessed through the memory base address and the memory configuration information of the memory under the target device can be read.
[0017] In some optional implementations, accessing a target device and acquiring memory configuration information of a memory under the target device according to a memory base address and a memory configuration information acquisition instruction includes:
[0018] Obtaining memory numbers of the memory under the target device, wherein the number of memory numbers is a first preset number;
[0019] Determine a target memory number from a first preset number of memory numbers, and generate a memory configuration information acquisition instruction including the target memory number according to a preset specification;
[0020] The memory base address is offset by a third offset to obtain a first target address, and the memory base address is offset by a fourth offset to obtain a second target address;
[0021] The data of the memory configuration information acquisition instruction are sequentially written into the memory space of the first target address, and the first preset value for generating an interrupt is written into the second target address, so as to write the response information corresponding to the memory configuration information acquisition instruction into the memory space of the preset address, wherein the interrupt is used to wait for a preset time length;
[0022] Accessing the memory space of the preset address, obtaining the response information, and determining whether the preset byte of the response information is a second preset value;
[0023] If the preset byte is the second preset value, the response information is used as the intermediate configuration information of the memory corresponding to the target memory number;
[0024] According to the target memory number and the preset step length, a new target memory number is determined from the first preset number of memory numbers, the new target memory number is used as the target memory number, and subsequent steps are executed starting from generating a memory configuration information acquisition instruction including the target memory number according to the preset specification until response information corresponding to each memory number is obtained;
[0025] Summarize the intermediate configuration information to obtain the memory configuration information of the memory under the target device.
[0026] In this embodiment, the memory base address is used to determine the first target address and the second target address, and the memory configuration information acquisition instruction is written into the memory space of the first target address, and the first preset value is written to the second target address to generate an interrupt, and the response information is written into the memory space of the preset address. Finally, the memory configuration information is obtained from the response information. The memory configuration information is successfully obtained without the Type17 interface, which breaks through the limitations of traditional SMBIOS memory configuration information reporting.
[0027] In some optional implementations, uploading the memory configuration information to the operating system includes:
[0028] Create a configuration information structure according to the preset specification, and write the memory configuration information into the configuration information structure;
[0029] The preset upload service is used to upload the memory configuration information in the configuration information structure to the preset location of the configuration data table in the operating system.
[0030] In this embodiment, the memory configuration information is written into the configuration information structure, and then the memory configuration information in the configuration information structure is uploaded to the preset location of the configuration data table in the operating system. The structure and data table are used to ensure the content and upload order of the memory configuration information, so that the memory configuration information can be accurately uploaded to the operating system.
[0031] In some optional implementations, obtaining device information of the target device from the configuration data set includes:
[0032] Obtaining a controller number of a device controller corresponding to the target device, wherein the number of controller numbers is a second preset number;
[0033] The device information of the target device on the device controller is obtained in the configuration data set according to the second preset number of controller numbers.
[0034] In some optional implementations, before acquiring the device information of the target device from the configuration data set, the method further includes:
[0035] Using the first interface function to obtain a configuration data set of the target device under the operating system;
[0036] The first interface function is checked to obtain status information of the configuration data set, and if the status information is a third preset value, the device information of the target device is obtained from the configuration data set.
[0037] In this embodiment, the first interface function is checked to obtain status information of the configuration data set, and by judging whether the status information is a third preset value, it is determined whether the acquired configuration data set includes accurate device information. After determination, the device information of the target device is obtained from the configuration data set to ensure that the information is accurate.
[0038] In some optional embodiments, the method further comprises:
[0039] Registering a memory configuration information reporting event, wherein the memory configuration information reporting event is used to call a memory configuration information collection function when the second interface function is installed, and the second interface function is used to check the connection status of the driver in the operating system;
[0040] The memory configuration information collection function is used to execute subsequent steps starting from obtaining device information of the target device from the configuration data set when the configuration data set of the target device is obtained.
[0041] In this embodiment, by judging whether the second interface function is installed, it is determined whether the target device can be accessed. If the second interface function is installed, it is determined that the target device can be accessed, and then the memory configuration information collection function is called to report the memory configuration information to ensure that the memory configuration information can be obtained smoothly.
[0042] In a second aspect, the present invention provides a memory configuration information reporting device, comprising:
[0043] A first acquisition module is used to acquire device information of the target device from the configuration data set when the configuration data set of the target device is acquired;
[0044] The second acquisition module is used to obtain the device identification of the target device in the device information, determine the device start address of the target device according to the device identification, and obtain the memory base address of the target device according to the device start address and address offset information;
[0045] A third acquisition module is used to obtain instructions according to the memory base address and the memory configuration information, access the target device and obtain the memory configuration information of the memory under the target device;
[0046] The upload module is used to upload the memory configuration information to the operating system.
[0047] In a third aspect, the present invention provides a computer device, comprising: a memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, and the processor executing the memory configuration information reporting method of the first aspect or any corresponding embodiment thereof by executing the computer instructions.
[0048] In a fourth aspect, the present invention provides a computer non-volatile readable storage medium, on which computer instructions are stored, and the computer instructions are used to enable a computer to execute the memory configuration information reporting method of the above-mentioned first aspect or any corresponding embodiment thereof.
[0049] In a fifth aspect, the present invention provides a computer program product, comprising computer instructions, wherein the computer instructions are used to enable a computer to execute the memory configuration information reporting method of the above-mentioned first aspect or any corresponding embodiment thereof. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] In order to more clearly illustrate the specific embodiments of the present invention or the technical solutions in the related technologies, the drawings required for use in the specific embodiments or the related technical descriptions will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0051] Figure 1 is a flowchart of a method for reporting memory configuration information according to an embodiment of the present invention;
[0052] Figure 2 is a flowchart of a method for reporting Type 17 information of a CXL device according to an embodiment of the present invention;
[0053] Figure 3 is a structural block diagram of a memory configuration information reporting device according to an embodiment of the present invention;
[0054] Figure 4 It is a schematic diagram of the hardware structure of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION
[0055] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.
[0056] CXL (Compute Express Link) is a high-performance interconnect protocol used to provide low-latency, high-bandwidth connections between processors, accelerators, memory buffers, intelligent network interface cards (NICs), persistent memory, and other high-speed storage devices in data centers and high-performance computing environments. The low-latency and high-bandwidth connections provided by CXL significantly improve the performance of data-intensive applications. CXL supports the separation of computing and storage resources, allowing devices such as GPUs (graphics processing units) and FPGAs (field programmable gate arrays) to directly access host memory, improving resource utilization. CXL device information can be reported to SMBIOS in a standardized manner, simplifying system management and monitoring processes and improving operation and maintenance efficiency. CXL allows servers to support different types of memory, reducing the cost of over-configuring memory while improving system performance. In summary, CXL provides new possibilities for building high-performance computing systems. It greatly improves the performance of data-intensive applications by providing low-latency and high-bandwidth connections.
[0057] The PCIe protocol is designed to replace the old parallel bus architecture, such as AGP (Accelerated Graphics Port) and PCIe bus, to provide higher bandwidth and lower latency. PCIe is used to connect various hardware components inside the computer, such as graphics cards, network adapters, storage devices, etc.
[0058] The PCIe configuration space usually includes device identification, capability registers, status registers, etc., which are used to describe the capabilities and current status of the device. Among them, SMBIOS Type17 is an SMBIOS data structure used to describe the system memory layout and configuration. Type17 provides information about the memory array and its physical location in the system. At present, the specific process of general memory training and Type17 information reporting includes: when the system starts, the BIOS starts the initialization process, including reading the SPD information on the memory stick. The SPD chip stores the SPD information of the memory stick, including the manufacturer, product number, capacity, speed and timing parameters, etc. The BIOS will read this SPD information from the SPD chip. The read SPD information is converted into a data structure that conforms to the SMBIOS Type17 format. These data structures contain detailed information about the memory, such as memory type, speed, capacity, manufacturer, etc. The BIOS will build an SMBIOS table, which contains Type17 information, which is organized in the format of the SMBIOS standard. The built SMBIOS table is reported to the operating system, and the SMBIOS table can be read by the operating system. The operating system can obtain detailed information about the memory by querying the SMBIOS table. However, the above process is a solution made when the memory slot is fixed, and no interface is reserved for CXL. In addition, the information collection phase is before the PCIe device is initialized, and the CXL device cannot be accessed at this time. For example, the CXL device is an expansion adapter card that converts PCIe signals to memory signals.
[0059] Based on the above content, an embodiment of the present invention provides a method for reporting memory configuration information. According to the memory base address and the memory configuration information acquisition instruction, the target device is accessed and the memory configuration information of the memory under the target device is obtained; the memory configuration information is uploaded to the operating system. By introducing the memory configuration information reporting mechanism, the limitation of the traditional SMBIOS memory configuration information reporting, that is, the lack of a reserved interface to support dynamic reporting, is broken through, and the comprehensiveness and accuracy of the system fault diagnosis are significantly enhanced, thereby improving the overall reliability and maintenance efficiency of the system. The technical effect of enabling the system administrator to understand the status of the device in a timely manner, facilitating fault diagnosis and maintenance, reducing operation and maintenance costs, and quickly locating the cause of the fault through memory configuration information and taking corresponding measures is achieved.
[0060] According to an embodiment of the present invention, a memory configuration information reporting embodiment is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer device with data processing capabilities, such as a computer, a server, etc., and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0061] In this embodiment, a method for reporting memory configuration information is provided. Figure 1 is a flowchart of a method for reporting memory configuration information according to an embodiment of the present invention. Figure 1 As shown, the process includes the following steps:
[0062] Step S101: when a configuration data set of a target device is obtained, device information of the target device is obtained from the configuration data set.
[0063] Specifically, the target device is, for example, a CXL device registered on the system. The configuration data set is, for example, a data set mCxlNbioProtocol of the CXL device. The device information of the target device is obtained from the configuration data set, and the device information records the access address of the target device, the BDF (Bus / Device / Function) number, etc.
[0064] Step S102, obtaining the device identification of the target device in the device information, determining the device start address of the target device according to the device identification, and obtaining the memory base address of the target device according to the device start address and the address offset information.
[0065] Specifically, the device identifier of the target device is obtained in the device information, and the device identifier is, for example, the BDF number of the target device. According to the PCIe specification and the CXL specification, the memory base address BarAddress accessed by the CXL device can be obtained according to the BDF number, for example, the address where the device identifier is located is used as the device start address of the target device. The address offset information may include one or more offsets. If there is only one offset in the address offset information, the device start address is offset by the offset, and the offset device start address is used as the memory base address of the target device. The target device can be accessed or controlled by writing instructions to the address later. If there are multiple offsets in the address offset information, the device start address can be divided into multiple parts, each part is offset by a corresponding offset, and the offset parts are integrated to obtain the memory base address. For example, the address offset information has 64 bits, and there are offsets in the address offset information. Correspondingly, the address offset information is divided into two parts, the first 32 bits are used as one part, and the last 32 bits are used as another part. The two parts are offset by corresponding offsets respectively, and the offset parts are integrated to obtain the memory base address.
[0066] Step S103, accessing the target device and acquiring the memory configuration information of the memory under the target device according to the memory base address and the memory configuration information acquisition instruction.
[0067] Specifically, the memory configuration information acquisition instruction is written into the memory base address or the memory base address plus a preset offset to access the target device. The specific relationship between the location where the memory configuration information acquisition instruction is written and the memory base address is determined according to actual needs.
[0068] In the process of accessing the target device, memory configuration information of the memory under the target device is obtained from the target device. The memory configuration information is, for example, SPD data of the memory under the CXL device.
[0069] Step S104, uploading the memory configuration information to the operating system.
[0070] Specifically, the memory configuration information is written to a location in the operating system for storing memory configuration information, such as the system Type 17 data table of the operating system. The operating system can read the memory configuration information from the system Type 17 data table and manage and monitor the CXL device and the memory under the CXL device according to the memory configuration information.
[0071] The memory configuration information reporting method provided in this embodiment accesses the target device and obtains the memory configuration information of the memory under the target device according to the memory base address and the memory configuration information acquisition instruction; the memory configuration information is uploaded to the operating system, and the memory configuration information can be uploaded to the operating system in real time without reserving the Type17 interface for the target device in advance, so that the system administrator can understand the status of the device in time, facilitate fault diagnosis and maintenance of the target device, and improve the overall reliability and maintenance efficiency of the system. The problem of difficulty in reporting the configuration information such as the Type17 information of the memory under the external PCIe device to the operating system is solved.
[0072] In some optional implementations, obtaining the memory base address of the target device according to the device start address and address offset information includes:
[0073] Based on a preset addressing method, the device start address is offset by a first offset to obtain a first address, wherein the first offset is included in the address offset information;
[0074] Based on a preset addressing method, the device start address is offset by a second offset to obtain a second address, wherein the second offset is included in the address offset information;
[0075] The first address and the second address are combined to obtain the memory base address.
[0076] Specifically, the preset addressing method is, for example, MMIO (Memory-Mapped Input / Output) addressing method. MMIO is a common hardware device addressing method that accesses the device by mapping the registers of the I / O (Input / Output) device to the system's memory address space. This method allows the CPU (Central Processing Unit) to directly use memory access instructions to read and write registers of the I / O device, thereby simplifying the interaction between hardware and software. The BDF number of the CXL device can be obtained from the configuration data set mCxlNbioProtocol, including: bus number, device number, and function number.
[0077] According to the PCIe specification, CXL specification, bus number, device number, and function number of the CXL device, the device start address of the CXL device can be obtained, for example, the address of the register storing the BDF number of the CXL device is used as the device start address of the CXL device, or the address near the address of the register storing the BDF number is used as the device start address. In the case where the address of the register storing the BDF number is used as the device start address of the CXL device, the first offset is, for example, 0x14, where 0x represents hexadecimal; the second offset is, for example, 0x10, where 0x represents hexadecimal.
[0078] By using a preset addressing method, the address of the register whose device start address is offset by a first offset (such as 0x14) of the CXL device is calculated, and the address of the register is used as the first address, which is the high 32-bit address AddressHigh.
[0079] By using a preset addressing method, the address of the register whose device start address is offset by the second offset (such as 0x10) of the CXL device is calculated, and the address of the register is used as the second address, which is the lower 32-bit address AddressLow.
[0080] The first address and the second address are combined to obtain the memory base address (BarAddress) accessed by the CXL device, that is, BarAddress = (AddressHigh<<32)|AddressLow.
[0081] In this embodiment, the device start address is first offset by the first offset and the second offset, and then combined with the offset address to obtain a memory base address for accessing the target device. The target device can be accessed through the memory base address and the memory configuration information of the memory under the target device can be read.
[0082] In some optional implementations, accessing a target device and acquiring memory configuration information of a memory under the target device according to a memory base address and a memory configuration information acquisition instruction includes:
[0083] Obtaining memory numbers of the memory under the target device, wherein the number of memory numbers is a first preset number;
[0084] Determine a target memory number from a first preset number of memory numbers, and generate a memory configuration information acquisition instruction including the target memory number according to a preset specification;
[0085] The memory base address is offset by a third offset to obtain a first target address, and the memory base address is offset by a fourth offset to obtain a second target address;
[0086] The data of the memory configuration information acquisition instruction are sequentially written into the memory space of the first target address, and the first preset value for generating an interrupt is written into the second target address, so as to write the response information corresponding to the memory configuration information acquisition instruction into the memory space of the preset address, wherein the interrupt is used to wait for a preset time length;
[0087] Accessing the memory space of the preset address, obtaining the response information, and determining whether the preset byte of the response information is a second preset value;
[0088] If the preset byte is the second preset value, the response information is used as the intermediate configuration information of the memory corresponding to the target memory number;
[0089] According to the target memory number and the preset step length, a new target memory number is determined from the first preset number of memory numbers, the new target memory number is used as the target memory number, and subsequent steps are executed starting from generating a memory configuration information acquisition instruction including the target memory number according to the preset specification until response information corresponding to each memory number is obtained;
[0090] Summarize the intermediate configuration information to obtain the memory configuration information of the memory under the target device.
[0091] Specifically, the target device is, for example, a CXL device. Each CXL device has at most two memory sticks. Each memory stick has a unique number, and the memory number is recorded as Dimmindex. The memory number of the memory stick under the target device is obtained, for example, Dimmindex=0, Dimmindex=1, etc. The specific number value is set according to actual needs. The number of memory numbers is the first preset number, that is, the number of memory sticks.
[0092] Determine the target memory number from the first preset number of memory numbers, for example: take each memory number as the target memory number in turn, and first take Dimmindex=0 as the target memory number. The preset specification is, for example, the CXL specification. Based on the CXL specification, a 16-byte access instruction needs to be written to access the CXL device space to confirm the type of information currently being accessed. The 16-byte access instruction is an access instruction for SPD information. Generate a memory configuration information acquisition instruction containing the target memory number according to the preset specification. The memory configuration information acquisition instruction is, for example, an access instruction for SPD information. The access instruction for SPD information is, for example, RequestData
[16] ={0x00,0x1b,0x00,0x00,0x04,0x01,0x00,0x00,0x20,0x01,0x00,0x00,0x05,0x00,0x00,0x00,0x00}, where RequestData
[10] is the value of the target memory number.
[0093] The third offset is, for example, 0x14, and the fourth offset is, for example, 0x3ffc. The memory base address (BarAddress) is offset by the third offset to obtain the first target address, for example, the first target address is BarAddress+0x14. The memory base address is offset by the fourth offset to obtain the second target address, for example, the second target address is BarAddress+0x3ffc.
[0094] The data of the memory configuration information acquisition instruction is sequentially written into the memory space of the first target address to access the target device, for example, the data of RequestData
[16] is sequentially written into the memory space of the address BarAddress+0x14 to access the CXL device. Because each access to the CXL device requires waiting for a preset time to obtain a return value, an interrupt needs to be generated to wait for the preset time, for example, the preset time is 10 milliseconds, and the first preset value is 1. The first preset value for generating an interrupt is written to the second target address, for example, writing 1 to the address BarAddress+0x3ffc to generate an interrupt, waiting for 10 milliseconds, and writing the response information corresponding to the memory configuration information acquisition instruction into the memory space of the preset address, the response information corresponding to the memory configuration information acquisition instruction, the preset address is for example: BarAddress+0x2000. The response information (ResponseData) is for example: a memory SPD information data set.
[0095] Access the memory space of the preset address to obtain the response information (ResponseData), the preset byte is, for example, the 11th byte of ResponseData, and the second preset value is, for example, 0. Determine whether the preset byte of the response information is the second preset value. If the preset byte is the second preset value, it means that the slot of the target memory number has memory information, and use the response information (ResponseData) as the intermediate configuration information of the memory corresponding to the target memory number, so as to facilitate the subsequent uploading of the collected response information to the smbios protocol for the operating system to call.
[0096] If the preset byte is not the second preset value, it means that the slot of the target memory number has no memory information, and a new target memory number is determined from the first preset number of memory numbers, for example: Dimmindex is increased by 1, and Dimmindex=1 is used as the new target memory number. The new target memory number is used as the target memory number, and subsequent steps are executed starting from generating a memory configuration information acquisition instruction containing the target memory number according to the preset specification, and the memory data on the next memory slot is continued to be collected until the response information corresponding to each memory number is obtained.
[0097] Summarize all intermediate configuration information to obtain memory configuration information of all memories under the target device. Memory configuration information, for example, SPD data of memory under CXL device.
[0098] In this embodiment, the memory base address is used to determine the first target address and the second target address, and the memory configuration information acquisition instruction is written into the memory space of the first target address, and the first preset value is written to the second target address to generate an interrupt, and the response information is written into the memory space of the preset address. Finally, the memory configuration information is obtained from the response information. The memory configuration information is successfully obtained without the Type17 interface, which breaks through the limitations of traditional SMBIOS memory configuration information reporting.
[0099] In some optional implementations, uploading the memory configuration information to the operating system includes:
[0100] Create a configuration information structure according to the preset specification, and write the memory configuration information into the configuration information structure;
[0101] The preset upload service is used to upload the memory configuration information in the configuration information structure to the preset location of the configuration data table in the operating system.
[0102] Specifically, the preset specification is such as SMBIOS specification, the configuration information structure is such as Type17 structure (SMBIOSTableType17), and the memory configuration information is such as SPD data of memory under CXL device. The configuration information structure is created according to the preset specification, and the SPD information of the memory is written into the configuration information structure one by one.
[0103] The preset upload service is for example: smbios->Add service, the configuration data table is for example: system Type17 data table, and the preset position is for example: the position after the system memory in the system Type17 data table. Using the preset upload service, the memory configuration information in the configuration information structure is uploaded to the preset position of the configuration data table in the operating system.
[0104] In this embodiment, the memory configuration information is written into the configuration information structure, and then the memory configuration information in the configuration information structure is uploaded to the preset location of the configuration data table in the operating system. The structure and data table are used to ensure the content and upload order of the memory configuration information, so that the memory configuration information can be accurately uploaded to the operating system.
[0105] In some optional implementations, obtaining device information of the target device from the configuration data set includes:
[0106] Obtaining a controller number of a device controller corresponding to the target device, wherein the number of controller numbers is a second preset number;
[0107] The device information of the target device on the device controller is obtained in the configuration data set according to the second preset number of controller numbers.
[0108] Specifically, the target device is, for example, a CXL device, and the device controller is, for example, a CXL controller. A dual CPU system can have up to 32 CXL controllers, and Index is the controller number of the CXL controller. The number of controller numbers is the second preset number, i.e., the number of CXL controllers. The second preset number is, for example, 32, and the specific number is set according to actual needs.
[0109] Get the controller number of the device controller corresponding to the target device, for example: the controller number of the device controller corresponding to the target device is 1.
[0110] The configuration data set is, for example, a data set mCxlNbioProtocol of a CXL device. According to the controller number of the second preset quantity, the device information of the target device on the device controller is obtained in the configuration data set. For example, in the data set mCxlNbioProtocol of the CXL device, the configuration information of the CXL device on the CXL controller whose Index is the controller number is obtained, and it is determined whether the information acquisition is successful. If successful, it proves that the CXL device exists on the current CXL controller, and the information collection continues; if unsuccessful, it proves that the CXL device does not exist on the current CXL controller, the controller number is increased by one, and the next CXL controller is accessed until all CXL controllers are traversed.
[0111] In some optional implementations, before acquiring the device information of the target device from the configuration data set, the method further includes:
[0112] Using the first interface function to obtain a configuration data set of the target device under the operating system;
[0113] The first interface function is checked to obtain status information of the configuration data set, and if the status information is a third preset value, the device information of the target device is obtained from the configuration data set.
[0114] Specifically, Protocol is similar to the interface function provided by UEFI in terms of function, and is an agreement between a service provider and a service caller, and the two parties communicate information based on this agreement. Therefore, the first interface function is, for example: LocateCxlNbio Protocol.
[0115] The first interface function is used to obtain configuration data sets of all registered target devices under the operating system. The configuration data set is, for example, the data set mCxlNbioProtocol of the CXL device.
[0116] The third preset value is, for example, success. Check the first interface function to obtain the status information of the configuration data set. If the status information is the third preset value, it means that there is a CXL device currently, and execute to obtain the device information of the target device from the configuration data set. If the status information is not the third preset value, it means that there is no CXL device currently, and exit the function directly without running the following code.
[0117] In this embodiment, the first interface function is checked to obtain status information of the configuration data set, and by judging whether the status information is a third preset value, it is determined whether the acquired configuration data set includes accurate device information. After determination, the device information of the target device is obtained from the configuration data set to ensure that the information is accurate.
[0118] In some optional embodiments, the method further comprises:
[0119] Registering a memory configuration information reporting event, wherein the memory configuration information reporting event is used to call a memory configuration information collection function when the second interface function is installed, and the second interface function is used to check the connection status of the driver in the operating system;
[0120] The memory configuration information collection function is used to execute subsequent steps starting from obtaining device information of the target device from the configuration data set when the configuration data set of the target device is obtained.
[0121] Specifically, the second interface function is, for example, gBdsAllDriversConnectedProtocolGuid protocol. The second interface function includes: checking the connection status of the driver in the operating system, and verifying that all necessary drivers have been correctly loaded and connected to the system. When the second interface function is installed, it means that the PCIe training has been completed and the configuration space of the CXL device can be accessed.
[0122] Register the memory configuration information reporting event. When the second interface function is installed, it is determined that the PCIe training has ended, the configuration space of the CXL device can be accessed, and the memory configuration information collection function is called. The memory configuration information collection function is, for example, a CXL Type 17 information collection function. The memory configuration information collection function is used to execute the above steps S101 to S104.
[0123] In this embodiment, by judging whether the second interface function is installed, it is determined whether the target device can be accessed. If the second interface function is installed, it is determined that the target device can be accessed, and then the memory configuration information collection function is called to report the memory configuration information to ensure that the memory configuration information can be obtained smoothly.
[0124] In some optional implementations, the specific process of reporting the SPD information of the memory to the operating system may also include steps A1 to A5.
[0125] Step A1, MXC reads the SPD information in the memory through I2C and stores it in its own DVSEC space.
[0126] Specifically, a configuration space register for storing the SPD information of the memory is defined in the MXC (Memory Expander Controller) as the DVSEC space of the MXC. The MXC and the CPU are connected via CXL / PCIe. After the MXC accesses the SPD information of the memory through the I2C link, the SPD information is stored in the DVSEC space.
[0127] In addition, if the sizes of different partitions in the memory are different, the memory size in the SPD information read by MXC is a total value. However, when MXC reports the SPD information, it can modify the memory size in the SPD information according to the specific circumstances of each partition. This can make the reported SPD information more accurate without adding other analysis operations.
[0128] Step A2, BIOS reads the information in the register corresponding to the DVSEC space whose space ID (Vendor ID) is 1e98h.
[0129] Step A3: judging whether the CXL device has memory expansion capability according to the read information.
[0130] Step A4: If the CXL device supports memory expansion, read the corresponding register (DVSEC Vendor ID: 30) to obtain SPD information. If the CXL device does not support memory expansion, there is no need to read the register to determine whether the next CXL device has memory expansion capability.
[0131] Specifically, the process of BIOS obtaining SPD information can also be: MXC first sends the SPD information to the BMC (Baseboard Management Controller) connected to MXC through the I2C line, and the BIOS (Basic Input Output System) then obtains the SPD information from the BMC through the IPMI command, and then reports the SPD information to the operating system.
[0132] Step A5: Add the read SPD information into the Type 17 data table of the operating system to complete the SPD information reporting.
[0133] In this embodiment, a configuration space register for storing SPD information is defined in MXC. After MXC is powered on, the SPD information is filled into its own configuration space register. After waiting for the CPU to be powered on, the BIOS can directly obtain the corresponding SPD information from the configuration space register of MXC, thereby realizing in-band asset information reporting of the CXL memory expansion device, which will help to locate faults in future application scenarios of large memory pools.
[0134] In some optional embodiments, Figure 2 : is a flowchart of a method for reporting Type 17 information of a CXL device according to an embodiment of the present invention. Figure 2 As shown, the process includes the following steps:
[0135] Register an event to call the CXL Type17 information collection function when the gBdsAllDriversConnectedProtocolGuid protocol is installed; Locate CxlNbio Protocol to obtain the dataset mCxlNbioProtocol of all registered CXL devices on the current system and return the status of the information obtained; Determine whether the status is success. If so, there may be 32 CXLs in the dual-CPU system. controller, traverse all controllers; judge Index = 0, Index < 32, Index++; obtain the CXL device information of the controller numbered Index through mCxlNbioProtocol; judge whether the acquisition of CXL device information is successful, if so, obtain the memory base address BarAddress accessed by the CXL device according to the PCIE specification and CXL specification through the CXL device bus number, device number, and function number obtained from mCxlNbioProtocol; each controller has a maximum of two memories, traverse all memories, and obtain the memory number in the silk screen: Dimmindex; judge Dimmindex = 0, Dimmindex < 2, if so, define the array RequestData
[16] = {0x00, 0x1b, 0x00, 0x00, 0x04, 0x01, 0x00, 0x00, 0x20, 0x0 1,0x00,0x00,0x05,0x00,0x00,0x00}, where RequestData
[10] =Dimmindex; write the data of RequestData
[16] to the memory space of address BarAddress+0x14 in sequence, and wait for 10 milliseconds for each access to CXL to obtain the return value; write 1 to address BarAddress+0x3ffc to generate an interrupt, and wait for 10 milliseconds for the SPD information of the CXL device to be written into the memory space; read the memory space data from address BarAddress+0x2000 to obtain the memory SPD information data set ResponseData; judge ResponseData
[11] =0, if yes, create Type17 structure SmbiosTableType17 based on SMBIOS specification, and write spd data one by one; add memory data to the system Type17 data table through Smbios->Add service. For the specific process, see Figure 2 .
[0136] In this embodiment, through the SMBIOS standardized format, the key information of the CXL device (such as type, status, configuration, etc.) can be consistently identified and processed by the operating system and management software, simplifying the system management and monitoring process. This standardized management method helps to ensure that the information of all CXL devices is presented in the same way, which is convenient for unified management. The reported information helps the system administrator to understand the status of the CXL device in a timely manner, facilitates fault diagnosis and maintenance, and reduces operation and maintenance costs. Through the SMBIOS information, it is easier to identify the problem, quickly locate the cause of the fault and take corresponding measures. Through the SMBIOS information, the distribution of CXL resources in the system can be better understood, providing a basis for resource allocation and future planning. Administrators can make more informed decisions based on this information, such as when to upgrade hardware, how to optimize configuration, etc. The reporting of CXL device information helps to ensure the compatibility and consistency between system components, thereby improving the stability and reliability of the entire system. Through the SMBIOS information, it can be ensured that the collaboration between CXL devices and other system components is more efficient.
[0137] In the present embodiment, a memory configuration information reporting device is also provided, which is used to implement the above-mentioned embodiments and preferred implementation modes, and the descriptions that have been made will not be repeated. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, the implementation of hardware, or a combination of software and hardware, is also possible and conceivable.
[0138] This embodiment provides a memory configuration information reporting device, such as Figure 3 As shown, including:
[0139] The first acquisition module 301 is used to acquire device information of the target device from the configuration data set when the configuration data set of the target device is acquired;
[0140] The second acquisition module 302 is used to obtain the device identification of the target device in the device information, determine the device start address of the target device according to the device identification, and obtain the memory base address of the target device according to the device start address and address offset information;
[0141] The third acquisition module 303 is used to obtain instructions according to the memory base address and the memory configuration information, access the target device and obtain the memory configuration information of the memory under the target device;
[0142] The upload module 304 is used to upload the memory configuration information to the operating system.
[0143] In some optional implementations, the second acquisition module 302 obtains the memory base address of the target device according to the device start address and address offset information, including:
[0144] Based on a preset addressing method, the device start address is offset by a first offset to obtain a first address, wherein the first offset is included in the address offset information;
[0145] Based on a preset addressing method, the device start address is offset by a second offset to obtain a second address, wherein the second offset is included in the address offset information;
[0146] The first address and the second address are combined to obtain the memory base address.
[0147] In some optional implementations, the third acquisition module 303 accesses the target device and acquires the memory configuration information of the memory under the target device according to the memory base address and the memory configuration information acquisition instruction, including:
[0148] Obtaining memory numbers of the memory under the target device, wherein the number of memory numbers is a first preset number;
[0149] Determine a target memory number from a first preset number of memory numbers, and generate a memory configuration information acquisition instruction including the target memory number according to a preset specification;
[0150] The memory base address is offset by a third offset to obtain a first target address, and the memory base address is offset by a fourth offset to obtain a second target address;
[0151] The data of the memory configuration information acquisition instruction are sequentially written into the memory space of the first target address, and the first preset value for generating an interrupt is written into the second target address, so as to write the response information corresponding to the memory configuration information acquisition instruction into the memory space of the preset address, wherein the interrupt is used to wait for a preset time length;
[0152] Accessing the memory space of the preset address, obtaining the response information, and determining whether the preset byte of the response information is a second preset value;
[0153] If the preset byte is the second preset value, the response information is used as the intermediate configuration information of the memory corresponding to the target memory number;
[0154] According to the target memory number and the preset step length, a new target memory number is determined from the first preset number of memory numbers, the new target memory number is used as the target memory number, and subsequent steps are executed starting from generating a memory configuration information acquisition instruction including the target memory number according to the preset specification until response information corresponding to each memory number is obtained;
[0155] Summarize the intermediate configuration information to obtain the memory configuration information of the memory under the target device.
[0156] In some optional implementations, the uploading module 304 uploads the memory configuration information to the operating system, including:
[0157] Create a configuration information structure according to the preset specification, and write the memory configuration information into the configuration information structure;
[0158] The preset upload service is used to upload the memory configuration information in the configuration information structure to the preset location of the configuration data table in the operating system.
[0159] In some optional implementations, the first acquisition module 301 acquires the device information of the target device from the configuration data set, including:
[0160] Obtaining a controller number of a device controller corresponding to the target device, wherein the number of controller numbers is a second preset number;
[0161] The device information of the target device on the device controller is obtained in the configuration data set according to the second preset number of controller numbers.
[0162] In some optional embodiments, the device further comprises:
[0163] A fourth acquisition module, used for acquiring a configuration data set of a target device under the operating system by using the first interface function;
[0164] The checking module is used to check the state information of the configuration data set obtained by the first interface function, and if the state information is a third preset value, obtain the device information of the target device from the configuration data set.
[0165] In some optional embodiments, the device further comprises:
[0166] A registration module, used for registering a memory configuration information reporting event, wherein the memory configuration information reporting event is used to call a memory configuration information collection function when the second interface function is installed, and the second interface function is used to check the connection status of the driver in the operating system;
[0167] The execution module is used for the memory configuration information collection function to execute subsequent steps starting from obtaining the device information of the target device from the configuration data set when the configuration data set of the target device is obtained.
[0168] The further functional description of each of the above modules and units is the same as that of the above corresponding embodiments and will not be repeated here.
[0169] The memory configuration information reporting device in this embodiment is presented in the form of a functional unit, where the unit refers to an ASIC (Application Specific Integrated Circuit) circuit, a processor and memory that executes one or more software or fixed programs, and / or other devices that can provide the above functions.
[0170] The embodiment of the present invention also provides a computer device having the above Figure 3 The memory configuration information shown is reported to the device.
[0171] See also Figure 4 , Figure 4 is a schematic diagram of the structure of a computer device provided by an optional embodiment of the present invention, such as Figure 4 As shown, the computer device includes: one or more processors 10, a memory 20, and interfaces for connecting various components, including high-speed interfaces and low-speed interfaces. Various components are connected to each other using different buses for communication, and can be installed on a common mainboard or installed in other ways as needed. The processor can process the instructions executed in the computer device, including instructions stored in or on the memory to display the graphical information of the GUI on an external input / output device (such as, a display device coupled to the interface). In some optional embodiments, if necessary, multiple processors and / or multiple buses can be used together with multiple memories and multiple memories. Similarly, multiple computer devices can be connected, and each device provides some necessary operations (for example, as a server array, a group of blade servers, or a multi-processor system). Figure 4 A processor 10 is taken as an example.
[0172] The processor 10 may be a central processing unit, a network processor or a combination thereof. The processor 10 may further include an integrated circuit, a programmable logic device or a combination thereof. The programmable logic device may be a complex programmable logic device, a field programmable logic gate array, a general purpose array logic or any combination thereof.
[0173] The memory 20 stores instructions executable by at least one processor 10, so that at least one processor 10 executes the method shown in the above embodiment.
[0174] The memory 20 may include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the computer device, etc. In addition, the memory 20 may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some optional embodiments, the memory 20 may optionally include a memory remotely arranged relative to the processor 10, and these remote memories may be connected to the computer device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0175] The memory 20 may include a volatile memory, such as a random access memory; the memory may also include a non-volatile memory, such as a flash memory, a hard disk or a solid state drive; the memory 20 may also include a combination of the above types of memory.
[0176] The computer device further comprises a communication interface 30 for the computer device to communicate with other devices or a communication network.
[0177] The embodiment of the present invention also provides a computer non-volatile readable storage medium. The above method according to the embodiment of the present invention can be implemented in hardware, firmware, or implemented as a computer code that can be recorded in a storage medium, or downloaded through a network and originally stored in a remote storage medium or a non-temporary machine-readable storage medium and will be stored in a local storage medium, so that the method described herein can be stored in such software processing on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. Among them, the storage medium can be a magnetic disk, an optical disk, a read-only storage memory, a random access memory, a flash memory, a hard disk or a solid-state hard disk, etc.; further, the storage medium can also include a combination of the above types of memories. It can be understood that a computer, a processor, a microprocessor controller or programmable hardware includes a storage component that can store or receive software or computer code. When the software or computer code is accessed and executed by a computer, a processor or hardware, the method shown in the above embodiment is implemented.
[0178] A part of the present invention may be applied as a computer program product, such as a computer program instruction, which, when executed by a computer, can call or provide the method and / or technical solution according to the present invention through the operation of the computer. Those skilled in the art should understand that the existence of computer program instructions in computer-readable media includes, but is not limited to, source files, executable files, installation package files, etc., and accordingly, the way in which computer program instructions are executed by a computer includes, but is not limited to: the computer directly executes the instruction, or the computer compiles the instruction and then executes the corresponding compiled program, or the computer reads and executes the instruction, or the computer reads and installs the instruction and then executes the corresponding installed program. Here, the computer-readable medium may be any available computer-readable non-volatile storage medium or communication medium accessible to the computer.
[0179] Although the embodiments of the present invention have been described in conjunction with the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention, and such modifications and variations are all within the scope defined in this application.
Claims
1. A method for reporting memory configuration information, characterized in that: The method comprises: When the configuration data set of the target device is obtained, obtaining device information of the target device from the configuration data set; Obtaining a device identification of the target device from the device information, determining a device start address of the target device according to the device identification, and obtaining a memory base address of the target device according to the device start address and address offset information; According to the memory base address and the memory configuration information acquisition instruction, access the target device and acquire the memory configuration information of the memory under the target device; The memory configuration information is uploaded to the operating system.
2. The method according to claim 1, characterized in that The step of obtaining the memory base address of the target device according to the device start address and the address offset information includes: Based on a preset addressing method, the device start address is offset by a first offset to obtain a first address, wherein the first offset is included in the address offset information; Based on a preset addressing method, the device start address is offset by a second offset to obtain a second address, wherein the second offset is included in the address offset information; The memory base address is obtained by combining the first address and the second address.
3. The method according to claim 1, characterized in that The step of accessing the target device and acquiring memory configuration information of the memory of the target device according to the memory base address and the memory configuration information acquisition instruction includes: Obtaining memory numbers of the memory under the target device, wherein the number of the memory numbers is a first preset number; Determine a target memory number from a first preset number of the memory numbers, and generate the memory configuration information acquisition instruction including the target memory number according to a preset specification; The memory base address is offset by a third offset to obtain a first target address, and the memory base address is offset by a fourth offset to obtain a second target address; The data of the memory configuration information acquisition instruction are sequentially written into the memory space of the first target address, and the first preset value for generating an interrupt is written into the second target address, so as to write the response information corresponding to the memory configuration information acquisition instruction into the memory space of the preset address, wherein the interrupt is used to wait for a preset time length; Accessing the memory space of the preset address to obtain the response information, and determining whether the preset byte of the response information is a second preset value; If the preset byte is the second preset value, using the response information as the intermediate configuration information of the memory corresponding to the target memory number; According to the target memory number and the preset step length, a new target memory number is determined from a first preset number of the memory numbers, the new target memory number is used as the target memory number, and subsequent steps are executed starting from the memory configuration information acquisition instruction including the target memory number generated according to the preset specification until response information corresponding to each memory number is obtained; The intermediate configuration information is aggregated to obtain memory configuration information of the memory under the target device.
4. The method according to claim 1, characterized in that: The uploading of the memory configuration information to the operating system includes: Create a configuration information structure according to a preset specification, and write the memory configuration information into the configuration information structure; The memory configuration information in the configuration information structure is uploaded to a preset location of a configuration data table in the operating system using a preset upload service.
5. The method according to claim 1, characterized in that The acquiring the device information of the target device from the configuration data set includes: Obtaining a controller number of a device controller corresponding to the target device, wherein the number of the controller numbers is a second preset number; The device information of the target device on the device controller is obtained in the configuration data set according to a second preset number of controller numbers.
6. The method according to claim 1, characterized in that Before acquiring the device information of the target device from the configuration data set, the method further includes: Acquire the configuration data set of the target device under the operating system using a first interface function; The first interface function is checked to obtain status information of the configuration data set, and if the status information is a third preset value, the device information of the target device is obtained from the configuration data set.
7. The method according to claim 1, characterized in that The method further comprises: Registering a memory configuration information reporting event, wherein the memory configuration information reporting event is used to call a memory configuration information collection function when a second interface function is installed, and the second interface function is used to check the connection status of a driver in the operating system; The memory configuration information collection function is used to execute subsequent steps starting from acquiring the device information of the target device from the configuration data set when the configuration data set of the target device is acquired.
8. A memory configuration information reporting device, characterized in that: The device comprises: A first acquisition module, configured to acquire device information of the target device from the configuration data set when the configuration data set of the target device is acquired; A second acquisition module is used to obtain a device identification of the target device from the device information, determine a device start address of the target device according to the device identification, and obtain a memory base address of the target device according to the device start address and address offset information; A third acquisition module, configured to obtain instructions according to the memory base address and the memory configuration information, access the target device and obtain the memory configuration information of the memory under the target device; The uploading module is used to upload the memory configuration information to the operating system.
9. A computer device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the memory configuration information reporting method according to any one of claims 1 to 7 by executing the computer instructions.
10. A computer non-volatile readable storage medium, characterized in that: The computer non-volatile readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the memory configuration information reporting method according to any one of claims 1 to 7.
Citation Information
Patent Citations
PCIe device management method and operation system thereof
CN112000593A
NVME communication system and method based on PCIE interface
CN115454902A
Asset information reporting method and device, storage medium and electronic equipment
CN116521429A
Register simulation configuration method and device, computer equipment and storage medium
CN117112452A
CXL memory module, resource allocation method, control chip, medium and system
CN117785755A
Cited By
Firmware control method and device of processor, processor, equipment, storage medium and program product
CN122331977A