Dissolve 2 stock cubes in half a liter of boiling water.
Chop the onion, celery and carrot very finely (in a food mixer is good). Cut the pancetta or guanciale into thin pieces. Peel the garlic. If using canned beans, drain them.
Heat a tablespoon of olive oil in a pan. Add the garlic clove peeled but not cut and cook it until it browns, then remove it. Add the pancetta to the pan and cook until the fat starts to melt.
Add the finely chopped vegetables to the pan and cook until they start to soften. Then, add a ladleful of the stock and cook the vegetables another minute or two.
Add the crushed tomatoes (passata) and salt and pepper as desired.
Add another ladleful of stock and cook for a couple more minutes.
Add the precooked beans and mix the ingredients well, whilst adding the last of the stock. Allow to simmer for 10 minutes.
Put the water on to boil for the pasta.
Whilst waiting for the water to boil, remove 3 ladlefuls from the soup and liquidize it in a food processor until it's smooth and creamy. Then add this mixture back into the soup and stir well.
When the pasta is cooked al dente (according to the instructions on the packet), drain and add it to the soup.
Season with the finely chopped rosemary and pour into bowls. Add a little olive oil to the soup just before serving ( don't mix it in) and grated cheese if required