Heat oil in a large pot over medium heat. Add onion and cook until softened, about 8 minutes. Add garlic and cook for 1 minute more.
Add chicken stock, beans, rosemary, and red pepper flakes to the pot. Bring to a boil, then reduce heat and simmer for 30 minutes.
Using an immersion blender, blend about half of the soup to create a creamy texture. Alternatively, carefully transfer half of the soup to a blender and blend until smooth, then return to the pot.
Stir in Parmesan cheese. Season with salt and pepper to taste.
Serve immediately, garnished with more Parmesan cheese.