There are two ways to drive the p-ch MOSFET. The first is to set the MCU's pin to output mode and switch it between low and high. The other one emulates an open collector. In this case the MCU's pin is set to output mode and low level (shorted to ground) or input mode (open). Let's assume you're going for the first method. The pull-up resistor is just for turning off the MOSFET when the MCU isn't ready. It will also limit the current passing through the MCU's pin when switched to low, i.e. limiting the power loss. On the other side you want it to be a not too high value to switch off the MOSFET fast enough. The MOSFET's gate requires a specific charge for switching. This brings us to the resistor protecting the MCU's pin. The MCU's pin has a limit for sourcing and sinking current. Without the resistor the MCU's pin would have to deal with a current limited just by the MCU's internal resistance of the output driver. For MOSFETs with a small gate charge it might work without the protection resistor. But for MOSFETs with a high gate charge you would exceed the pin's maximum current without the current limiting resistor. Again, there's a tradeoff between protecting the pin and the MOSFET's switching time. If the pin can't sink/source sufficient current but you want fast switching you have to add an external driver.