简体   繁体   中英

Start a second core with PSCI on QEMU

Good day, I am currently writing my first boot-loader for the linux operating system for the cortex a72 processor using qemu.

Since I am doing some complex calculations (CRC32, SHA256, signature check...) the code takes quite some time to execute on one core. So I have decided to use the power of more than 1 core, to speed up computation, and have some parallelism.

From the research that I have conducted I found that I have to start up my second core using the PSCI protocole, and taking a look at the Device tree revealed the configuration of my psci. Here is some relevant information from the.dtb:

    psci {
        migrate = <0xc4000005>;
        cpu_on = <0xc4000003>;
        cpu_off = <0x84000002>;
        cpu_suspend = <0xc4000001>;
        method = "hvc";
        compatible = "arm,psci-1.0", "arm,psci-0.2", "arm,psci";
    };

            cpu@0 {
                phandle = <0x00008004>;
                reg = <0x00000000>;
                enable-method = "psci";
                compatible = "arm,cortex-a72";
                device_type = "cpu";
            };
            cpu@1 {
                phandle = <0x00008003>;
                reg = <0x00000001>;
                enable-method = "psci";
                compatible = "arm,cortex-a72";
                device_type = "cpu";
            };

So now it seems like there is all the needed information to start the second core.

However I am not sure how to use the hvc method to do that having found examples that only explain the smc method.

Furthermore, how should I implement concurrency and parallelism?

The basic usage I would wish to achieve is to have my CRC32 algorithm running on one core, and my SHA256 running on the other. Would the two cores be able to access the common UART? I guess that there is some way to know that a core has finished executing a program, so race conditions should not be hard to catch.

It would be of great help if anyone could provide any guidance to implement this feature.

Thanks in advance!

The official documentation of how to use PSCI calls is in the Arm Power State Coordination Interface Platform Design Document . But the short answer is that the only difference between the HVC method and the SMC method is that for one you use the "HVC" instruction and for the other the "SMC" instruction -- everything else is identical.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM