Preheat oven to 300 F.
When the oven is up to heat, put the squash on its side on a baking sheet lined with foil or parchment paper, and bake it for 3 hours. When it's done, the skin should be caramelized and easy to pierce with a fork.
Let the squash cool for at least 15 minutes, then cut it in half lengthwise, scoop out and discard the seeds, and spoon out the flesh into a bowl.
Sprinkle the garlic and onions with salt and pepper and sautée them in olive oil over medium heat until they're fragrant (about 3-4 minutes).
Turn down the heat and add tomato paste, spices, red pepper flakes, and 1 tsp of salt and cook for 4 minutes.
Stir in coconut milk, stock, and ginger. Cover the pot and simmer on low for 20 minutes.
Add the squash and and blend everything together with an immersion blender until smooth. Cover and simmer on low for another 10 minutes.