For CPU compatibility with your system, you will want to look at 4 things:
1. Socket support.
The CPU has to be compatible with your motherboard's socket. Here is a brief list of mainstream CPUs and the sockets they will work in as of June 2010:
Athlon 64: AM2, AM2+
Phenom (includes Athlon): AM2, AM2+
Phenom II (includes Athlon II): AM2, AM2+ AM3
3. Motherboard wattage support must support the TDP of given CPU.
Listed on most manufacturer's websites, even OEMs like HP.
4. Bios support.
This is easy with a motherboard you bought non-OEM. Simply visit the Motherboard manufacturer's website, look up your Motherboard model and look for "CPU support".
This is more difficult with OEM motherboards. (motherboards that came with computers purchased from the likes of HP, Acer etc. These are OEM manufacturers) They will only ever officially support the CPUs that they came with originally.
There is always the odd chance that if the chipset is compatible, the CPU will work, regardless. If the bios is not compatible, it might not work properly. From incorrect speeds to just not working at all. The only way to know for sure if your CPU will work in the case of steps 1-3 checking out but step 4 not checking out is to try the CPU in the computer or find another person with the exact same computer who has tried your "new" CPU in their computer. That said, if it meets steps 1-3, it will likely work.