I think you are talking about your wisdom tooth which is erupting or it is not erupted properly, and the opposing tooth would have injured the skin/mucosa covering it. You need to be assessed by the dentist both clinically and using X ray for a permanent solution.
If it's the same problem as described above, for temporary relief, you can have the dentist grind your upper wisdom tooth and may be you will need painkillers and antibiotics.
Next Steps
Please visit your dentist now..
Health Tips
Avoid chewing any hard food substances for the time being and gargle warm water and salt solution 3-4 times. You can also apply Dologel CT gel over the affected part of the skin for temporary relief.